diff --git a/pom.xml b/pom.xml
index 03adc2d..a2483f2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
ru.simsonic
rscPermissions
- 0.9.3a
+ 0.9.4a
jar
rscPermissions
@@ -16,15 +16,11 @@
sponge-repo
http://repo.spongepowered.org/Sponge/maven/
-
- bukkit-repo
- http://repo.bukkit.org/content/groups/public/
-
spigot-repo
https://hub.spigotmc.org/nexus/content/groups/public/
-
+
metrics-repo
http://repo.mcstats.org/content/repositories/public/
diff --git a/src/main/java/ru/simsonic/rscPermissions/API/PlayerType.java b/src/main/java/ru/simsonic/rscPermissions/API/PlayerType.java
index 5c51116..15d90a5 100644
--- a/src/main/java/ru/simsonic/rscPermissions/API/PlayerType.java
+++ b/src/main/java/ru/simsonic/rscPermissions/API/PlayerType.java
@@ -46,6 +46,7 @@ public enum PlayerType
return hyphenatedUUID;
if(dehyphenatedRegExp.matcher(entity.toLowerCase()).matches())
return dehyphenatedUUID;
+ /*
final Matcher mIP1 = ipWildcardRegExp.matcher(entity);
if(mIP1.matches())
{
@@ -55,6 +56,7 @@ public enum PlayerType
final String a4 = mIP1.group(4);
// TO DO
long address = 0, mask = 0;
+ return internetWildcard;
}
final Matcher mIP2 = ipSubnetMaskRegExp.matcher(entity);
if(mIP2.matches())
@@ -66,9 +68,12 @@ public enum PlayerType
final String sn = mIP1.group(5);
// TO DO
long address = 0, mask = 0;
+ return internetSubnetMask;
}
+ */
return inapplicable;
}
+ /*
public static void getAddressDetails(String entity, RowPermission row)
{
final Matcher mIP1 = ipWildcardRegExp.matcher(entity);
@@ -97,16 +102,19 @@ public enum PlayerType
long address = 0, mask = 0;
}
}
+ */
public boolean isEntityApplicable(String entity, String identifier)
{
+ if(entity == null || "".equals(entity) || identifier == null || "".equals(identifier))
+ return false;
switch(this)
{
case name:
return identifier.equals(entity);
case hyphenatedUUID:
- identifier = identifier.replace("-", "").toLowerCase();
+ identifier = identifier.replace("-", "");
case dehyphenatedUUID:
- return entity.equals(identifier);
+ return entity.equalsIgnoreCase(identifier);
}
return false;
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/API/Settings.java b/src/main/java/ru/simsonic/rscPermissions/API/Settings.java
index 64aebf1..24d0ef8 100644
--- a/src/main/java/ru/simsonic/rscPermissions/API/Settings.java
+++ b/src/main/java/ru/simsonic/rscPermissions/API/Settings.java
@@ -21,6 +21,6 @@ public interface Settings
public long getRegionFinderGranularity();
public int getAutoReloadDelayTicks();
public boolean isUseMetrics();
- public String getLanguage();
- public ConnectionParams getConnectionParams();
+ public TranslationProvider getTranslationProvider();
+ public ConnectionParams getConnectionParams();
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/API/TranslationProvider.java b/src/main/java/ru/simsonic/rscPermissions/API/TranslationProvider.java
new file mode 100644
index 0000000..93a52a0
--- /dev/null
+++ b/src/main/java/ru/simsonic/rscPermissions/API/TranslationProvider.java
@@ -0,0 +1,6 @@
+package ru.simsonic.rscPermissions.API;
+
+public interface TranslationProvider
+{
+ public String getString(String path);
+}
diff --git a/src/main/java/ru/simsonic/rscPermissions/Backends/BackendDatabase.java b/src/main/java/ru/simsonic/rscPermissions/Backends/BackendDatabase.java
index a096457..969385c 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Backends/BackendDatabase.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Backends/BackendDatabase.java
@@ -28,14 +28,6 @@ public class BackendDatabase extends ConnectionMySQL
contents.entities = fetchEntities();
contents.permissions = fetchPermissions();
contents.inheritance = fetchInheritance();
- logger.log(Level.INFO,
- "[rscp] Fetched {0} entities, {1} permissions and {2} inheritances",
- new Integer[]
- {
- contents.entities.length,
- contents.permissions.length,
- contents.inheritance.length,
- });
return contents;
}
private RowEntity[] fetchEntities()
diff --git a/src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java b/src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java
index 98547e4..6825bc4 100644
--- a/src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java
+++ b/src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java
@@ -1,4 +1,5 @@
package ru.simsonic.rscPermissions;
+import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.ServicePriority;
import ru.simsonic.rscPermissions.Bukkit.VaultChat;
@@ -14,7 +15,7 @@ public class BridgeForBukkitAPI
private final BukkitPluginMain rscp;
private final VaultPermission vaultPermission;
private final VaultChat vaultChat;
- public BridgeForBukkitAPI(BukkitPluginMain plugin)
+ protected BridgeForBukkitAPI(BukkitPluginMain plugin)
{
BridgeForBukkitAPI.instance = BridgeForBukkitAPI.this;
this.rscp = plugin;
@@ -41,6 +42,13 @@ public class BridgeForBukkitAPI
{
return rscp.isEnabled();
}
+ public Player findPlayer(String player)
+ {
+ for(Player online : rscp.getServer().getOnlinePlayers())
+ if(online.getName().equals(player))
+ return online;
+ return null;
+ }
protected void setupVault()
{
final Plugin plugin = rscp.getServer().getPluginManager().getPlugin("Vault");
@@ -54,7 +62,8 @@ public class BridgeForBukkitAPI
rscp.getServer().getServicesManager().register(
net.milkbowl.vault.permission.Permission.class, vaultPermission,
rscp, ServicePriority.Highest);
- BukkitPluginMain.consoleLog.info("[rscp] Vault found and integrated.");
- }
+ BukkitPluginMain.consoleLog.info("[rscp] Vault was found and integrated.");
+ } else
+ BukkitPluginMain.consoleLog.info("[rscp] Sorry, I cannot find Vault...");
}
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPermissionManager.java b/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPermissionManager.java
index 6299aa1..6809eb3 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPermissionManager.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPermissionManager.java
@@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionAttachment;
@@ -21,11 +22,12 @@ public class BukkitPermissionManager extends RestartableThread
this.rscp = plugin;
}
private final LinkedBlockingQueue updateQueue = new LinkedBlockingQueue<>();
- private final HashMap attachments = new HashMap<>();
- private final HashMap> persistentPermissions = new HashMap<>();
- private final HashMap> transientPermissions = new HashMap<>();
- private final HashMap prefixes = new HashMap<>();
- private final HashMap suffixes = new HashMap<>();
+ private final Map attachments = new HashMap<>();
+ private final Map> persistentPermissions = new HashMap<>();
+ private final Map> transientPermissions = new HashMap<>();
+ private final Map> groups = new ConcurrentHashMap<>();
+ private final Map prefixes = new ConcurrentHashMap<>();
+ private final Map suffixes = new ConcurrentHashMap<>();
public void recalculateOnlinePlayers()
{
updateQueue.addAll(rscp.getServer().getOnlinePlayers());
@@ -46,6 +48,21 @@ public class BukkitPermissionManager extends RestartableThread
return attachment.getPermissions();
return Collections.EMPTY_MAP;
}
+ public String getPlayerPrefix(Player player)
+ {
+ final String prefix = prefixes.get(player);
+ return prefix != null ? prefix : "";
+ }
+ public String getPlayerSuffix(Player player)
+ {
+ final String suffix = suffixes.get(player);
+ return suffix != null ? suffix : "";
+ }
+ public Set getPlayerGroups(Player player)
+ {
+ final Set result = groups.get(player);
+ return result != null ? result : Collections.EMPTY_SET;
+ }
public void removePlayer(Player player)
{
updateQueue.remove(player);
@@ -65,6 +82,7 @@ public class BukkitPermissionManager extends RestartableThread
for(Player current = updateQueue.take(); current != null; current = updateQueue.take())
{
final ResolutionResult result = rscp.permissionManager.resolvePlayer(current);
+ groups.put(current, result.groups);
prefixes.put(current, result.prefix);
suffixes.put(current, result.suffix);
persistentPermissions.put(current, result.permissions);
diff --git a/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPluginConfiguration.java b/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPluginConfiguration.java
index c70e4bd..88038ff 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPluginConfiguration.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Bukkit/BukkitPluginConfiguration.java
@@ -1,6 +1,9 @@
package ru.simsonic.rscPermissions.Bukkit;
+import java.io.File;
import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
import ru.simsonic.rscPermissions.API.Settings;
+import ru.simsonic.rscPermissions.API.TranslationProvider;
import ru.simsonic.rscPermissions.BukkitPluginMain;
import ru.simsonic.rscUtilityLibrary.ConnectionMySQL.ConnectionParams;
@@ -62,7 +65,7 @@ public class BukkitPluginConfiguration implements Settings
language = config.getString("settings.language", "english");
strDefaultGroup = config.getString("settings.default-group", "Default");
strMaintenanceMode = config.getString("settings.maintenance-mode", "");
- bAlwaysInheritDefault = config.getBoolean("always-inherit-default-group", false);
+ bAlwaysInheritDefault = config.getBoolean("settings.always-inherit-default-group", false);
bTreatAsteriskAsOP = config.getBoolean("settings.treat-asterisk-as-op", true);
bUseMetrics = config.getBoolean("settings.use-metrics", true);
bUseWorldGuard = config.getBoolean("settings.integration.worldguard", true);
@@ -78,7 +81,7 @@ public class BukkitPluginConfiguration implements Settings
@Override
public boolean isInMaintenance()
{
- return ! "".equals(strMaintenanceMode);
+ return !"".equals(strMaintenanceMode);
}
@Override
public String getMaintenanceMode()
@@ -128,9 +131,18 @@ public class BukkitPluginConfiguration implements Settings
return nRegionFinderGranularity;
}
@Override
- public String getLanguage()
+ public TranslationProvider getTranslationProvider()
{
- return language;
+ final File langFile = new File(plugin.getDataFolder(), language + ".yml");
+ final YamlConfiguration langConfig = YamlConfiguration.loadConfiguration(langFile);
+ return new TranslationProvider()
+ {
+ @Override
+ public String getString(String path)
+ {
+ return langConfig.getString(path, path);
+ }
+ };
}
@Override
public ConnectionParams getConnectionParams()
diff --git a/src/main/java/ru/simsonic/rscPermissions/Bukkit/Commands/BukkitCommands.java b/src/main/java/ru/simsonic/rscPermissions/Bukkit/Commands/BukkitCommands.java
index f9a3d55..e0ae1b6 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Bukkit/Commands/BukkitCommands.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Bukkit/Commands/BukkitCommands.java
@@ -7,11 +7,13 @@ import java.util.logging.Level;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import ru.simsonic.rscPermissions.API.Settings;
import ru.simsonic.rscPermissions.Backends.DatabaseContents;
import ru.simsonic.rscPermissions.Bukkit.PermissionsEx_YAML;
import ru.simsonic.rscPermissions.BukkitPluginMain;
import ru.simsonic.rscUtilityLibrary.CommandProcessing.CommandAnswerException;
import ru.simsonic.rscUtilityLibrary.RestartableThread;
+import ru.simsonic.rscUtilityLibrary.TextProcessing.GenericChatCodes;
public class BukkitCommands
{
@@ -32,11 +34,12 @@ public class BukkitCommands
return;
}
final DatabaseContents contents = rscp.connection.retrieveContents();
+ rscp.connection.disconnect();
if(contents != null)
{
contents.normalize();
- rscp.fileCache.cleanup();
- rscp.fileCache.saveContents(contents);
+ rscp.localStorage.cleanup();
+ rscp.localStorage.saveContents(contents);
contents.filterServerId(rscp.getServer().getServerId());
rscp.internalCache.fill(contents);
final Runnable syncTask = new Runnable()
@@ -44,6 +47,14 @@ public class BukkitCommands
@Override
public synchronized void run()
{
+ BukkitPluginMain.consoleLog.log(Level.INFO,
+ "[rscp] Fetched {0} entities, {1} permissions and {2} inheritances",
+ new Integer[]
+ {
+ contents.entities.length,
+ contents.permissions.length,
+ contents.inheritance.length,
+ });
rscp.permissionManager.recalculateOnlinePlayers();
notify();
}
@@ -70,7 +81,7 @@ public class BukkitCommands
{
try
{
- setName("rscp:MigrateFromPExSQL");
+ setName("rscp:MigrateFromPermissionsEx-SQL");
rscp.connection.executeUpdateT("Migrate_from_PermissionsEx");
threadFetchDatabaseContents.join();
rscp.getServer().getScheduler().runTask(rscp, new Runnable()
@@ -78,8 +89,10 @@ public class BukkitCommands
@Override
public void run()
{
- rscp.formattedMessage(sender, "Migration from PermissionsEx (MySQL backend) done!");
- rscp.formattedMessage(sender, "Check the latest database row for new data.");
+ sender.sendMessage(GenericChatCodes.processStringStatic(Settings.chatPrefix
+ + "Migration from PermissionsEx (MySQL backend) done!"));
+ sender.sendMessage(GenericChatCodes.processStringStatic(Settings.chatPrefix
+ + "Check the latest database row for new data."));
}
});
} catch(InterruptedException ex) {
@@ -283,11 +296,8 @@ public class BukkitCommands
throw new CommandAnswerException(list);
case "groups":
list.add("{MAGENTA}Group list for {_YL}" + player.getName() + "{MAGENTA}:");
- /*
- ArrayList groups = plugin.cache.getUserGroups(player.getName());
- for(String group : groups)
+ for(String group : rscp.permissionManager.getPlayerGroups(player))
list.add("{_LG}" + group);
- */
throw new CommandAnswerException(list);
/*
case "ranks":
diff --git a/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultChat.java b/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultChat.java
index 34af9ea..7c0207a 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultChat.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultChat.java
@@ -3,14 +3,17 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.entity.Player;
import ru.simsonic.rscPermissions.BridgeForBukkitAPI;
+import ru.simsonic.rscPermissions.BukkitPluginMain;
public final class VaultChat extends net.milkbowl.vault.chat.Chat
{
private final BridgeForBukkitAPI bridge;
+ private final BukkitPluginMain rscp;
public VaultChat(BridgeForBukkitAPI bridge, net.milkbowl.vault.permission.Permission perms)
{
super(perms);
this.bridge = bridge;
+ this.rscp = (BukkitPluginMain)bridge.getPlugin();
}
@Override
public String getName()
@@ -25,336 +28,338 @@ public final class VaultChat extends net.milkbowl.vault.chat.Chat
@Override
public String getPlayerPrefix(String world, String player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ final Player online = bridge.findPlayer(player);
+ return online != null ? rscp.permissionManager.getPlayerPrefix(online) : null;
}
@Override
- public void setPlayerPrefix(String world, String player, String prefix)
+ public String getPlayerSuffix(String world, String player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ final Player online = bridge.findPlayer(player);
+ return online != null ? rscp.permissionManager.getPlayerSuffix(online) : null;
}
@Override
- public String getPlayerSuffix(String world, String player)
+ public void setPlayerPrefix(String world, String player, String prefix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerSuffix(String world, String player, String suffix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getGroupPrefix(String world, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupPrefix(String world, String group, String prefix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getGroupSuffix(String world, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupSuffix(String world, String group, String suffix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public int getPlayerInfoInteger(String world, String player, String node, int defaultValue)
+ public String getPlayerPrefix(String world, OfflinePlayer player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerInfoInteger(String world, String player, String node, int value)
+ public String getPlayerPrefix(Player player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ return rscp.permissionManager.getPlayerPrefix(player);
}
@Override
- public int getGroupInfoInteger(String world, String group, String node, int defaultValue)
+ public void setPlayerPrefix(String world, OfflinePlayer player, String prefix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setGroupInfoInteger(String world, String group, String node, int value)
+ public void setPlayerPrefix(Player player, String prefix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public double getPlayerInfoDouble(String world, String player, String node, double defaultValue)
+ public String getPlayerSuffix(String world, OfflinePlayer player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerInfoDouble(String world, String player, String node, double value)
+ public String getPlayerSuffix(Player player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ return rscp.permissionManager.getPlayerSuffix(player);
}
@Override
- public double getGroupInfoDouble(String world, String group, String node, double defaultValue)
+ public void setPlayerSuffix(String world, OfflinePlayer player, String suffix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setGroupInfoDouble(String world, String group, String node, double value)
+ public void setPlayerSuffix(Player player, String suffix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue)
+ public String getGroupPrefix(World world, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerInfoBoolean(String world, String player, String node, boolean value)
+ public void setGroupPrefix(World world, String group, String prefix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue)
+ public String getGroupSuffix(World world, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setGroupInfoBoolean(String world, String group, String node, boolean value)
+ public void setGroupSuffix(World world, String group, String suffix)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getPlayerInfoString(String world, String player, String node, String defaultValue)
+ public boolean playerInGroup(String world, OfflinePlayer player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerInfoString(String world, String player, String node, String value)
+ public boolean playerInGroup(Player player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getGroupInfoString(String world, String group, String node, String defaultValue)
+ public String[] getPlayerGroups(String world, OfflinePlayer player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setGroupInfoString(String world, String group, String node, String value)
+ public String[] getPlayerGroups(Player player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getPlayerPrefix(String world, OfflinePlayer player)
+ public String getPrimaryGroup(String world, OfflinePlayer player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getPlayerPrefix(Player player)
+ public String getPrimaryGroup(Player player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerPrefix(String world, OfflinePlayer player, String prefix)
+ public String[] getGroups()
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerPrefix(Player player, String prefix)
+ public int getPlayerInfoInteger(String world, String player, String node, int defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getPlayerSuffix(String world, OfflinePlayer player)
+ public void setPlayerInfoInteger(String world, String player, String node, int value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getPlayerSuffix(Player player)
+ public int getGroupInfoInteger(String world, String group, String node, int defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerSuffix(String world, OfflinePlayer player, String suffix)
+ public void setGroupInfoInteger(String world, String group, String node, int value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setPlayerSuffix(Player player, String suffix)
+ public double getPlayerInfoDouble(String world, String player, String node, double defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getGroupPrefix(World world, String group)
+ public void setPlayerInfoDouble(String world, String player, String node, double value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setGroupPrefix(World world, String group, String prefix)
+ public double getGroupInfoDouble(String world, String group, String node, double defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public String getGroupSuffix(World world, String group)
+ public void setGroupInfoDouble(String world, String group, String node, double value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
- public void setGroupSuffix(World world, String group, String suffix)
+ public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue)
+ {
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
+ }
+ @Override
+ public void setPlayerInfoBoolean(String world, String player, String node, boolean value)
+ {
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
+ }
+ @Override
+ public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue)
+ {
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
+ }
+ @Override
+ public void setGroupInfoBoolean(String world, String group, String node, boolean value)
+ {
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
+ }
+ @Override
+ public String getPlayerInfoString(String world, String player, String node, String defaultValue)
+ {
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
+ }
+ @Override
+ public void setPlayerInfoString(String world, String player, String node, String value)
+ {
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
+ }
+ @Override
+ public String getGroupInfoString(String world, String group, String node, String defaultValue)
+ {
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
+ }
+ @Override
+ public void setGroupInfoString(String world, String group, String node, String value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public int getPlayerInfoInteger(Player player, String node, int defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoInteger(Player player, String node, int value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public int getGroupInfoInteger(World world, String group, String node, int defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoInteger(World world, String group, String node, int value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public double getPlayerInfoDouble(Player player, String node, double defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoDouble(Player player, String node, double value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public double getGroupInfoDouble(World world, String group, String node, double defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoDouble(World world, String group, String node, double value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoBoolean(Player player, String node, boolean value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoBoolean(World world, String group, String node, boolean value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getPlayerInfoString(Player player, String node, String defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setPlayerInfoString(Player player, String node, String value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getGroupInfoString(World world, String group, String node, String defaultValue)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public void setGroupInfoString(World world, String group, String node, String value)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
- }
- @Override
- public boolean playerInGroup(String world, OfflinePlayer player, String group)
- {
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
- }
- @Override
- public boolean playerInGroup(Player player, String group)
- {
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
- }
- @Override
- public String[] getPlayerGroups(String world, OfflinePlayer player)
- {
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
- }
- @Override
- public String[] getPlayerGroups(Player player)
- {
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
- }
- @Override
- public String getPrimaryGroup(String world, OfflinePlayer player)
- {
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
- }
- @Override
- public String getPrimaryGroup(Player player)
- {
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
- }
- @Override
- public String[] getGroups()
- {
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultPermission.java b/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultPermission.java
index fbdaa67..ccc88cb 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultPermission.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Bukkit/VaultPermission.java
@@ -4,13 +4,16 @@ import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import ru.simsonic.rscPermissions.BridgeForBukkitAPI;
+import ru.simsonic.rscPermissions.BukkitPluginMain;
public class VaultPermission extends net.milkbowl.vault.permission.Permission
{
private final BridgeForBukkitAPI bridge;
+ private final BukkitPluginMain rscp;
public VaultPermission(BridgeForBukkitAPI bridge)
{
this.bridge = bridge;
+ this.rscp = (BukkitPluginMain)bridge.getPlugin();
}
@Override
public String getName()
@@ -30,216 +33,216 @@ public class VaultPermission extends net.milkbowl.vault.permission.Permission
@Override
public boolean playerHas(String world, String player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAdd(String world, String player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemove(String world, String player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean groupHas(String world, String group, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean groupAdd(String world, String group, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean groupRemove(String world, String group, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerInGroup(String world, String player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAddGroup(String world, String player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemoveGroup(String world, String player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String[] getPlayerGroups(String world, String player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getPrimaryGroup(String world, String player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String[] getGroups()
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean hasGroupSupport()
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean has(CommandSender sender, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ return sender.hasPermission(permission);
}
@Override
public boolean has(Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ return player.hasPermission(permission);
}
@Override
public boolean playerHas(String world, OfflinePlayer player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerHas(Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAdd(String world, OfflinePlayer player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAdd(Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAddTransient(OfflinePlayer player, String permission) throws UnsupportedOperationException
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAddTransient(Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAddTransient(String worldName, Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemoveTransient(String worldName, Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemove(String world, OfflinePlayer player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemove(World world, String player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemove(Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemoveTransient(OfflinePlayer player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemoveTransient(Player player, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean groupHas(World world, String group, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean groupAdd(World world, String group, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean groupRemove(World world, String group, String permission)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerInGroup(String world, OfflinePlayer player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerInGroup(Player player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAddGroup(String world, OfflinePlayer player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerAddGroup(Player player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemoveGroup(String world, OfflinePlayer player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public boolean playerRemoveGroup(Player player, String group)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String[] getPlayerGroups(String world, OfflinePlayer player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String[] getPlayerGroups(Player player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getPrimaryGroup(String world, OfflinePlayer player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
@Override
public String getPrimaryGroup(Player player)
{
- throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
+ throw new UnsupportedOperationException("This method is unsupported by rscPermissions.");
}
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/BukkitPluginMain.java b/src/main/java/ru/simsonic/rscPermissions/BukkitPluginMain.java
index 938e909..960db26 100644
--- a/src/main/java/ru/simsonic/rscPermissions/BukkitPluginMain.java
+++ b/src/main/java/ru/simsonic/rscPermissions/BukkitPluginMain.java
@@ -19,16 +19,17 @@ import ru.simsonic.rscPermissions.Bukkit.BukkitRegionProviders;
import ru.simsonic.rscPermissions.Bukkit.Commands.BukkitCommands;
import ru.simsonic.rscPermissions.Bukkit.RegionUpdateObserver;
import ru.simsonic.rscPermissions.Engine.InternalCache;
+import ru.simsonic.rscPermissions.Engine.Phrases;
import ru.simsonic.rscUtilityLibrary.CommandProcessing.CommandAnswerException;
import ru.simsonic.rscUtilityLibrary.TextProcessing.GenericChatCodes;
public final class BukkitPluginMain extends JavaPlugin
{
public static final Logger consoleLog = Bukkit.getLogger();
- public final Settings settings = new BukkitPluginConfiguration(this);
+ public final BukkitPluginConfiguration settings = new BukkitPluginConfiguration(this);
public final BridgeForBukkitAPI bridgeForBukkit = new BridgeForBukkitAPI(this);
public final BukkitEventListener bukkitListener = new BukkitEventListener(this);
- public final BackendJson fileCache = new BackendJson(getDataFolder());
+ public final BackendJson localStorage = new BackendJson(getDataFolder());
public final BackendDatabase connection = new BackendDatabase(consoleLog);
public final InternalCache internalCache = new InternalCache();
public final BukkitPermissionManager permissionManager = new BukkitPermissionManager(this);
@@ -46,12 +47,14 @@ public final class BukkitPluginMain extends JavaPlugin
@Override
public void onEnable()
{
- Phrases.extractAll(this);
+ Phrases.extractAll(getDataFolder());
settings.readSettings();
- internalCache.setDefaultGroup(settings.getDefaultGroup());
- Phrases.fill(this, settings.getLanguage());
+ internalCache.setDefaultGroup(
+ settings.getDefaultGroup(),
+ settings.isDefaultForever());
+ Phrases.translate(settings.getTranslationProvider());
// Restore temporary cached data from json files
- final DatabaseContents contents = fileCache.retrieveContents();
+ final DatabaseContents contents = localStorage.retrieveContents();
contents.filterServerId(getServer().getServerId()).filterLifetime();
internalCache.fill(contents);
consoleLog.log(Level.INFO,
@@ -87,7 +90,7 @@ public final class BukkitPluginMain extends JavaPlugin
connection.initialize(settings.getConnectionParams());
commandHelper.threadFetchDatabaseContents.startDeamon();
// Done
- consoleLog.info("[rscp] rscPermissions has been successfully enabled.");
+ consoleLog.info(Phrases.PLUGIN_ENABLED.toString());
}
@Override
public void onDisable()
@@ -99,7 +102,7 @@ public final class BukkitPluginMain extends JavaPlugin
connection.disconnect();
regionListProvider.deintegrate();
metrics = null;
- consoleLog.info("[rscp] rscPermissions has been disabled.");
+ consoleLog.info(Phrases.PLUGIN_DISABLED.toString());
}
private int nAutoUpdaterTaskId = -1;
public void scheduleAutoUpdate()
@@ -131,11 +134,4 @@ public final class BukkitPluginMain extends JavaPlugin
}
return true;
}
- public void formattedMessage(CommandSender sender, String message)
- {
- if(message == null || "".equals(message))
- return;
- message = GenericChatCodes.processStringStatic(Settings.chatPrefix + message);
- sender.sendMessage(message);
- }
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/Engine/InternalCache.java b/src/main/java/ru/simsonic/rscPermissions/Engine/InternalCache.java
index bd1365b..139f0fd 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Engine/InternalCache.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Engine/InternalCache.java
@@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map.Entry;
import ru.simsonic.rscPermissions.API.EntityType;
@@ -19,10 +20,12 @@ public class InternalCache
private final HashMap entities_g = new HashMap<>();
private final HashMap entities_u = new HashMap<>();
private final RowInheritance defaultInheritance = new RowInheritance();
- public void setDefaultGroup(String defaultGroup)
+ private boolean alwaysInheritDefaultGroup = false;
+ public void setDefaultGroup(String defaultGroup, boolean alwaysInheritDefaultGroup)
{
defaultInheritance.parent = defaultGroup;
defaultInheritance.deriveInstance();
+ this.alwaysInheritDefaultGroup = alwaysInheritDefaultGroup;
}
public synchronized void fill(DatabaseContents contents)
{
@@ -57,6 +60,7 @@ public class InternalCache
else
names_u.add(row.entity);
}
+ names_g.add(defaultInheritance.parent);
for(String name : names_g)
{
final String groupInternalName = name.toLowerCase();
@@ -144,6 +148,8 @@ public class InternalCache
Collections.sort(inheritances);
entry.getValue().inheritance = inheritances.toArray(new RowInheritance[inheritances.size()]);
}
+ defaultInheritance.childType = EntityType.player;
+ defaultInheritance.entityParent = entities_g.get(defaultInheritance.parent.toLowerCase());
}
public synchronized ResolutionResult resolvePlayer(String player)
{
@@ -160,9 +166,10 @@ public class InternalCache
{
final ArrayList applicablePermissions = new ArrayList<>();
final ArrayList applicableInheritance = new ArrayList<>();
- params.groupList = new HashSet<>();
+ params.groupList = new LinkedHashSet<>();
params.finalPerms = new HashMap<>();
params.instantiator = "";
+ params.depth = 0;
for(RowEntity row : entities_u.values())
for(String identifier : params.applicableIdentifiers)
if(row.playerType.isEntityApplicable(row.entity, identifier))
@@ -175,6 +182,9 @@ public class InternalCache
}
final ArrayList intermediateResults = new ArrayList<>();
Collections.sort(applicableInheritance);
+ // Mix into default inheritance
+ if(applicableInheritance.isEmpty() || alwaysInheritDefaultGroup)
+ applicableInheritance.add(0, defaultInheritance);
for(RowInheritance row : applicableInheritance)
{
params.instantiator = "";
@@ -191,8 +201,8 @@ public class InternalCache
{
final RowEntity currentParent = params.parentEntity;
final String instantiator = params.instantiator;
- params.groupList.add(currentParent.entity + ("".equals(instantiator) ? "" : Settings.separator + instantiator));
final ArrayList intermediateResults = new ArrayList<>();
+ params.depth += 1;
for(RowInheritance row : params.parentEntity.inheritance)
if(isInheritanceApplicable(params, row))
{
@@ -202,6 +212,11 @@ public class InternalCache
: instantiator;
intermediateResults.add(resolveParent(params));
}
+ params.depth -= 1;
+ params.groupList.add(
+ new String(new char[params.depth]).replace('\0', '*')
+ + currentParent.entity
+ + ("".equals(instantiator) ? "" : Settings.separator + instantiator));
// Prefixes and suffixes
params.parentEntity = currentParent;
params.instantiator = instantiator;
diff --git a/src/main/java/ru/simsonic/rscPermissions/Engine/Matchers.java b/src/main/java/ru/simsonic/rscPermissions/Engine/Matchers.java
index ad069ed..fefefae 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Engine/Matchers.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Engine/Matchers.java
@@ -11,11 +11,11 @@ public class Matchers
return multiobject.split(genericSplitter);
}
private static final Pattern patternUUID = Pattern.compile(
- "" + "(?:[a-f\\d]{8}(?:-[a-f\\d]{4}){3}-[a-f\\d]{12})" + "");
+ "(?:[a-f\\d]{8}(?:-[a-f\\d]{4}){3}-[a-f\\d]{12})");
private static boolean isCorrectUUID(String entityName)
{
if(entityName == null)
return false;
- return patternUUID.matcher("" + entityName.toLowerCase() + "").find();
+ return patternUUID.matcher(entityName).find();
}
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/Phrases.java b/src/main/java/ru/simsonic/rscPermissions/Engine/Phrases.java
similarity index 53%
rename from src/main/java/ru/simsonic/rscPermissions/Phrases.java
rename to src/main/java/ru/simsonic/rscPermissions/Engine/Phrases.java
index 87d09a2..75a0ef5 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Phrases.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Engine/Phrases.java
@@ -1,13 +1,12 @@
-package ru.simsonic.rscPermissions;
+package ru.simsonic.rscPermissions.Engine;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
-import java.util.logging.Level;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.Plugin;
+import ru.simsonic.rscPermissions.API.TranslationProvider;
+import ru.simsonic.rscPermissions.BukkitPluginMain;
public enum Phrases
{
@@ -28,23 +27,21 @@ public enum Phrases
{
return phrase;
}
- public static void fill(Plugin plugin, String langName)
+ public static void translate(TranslationProvider provider)
{
- final File langFile = new File(plugin.getDataFolder(), langName + ".yml");
- final YamlConfiguration langConfig = YamlConfiguration.loadConfiguration(langFile);
for(Phrases value : Phrases.values())
- value.phrase = langConfig.getString(value.node, value.node);
+ value.phrase = provider.getString(value.node);
}
- public static void extractAll(Plugin plugin)
+ public static void extractAll(File workingDir)
{
- extract(plugin, "english");
- extract(plugin, "russian");
+ extract(workingDir, "english");
+ extract(workingDir, "russian");
}
- public static void extract(Plugin plugin, String langName)
+ public static void extract(File workingDir, String langName)
{
try
{
- final File langFile = new File(plugin.getDataFolder(), langName + ".yml");
+ final File langFile = new File(workingDir, langName + ".yml");
if(!langFile.isFile())
{
final FileChannel fileChannel = new FileOutputStream(langFile).getChannel();
@@ -52,7 +49,6 @@ public enum Phrases
fileChannel.transferFrom(Channels.newChannel(langStream), 0, Long.MAX_VALUE);
}
} catch(IOException ex) {
- BukkitPluginMain.consoleLog.log(Level.WARNING, "Cannot extract language: {0}\n{1}", new Object[] { langName, ex });
}
}
}
diff --git a/src/main/java/ru/simsonic/rscPermissions/Engine/ResolutionParams.java b/src/main/java/ru/simsonic/rscPermissions/Engine/ResolutionParams.java
index 1773ea4..e629e0b 100644
--- a/src/main/java/ru/simsonic/rscPermissions/Engine/ResolutionParams.java
+++ b/src/main/java/ru/simsonic/rscPermissions/Engine/ResolutionParams.java
@@ -9,6 +9,7 @@ public class ResolutionParams
public String[] destRegions;
public String destWorld;
public int expirience;
+ protected transient int depth;
protected transient RowEntity parentEntity;
protected transient String instantiator;
protected transient Map finalPerms;
diff --git a/src/main/java/ru/simsonic/rscPermissions/IndependentMain.java b/src/main/java/ru/simsonic/rscPermissions/IndependentMain.java
index 411e7d1..601c65f 100644
--- a/src/main/java/ru/simsonic/rscPermissions/IndependentMain.java
+++ b/src/main/java/ru/simsonic/rscPermissions/IndependentMain.java
@@ -1,5 +1,8 @@
package ru.simsonic.rscPermissions;
import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.logging.Logger;
import ru.simsonic.rscPermissions.Backends.BackendDatabase;
@@ -41,14 +44,18 @@ public class IndependentMain
System.out.println("Permission database is empty, stopping.");
return;
}
+ intCache.setDefaultGroup("Moderators", true);
intCache.fill(contents);
final ResolutionResult result = intCache.resolvePlayer("rscpTester");
- for(Map.Entry perm : result.permissions.entrySet())
- System.out.println(perm.getKey() + " = " + perm.getValue());
- if(result.prefix != null)
- System.out.println("Prefix = " + result.prefix);
- if(result.suffix != null)
- System.out.println("Suffix = " + result.suffix);
+ // Sorted output
+ ArrayList perms = new ArrayList<>(result.permissions.keySet());
+ Collections.sort(perms);
+ for(String key : perms)
+ System.out.println("Permission: " + key + " = " + result.permissions.get(key));
+ for(String group : result.groups)
+ System.out.println("Parent: " + group);
+ System.out.println("Prefix: " + result.prefix);
+ System.out.println("Suffix: " + result.suffix);
System.out.println("Done.");
}
}
diff --git a/src/main/resources/languages/english.yml b/src/main/resources/languages/english.yml
index bbdebf3..4fd0840 100644
--- a/src/main/resources/languages/english.yml
+++ b/src/main/resources/languages/english.yml
@@ -1,7 +1,7 @@
generic:
- enabled: ""
- disabled: ""
- reloaded: ""
+ enabled: "[rscp] rscPermissions has been successfully enabled."
+ disabled: "[rscp] rscPermissions has been disabled."
+ reloaded: "[rscp] rscPermissions has been reloaded."
metrics: "[rscp] Metrics enabled."
mysql:
- fetched: ""
+ fetched: "[rscp] "
diff --git a/src/main/resources/languages/russian.yml b/src/main/resources/languages/russian.yml
index 0fd10bb..ef3b0e4 100644
--- a/src/main/resources/languages/russian.yml
+++ b/src/main/resources/languages/russian.yml
@@ -1,7 +1,7 @@
generic:
- enabled: ""
- disabled: ""
- reloaded: ""
+ enabled: "[rscp] Плагин успешно включён."
+ disabled: "[rscp] Плагин выключен."
+ reloaded: "[rscp] Плагин перезапущен."
metrics: "[rscp] Включён сбор метрики (mcstats.org)."
mysql:
- fetched: ""
+ fetched: "[rscp] "