Browse Source

Little work on new API.

master
Stanislav 11 years ago
parent
commit
9d8b0e05b1
  1. 28
      src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java
  2. 152
      src/main/java/ru/simsonic/rscPermissions/Frontends/VaultChat.java
  3. 144
      src/main/java/ru/simsonic/rscPermissions/Frontends/VaultPermission.java
  4. 4
      src/main/java/ru/simsonic/rscPermissions/InternalCache/BrandNewCache.java
  5. 2
      src/main/java/ru/simsonic/rscPermissions/InternalCache/LocalCacheTree.java
  6. 18
      src/main/java/ru/simsonic/rscPermissions/MainPluginClass.java
  7. 4
      src/main/java/ru/simsonic/rscPermissions/RegionListProviders.java
  8. 11
      src/main/resources/plugin.yml

28
src/main/java/ru/simsonic/rscPermissions/BridgeForBukkitAPI.java

@ -0,0 +1,28 @@
package ru.simsonic.rscPermissions;
import ru.simsonic.rscPermissions.Frontends.VaultChat;
import ru.simsonic.rscPermissions.Frontends.VaultPermission;
public class BridgeForBukkitAPI
{
private final MainPluginClass rscp;
private final VaultPermission vaultPermission;
private final VaultChat vaultChat;
protected BridgeForBukkitAPI(MainPluginClass plugin)
{
this.rscp = plugin;
this.vaultPermission = new VaultPermission(this);
this.vaultChat = new VaultChat(this, vaultPermission);
}
public org.bukkit.plugin.java.JavaPlugin getPlugin()
{
return this.rscp;
}
public net.milkbowl.vault.permission.Permission getPermission()
{
return this.vaultPermission;
}
public net.milkbowl.vault.chat.Chat getChat()
{
return this.vaultChat;
}
}

152
src/main/java/ru/simsonic/rscPermissions/Frontends/VaultChat.java

@ -3,365 +3,359 @@ import net.milkbowl.vault.permission.Permission;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.entity.Player;
import ru.simsonic.rscPermissions.MainPluginClass;
import ru.simsonic.rscPermissions.BridgeForBukkitAPI;
public final class VaultChat extends net.milkbowl.vault.chat.Chat
{
private final MainPluginClass rscp;
public VaultChat(MainPluginClass plugin, Permission perms)
private final BridgeForBukkitAPI bridge;
public VaultChat(BridgeForBukkitAPI bridge, Permission perms)
{
super(perms);
this.rscp = plugin;
this.bridge = bridge;
}
@Override
public String getName()
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean isEnabled()
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerPrefix(String world, String player)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerPrefix(String world, String player, String prefix)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerSuffix(String world, String player)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerSuffix(String world, String player, String suffix)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getGroupPrefix(String world, String group)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupPrefix(String world, String group, String prefix)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getGroupSuffix(String world, String group)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupSuffix(String world, String group, String suffix)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoInteger(String world, String player, String node, int value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public int getGroupInfoInteger(String world, String group, String node, int defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoInteger(String world, String group, String node, int value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoDouble(String world, String player, String node, double value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public double getGroupInfoDouble(String world, String group, String node, double defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoDouble(String world, String group, String node, double value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoBoolean(String world, String player, String node, boolean value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoBoolean(String world, String group, String node, boolean value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerInfoString(String world, String player, String node, String defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoString(String world, String player, String node, String value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getGroupInfoString(String world, String group, String node, String defaultValue)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoString(String world, String group, String node, String value)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerPrefix(String world, OfflinePlayer player)
{
return getPlayerPrefix(world, player.getName());
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerPrefix(Player player)
{
return getPlayerPrefix(player.getWorld().getName(), player);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerPrefix(String world, OfflinePlayer player, String prefix)
{
setPlayerPrefix(world, player.getName(), prefix);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerPrefix(Player player, String prefix)
{
setPlayerPrefix(player.getWorld().getName(), player, prefix);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerSuffix(String world, OfflinePlayer player)
{
return getPlayerSuffix(world, player.getName());
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerSuffix(Player player)
{
return getPlayerSuffix(player.getWorld().getName(), player);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerSuffix(String world, OfflinePlayer player, String suffix)
{
setPlayerSuffix(world, player.getName(), suffix);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerSuffix(Player player, String suffix)
{
setPlayerSuffix(player.getWorld().getName(), player, suffix);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getGroupPrefix(World world, String group)
{
return getGroupPrefix(world.getName(), group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupPrefix(World world, String group, String prefix)
{
setGroupPrefix(world.getName(), group, prefix);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getGroupSuffix(World world, String group)
{
return getGroupSuffix(world.getName(), group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupSuffix(World world, String group, String suffix)
{
setGroupSuffix(world.getName(), group, suffix);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue)
{
return getPlayerInfoInteger(world, player.getName(), node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public int getPlayerInfoInteger(Player player, String node, int defaultValue)
{
return getPlayerInfoInteger(player.getWorld().getName(), player, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value)
{
setPlayerInfoInteger(world, player.getName(), node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoInteger(Player player, String node, int value)
{
setPlayerInfoInteger(player.getWorld().getName(), player, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public int getGroupInfoInteger(World world, String group, String node, int defaultValue)
{
return getGroupInfoInteger(world.getName(), group, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoInteger(World world, String group, String node, int value)
{
setGroupInfoInteger(world.getName(), group, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue)
{
return getPlayerInfoDouble(world, player.getName(), node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public double getPlayerInfoDouble(Player player, String node, double defaultValue)
{
return getPlayerInfoDouble(player.getWorld().getName(), player, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value)
{
setPlayerInfoDouble(world, player.getName(), node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoDouble(Player player, String node, double value)
{
setPlayerInfoDouble(player.getWorld().getName(), player, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public double getGroupInfoDouble(World world, String group, String node, double defaultValue)
{
return getGroupInfoDouble(world.getName(), group, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoDouble(World world, String group, String node, double value)
{
setGroupInfoDouble(world.getName(), group, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue)
{
return getPlayerInfoBoolean(world, player.getName(), node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue)
{
return getPlayerInfoBoolean(player.getWorld().getName(), player, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value)
{
setPlayerInfoBoolean(world, player.getName(), node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoBoolean(Player player, String node, boolean value)
{
setPlayerInfoBoolean(player.getWorld().getName(), player, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue)
{
return getGroupInfoBoolean(world.getName(), group, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoBoolean(World world, String group, String node, boolean value)
{
setGroupInfoBoolean(world.getName(), group, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue)
{
return getPlayerInfoString(world, player.getName(), node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPlayerInfoString(Player player, String node, String defaultValue)
{
return getPlayerInfoString(player.getWorld().getName(), player, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value)
{
setPlayerInfoString(world, player.getName(), node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setPlayerInfoString(Player player, String node, String value)
{
setPlayerInfoString(player.getWorld().getName(), player, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getGroupInfoString(World world, String group, String node, String defaultValue)
{
return getGroupInfoString(world.getName(), group, node, defaultValue);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public void setGroupInfoString(World world, String group, String node, String value)
{
setGroupInfoString(world.getName(), group, node, value);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerInGroup(String world, OfflinePlayer player, String group)
{
// return perms.playerInGroup(world, player, group);
return false;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerInGroup(Player player, String group)
{
// return playerInGroup(player.getWorld().getName(), player, group);
return false;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String[] getPlayerGroups(String world, OfflinePlayer player)
{
// return perms.getPlayerGroups(world, player);
return null;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String[] getPlayerGroups(Player player)
{
// return getPlayerGroups(player.getWorld().getName(), player);
return null;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPrimaryGroup(String world, OfflinePlayer player)
{
// return perms.getPrimaryGroup(world, player);
return "";
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPrimaryGroup(Player player)
{
return getPrimaryGroup(player.getWorld().getName(), player);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String[] getGroups()
{
// return perms.getGroups();
return null;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
}

144
src/main/java/ru/simsonic/rscPermissions/Frontends/VaultPermission.java

@ -3,287 +3,243 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import ru.simsonic.rscPermissions.MainPluginClass;
import ru.simsonic.rscPermissions.BridgeForBukkitAPI;
public class VaultPermission extends net.milkbowl.vault.permission.Permission
{
private final MainPluginClass rscp;
public VaultPermission(MainPluginClass plugin)
private final BridgeForBukkitAPI bridge;
public VaultPermission(BridgeForBukkitAPI bridge)
{
this.rscp = plugin;
this.bridge = bridge;
}
@Override
public String getName()
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean isEnabled()
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean hasSuperPermsCompat()
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerHas(String world, String player, String permission)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAdd(String world, String player, String permission)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemove(String world, String player, String permission)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean groupHas(String world, String group, String permission)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean groupAdd(String world, String group, String permission)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean groupRemove(String world, String group, String permission)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerInGroup(String world, String player, String group)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAddGroup(String world, String player, String group)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemoveGroup(String world, String player, String group)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String[] getPlayerGroups(String world, String player)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPrimaryGroup(String world, String player)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String[] getGroups()
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean hasGroupSupport()
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean has(CommandSender sender, String permission)
{
return sender.hasPermission(permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean has(Player player, String permission)
{
return player.hasPermission(permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerHas(String world, OfflinePlayer player, String permission)
{
if(world == null)
return has((String)null, player.getName(), permission);
return has(world, player.getName(), permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerHas(Player player, String permission)
{
return has(player, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAdd(String world, OfflinePlayer player, String permission)
{
if(world == null)
return playerAdd((String)null, player.getName(), permission);
return playerAdd(world, player.getName(), permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAdd(Player player, String permission)
{
return playerAdd(player.getWorld().getName(), player, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAddTransient(OfflinePlayer player, String permission) throws UnsupportedOperationException
{
if(player.isOnline())
return playerAddTransient((Player)player, permission);
throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!");
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAddTransient(Player player, String permission)
{
for(PermissionAttachmentInfo paInfo : player.getEffectivePermissions())
if(paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin))
{
paInfo.getAttachment().setPermission(permission, true);
return true;
}
PermissionAttachment attach = player.addAttachment(plugin);
attach.setPermission(permission, true);
return true;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission)
{
return playerAddTransient(worldName, player.getName(), permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAddTransient(String worldName, Player player, String permission)
{
return playerAddTransient(player, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission)
{
return playerRemoveTransient(worldName, player.getName(), permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemoveTransient(String worldName, Player player, String permission)
{
return playerRemoveTransient(worldName, (OfflinePlayer)player, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemove(String world, OfflinePlayer player, String permission)
{
if(world == null)
return playerRemove((String)null, player.getName(), permission);
return playerRemove(world, player.getName(), permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Deprecated
@Override
public boolean playerRemove(World world, String player, String permission)
{
if(world == null)
return playerRemove((String)null, player, permission);
return playerRemove(world.getName(), player, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemove(Player player, String permission)
{
return playerRemove(player.getWorld().getName(), player, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemoveTransient(OfflinePlayer player, String permission)
{
if(player.isOnline())
return playerRemoveTransient((Player)player, permission);
else
return false;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemoveTransient(Player player, String permission)
{
for(PermissionAttachmentInfo paInfo : player.getEffectivePermissions())
if(paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin))
{
paInfo.getAttachment().unsetPermission(permission);
return true;
}
return false;
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean groupHas(World world, String group, String permission)
{
if(world == null)
return groupHas((String)null, group, permission);
return groupHas(world.getName(), group, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean groupAdd(World world, String group, String permission)
{
if(world == null)
return groupAdd((String)null, group, permission);
return groupAdd(world.getName(), group, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean groupRemove(World world, String group, String permission)
{
if(world == null)
return groupRemove((String)null, group, permission);
return groupRemove(world.getName(), group, permission);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerInGroup(String world, OfflinePlayer player, String group)
{
if(world == null)
return playerInGroup((String)null, player.getName(), group);
return playerInGroup(world, player.getName(), group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerInGroup(Player player, String group)
{
return playerInGroup(player.getWorld().getName(), player, group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAddGroup(String world, OfflinePlayer player, String group)
{
if(world == null)
return playerAddGroup((String)null, player.getName(), group);
return playerAddGroup(world, player.getName(), group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerAddGroup(Player player, String group)
{
return playerAddGroup(player.getWorld().getName(), player, group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemoveGroup(String world, OfflinePlayer player, String group)
{
if(world == null)
return playerRemoveGroup((String)null, player.getName(), group);
return playerRemoveGroup(world, player.getName(), group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public boolean playerRemoveGroup(Player player, String group)
{
return playerRemoveGroup(player.getWorld().getName(), player, group);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String[] getPlayerGroups(String world, OfflinePlayer player)
{
return getPlayerGroups(world, player.getName());
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String[] getPlayerGroups(Player player)
{
return getPlayerGroups(player.getWorld().getName(), player);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPrimaryGroup(String world, OfflinePlayer player)
{
return getPrimaryGroup(world, player.getName());
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
@Override
public String getPrimaryGroup(Player player)
{
return getPrimaryGroup(player.getWorld().getName(), player);
throw new UnsupportedOperationException("This method is still unsupported. Sorry.");
}
}

4
src/main/java/ru/simsonic/rscPermissions/InternalCache/BrandNewCache.java

@ -17,7 +17,7 @@ import ru.simsonic.rscPermissions.Settings;
public class BrandNewCache implements AbstractPermissionsCache
{
protected final MainPluginClass plugin;
protected BrandNewCache(MainPluginClass rscp)
public BrandNewCache(MainPluginClass rscp)
{
this.plugin = rscp;
}
@ -109,7 +109,7 @@ public class BrandNewCache implements AbstractPermissionsCache
params.applicableIdentifiers = getPlayerIdentifiers(player);
if(plugin.regionListProvider != null)
{
Set<String> regionSet = plugin.regionListProvider.GetRegionList(player);
Set<String> regionSet = plugin.regionListProvider.getPlayerRegions(player);
params.destRegions = regionSet.toArray(new String[regionSet.size()]);
} else
params.destRegions = new String[] {};

2
src/main/java/ru/simsonic/rscPermissions/InternalCache/LocalCacheTree.java

@ -80,7 +80,7 @@ public class LocalCacheTree extends LocalCacheData
}
public void calculatePlayerPermissions(Player player)
{
final AsyncPlayerInfo api = new AsyncPlayerInfo(player, plugin.regionListProvider.GetRegionList(player));
final AsyncPlayerInfo api = new AsyncPlayerInfo(player, plugin.regionListProvider.getPlayerRegions(player));
plugin.recalculatingPlayers.offer(api);
}
public synchronized HashMap<String, Boolean> treeToPermissions(AsyncPlayerInfo p2rc)

18
src/main/java/ru/simsonic/rscPermissions/MainPluginClass.java

@ -9,12 +9,10 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerExpChangeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLevelChangeEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -22,21 +20,18 @@ import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
import org.mcstats.MetricsLite;
import ru.simsonic.rscPermissions.Frontends.VaultChat;
import ru.simsonic.rscPermissions.Frontends.VaultPermission;
import ru.simsonic.rscPermissions.InternalCache.BrandNewCache;
import ru.simsonic.utilities.CommandAnswerException;
import ru.simsonic.utilities.LanguageUtility;
import ru.simsonic.utilities.MovingPlayersCatcher;
public final class MainPluginClass extends JavaPlugin implements Listener
{
private static final int projectNumberInDBO = 55450;
private static final String chatPrefix = "{_YL}[rscp] {GOLD}";
public static final Logger consoleLog = Logger.getLogger("Minecraft");
public final rscpAPI API = new rscpAPI(this);
public final Settings settings = new Settings(this);
public final LocalCacheFunctions cache = new LocalCacheFunctions(this);
public final CommandHelper commandExecutor = new CommandHelper(this);
public final CommandHelper commandHelper = new CommandHelper(this);
public final MaintenanceMode maintenance = new MaintenanceMode(this);
public final RegionListProviders regionListProvider = new RegionListProviders(this);
private final MovingPlayersCatcher movedPlayers = new MovingPlayersCatcher();
@ -46,8 +41,9 @@ public final class MainPluginClass extends JavaPlugin implements Listener
public final HashMap<Player, PermissionAttachment> attachments = new HashMap<>();
public final LinkedBlockingQueue<AsyncPlayerInfo> recalculatingPlayers = new LinkedBlockingQueue<>();
// private final HashSet<String> verbosePlayers = new HashSet<>();
private final VaultPermission vaultP = new VaultPermission(this);
private final VaultChat vaultC = new VaultChat(this, vaultP);
public final rscpAPI API = new rscpAPI(this);
private final BrandNewCache newCache = new BrandNewCache(this);
private final BridgeForBukkitAPI api = new BridgeForBukkitAPI(this);
@Override
public void onLoad()
{
@ -124,7 +120,7 @@ public final class MainPluginClass extends JavaPlugin implements Listener
{
for(; !Thread.interrupted(); Thread.sleep(granularity))
for(Player player : movedPlayers.getMovedPlayersAsync())
if(regionListProvider.IsRegionListChanged(player))
if(regionListProvider.isRegionListChanged(player))
cache.calculatePlayerPermissions(player);
} catch(InterruptedException ex) {
}
@ -232,7 +228,7 @@ public final class MainPluginClass extends JavaPlugin implements Listener
{
try
{
commandExecutor.onCommand(sender, cmd, label, args);
commandHelper.onCommand(sender, cmd, label, args);
} catch(CommandAnswerException ex) {
for(String answer : ex.getMessageArray())
sender.sendMessage(LanguageUtility.processStringStatic(chatPrefix + answer));

4
src/main/java/ru/simsonic/rscPermissions/RegionListProviders.java

@ -65,7 +65,7 @@ public final class RegionListProviders
this.worldguard = null;
this.residence = null;
}
public synchronized boolean IsRegionListChanged(Player player)
public synchronized boolean isRegionListChanged(Player player)
{
final Location location = player.getLocation();
final World world = location.getWorld();
@ -110,7 +110,7 @@ public final class RegionListProviders
playerLastWorld.put(player, world);
return true;
}
public synchronized Set<String> GetRegionList(Player player)
public synchronized Set<String> getPlayerRegions(Player player)
{
Set<String> result = regionsByPlayer.get(player);
return (result != null) ? result : Collections.<String>emptySet();

11
src/main/resources/plugin.yml

@ -1,9 +1,9 @@
name: ${project.artifactId}
main: ${project.groupId}.${project.artifactId}.MainPluginClass
version: ${project.version}
main: ${project.groupId}.${project.artifactId}.MainPluginClass
author: SimSonic
website: http://dev.bukkit.org/server-mods/rscPermissions
soft-depend:
softdepend:
- Vault
- WorldEdit
- WorldGuard
@ -15,9 +15,6 @@ commands:
description: Promotes player on ladder
demote:
description: Demotes player on ladder
reward:
description: Shows available rewards for you and allows to use one of them
usage: /<command> [reward-code]
permissions:
rscp.*:
description: Gives access to all commands
@ -32,7 +29,6 @@ permissions:
rscp.admin.lock: true
rscp.admin.reload: true
rscp.maintenance.*: true
rscp.userewards: true
rscp.admin.promote:
description: Allows to promote/demote users on ladders
default: op
@ -45,6 +41,3 @@ permissions:
rscp.maintenance.*:
description: Allows to connect when server in any maintenance mode
default: op
rscp.userewards:
description: Allows to view and use available rewards
default: op
Loading…
Cancel
Save