added methods for P2/P3/GM/PEX to the Chat API

This commit is contained in:
Sleaker 2011-10-23 00:04:29 -07:00
parent 23df8b181f
commit 510386404b
14 changed files with 955 additions and 1461 deletions

Binary file not shown.

BIN
lib/Permissions2.jar Normal file

Binary file not shown.

View File

@ -1,5 +1,217 @@
package net.milkbowl.vault.chat.plugins;
public class Chat_GroupManager {
import java.util.logging.Logger;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import net.milkbowl.vault.chat.Chat;
@SuppressWarnings("deprecation")
public class Chat_GroupManager extends Chat {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "GroupManager";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private GroupManager groupManager;
private AnjoPermissionsHandler perms;
private PermissionServerListener permissionServerListener = null;
public Chat_GroupManager(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
// Load Plugin in case it was loaded before
if (groupManager == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
if (perms != null) {
if (perms.isEnabled()) {
groupManager = (GroupManager) perms;
this.perms = groupManager.getPermissionHandler();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
}
private class PermissionServerListener extends ServerListener {
Chat_GroupManager chat = null;
public PermissionServerListener(Chat_GroupManager chat) {
this.chat = chat;
}
public void onPluginEnable(PluginEnableEvent event) {
if (chat.groupManager == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
if (perms != null) {
if (perms.isEnabled()) {
chat.groupManager = (GroupManager) perms;
chat.perms = groupManager.getPermissionHandler();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), chat.name));
}
}
}
}
public void onPluginDisable(PluginDisableEvent event) {
if (chat.groupManager != null) {
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
chat.groupManager = null;
chat.perms = null;
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), chat.name));
}
}
}
}
@Override
public String getName() {
return this.name;
}
@Override
public boolean isEnabled() {
if (groupManager == null) {
return false;
} else {
return groupManager.isEnabled();
}
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
return perms.getPermissionInteger(playerName, node);
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
return perms.getGroupPermissionInteger(groupName, node);
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
return perms.getPermissionDouble(playerName, node);
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
return perms.getGroupPermissionDouble(groupName, node);
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
return perms.getPermissionBoolean(playerName, node);
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
return perms.getGroupPermissionBoolean(groupName, node);
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
return perms.getPermissionString(playerName, node);
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
return perms.getGroupPermissionString(groupName, node);
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getPlayerPrefix(String world, String playerName) {
return perms.getGroupPrefix(getPrimaryGroup(world, playerName));
}
@Override
public String getPlayerSuffix(String world, String playerName) {
return perms.getGroupSuffix(getPrimaryGroup(world, playerName));
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupPrefix(String world, String group) {
return perms.getGroupPrefix(group);
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupSuffix(String world, String group) {
return perms.getGroupSuffix(group);
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
public String getPrimaryGroup(String world, String playerName) {
return perms.getGroup(playerName);
}
}

View File

@ -1,5 +1,228 @@
package net.milkbowl.vault.chat.plugins;
public class Chat_Permissions2 {
import java.util.logging.Logger;
import net.milkbowl.vault.chat.Chat;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.nijiko.permissions.Control;
import com.nijikokun.bukkit.Permissions.Permissions;
public class Chat_Permissions2 extends Chat {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "Permissions 2 (Phoenix)";
private Control perms;
private Plugin plugin = null;
private PluginManager pluginManager = null;
private Permissions chat = null;
private PermissionServerListener permissionServerListener = null;
public Chat_Permissions2(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
// Load Plugin in case it was loaded before
if (chat == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions");
if (perms != null) {
if (perms.isEnabled() && perms.getDescription().getVersion().startsWith("2")) {
chat = (Permissions) perms;
this.perms = (Control) chat.getHandler();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
}
private class PermissionServerListener extends ServerListener {
Chat_Permissions2 permission = null;
public PermissionServerListener(Chat_Permissions2 permission) {
this.permission = permission;
}
public void onPluginEnable(PluginEnableEvent event) {
if (permission.chat == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions");
if (perms != null) {
if (perms.isEnabled()) {
permission.chat = (Permissions) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), permission.name));
}
}
}
}
public void onPluginDisable(PluginDisableEvent event) {
if (permission.chat != null) {
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
permission.chat = null;
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
}
}
}
}
@Override
public String getName() {
return name;
}
@Override
public boolean isEnabled() {
if (chat == null) {
return false;
} else {
return chat.isEnabled();
}
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
int i = this.perms.getPermissionInteger(world, playerName, node);
return (i == -1) ? defaultValue : i;
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
setPlayerInfo(world, playerName, node, value);
}
private void setPlayerInfo(String world, String playerName, String node, Object value) {
this.perms.addUserInfo(world, playerName, node, value);
}
public void setGroupInfo(String world, String groupName, String node, Object value) {
this.perms.addGroupInfo(world, groupName, node, value);
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
int i = this.perms.getGroupPermissionInteger(world, groupName, node);
return (i == -1) ? defaultValue : i;
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
double d = this.perms.getPermissionDouble(world, playerName, node);
return (d == -1) ? defaultValue : d;
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
double d = this.perms.getGroupPermissionDouble(world, groupName, node);
return (d == -1) ? defaultValue : d;
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
// Warning does not support default value
return this.perms.getPermissionBoolean(world, playerName, node);
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
return this.perms.getGroupPermissionBoolean(world, groupName, node);
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
String s = this.perms.getPermissionString(world, playerName, node);
return (s == "" || s == null) ? defaultValue : s;
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
String s = this.perms.getGroupPermissionString(world, groupName, node);
return (s == "" || s == null) ? defaultValue : s;
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public String getPlayerPrefix(String world, String playerName) {
return this.perms.getPermissionString(world, playerName, "prefix");
}
@Override
public String getPlayerSuffix(String world, String playerName) {
return this.perms.getPermissionString(world, playerName, "suffix");
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
setPlayerInfo(world, player, "suffix", suffix);
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
setPlayerInfo(world, player, "prefix", prefix);
}
@Override
public String getGroupPrefix(String world, String group) {
return perms.getGroupPrefix(world, group);
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
setGroupInfo(world, group, "prefix", prefix);
}
@Override
public String getGroupSuffix(String world, String group) {
return perms.getGroupSuffix(world, group);
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
setGroupInfo(world, group, "suffix", suffix);
}
}

View File

@ -1,5 +1,229 @@
package net.milkbowl.vault.chat.plugins;
public class Chat_Permissions3 {
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import net.milkbowl.vault.chat.Chat;
public class Chat_Permissions3 extends Chat {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "Permissions 3 (Yeti)";
private PermissionHandler perms;
private Plugin plugin = null;
private PluginManager pluginManager = null;
private Permissions chat = null;
private PermissionServerListener permissionServerListener = null;
public Chat_Permissions3(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener();
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
// Load Plugin in case it was loaded before
if (chat == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Permissions");
if (perms != null) {
if (perms.isEnabled() && perms.getDescription().getVersion().startsWith("3")) {
chat = (Permissions) perms;
this.perms = chat.getHandler();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
}
private class PermissionServerListener extends ServerListener {
public void onPluginEnable(PluginEnableEvent event) {
if (chat == null) {
Plugin perms = event.getPlugin();
if(perms.getDescription().getName().equals("Permissions") && perms.getDescription().getVersion().startsWith("3")) {
if (perms.isEnabled()) {
chat = (Permissions) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
}
public void onPluginDisable(PluginDisableEvent event) {
if (chat != null) {
if (event.getPlugin().getDescription().getName().equals("Permissions")) {
chat = null;
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), name));
}
}
}
}
@Override
public String getName() {
return name;
}
@Override
public boolean isEnabled() {
if (chat == null) {
return false;
} else {
return chat.isEnabled();
}
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
Integer i = this.perms.getInfoInteger(world, playerName, node, false);
return (i == null) ? defaultValue : i;
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
Double d = this.perms.getInfoDouble(world, playerName, node, false);
return (d == null) ? defaultValue : d;
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
Boolean b = this.perms.getInfoBoolean(world, playerName, node, false);
return (b == null) ? defaultValue : b;
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
String s = this.perms.getInfoString(world, playerName, node, false);
return (s == null) ? defaultValue : s;
}
@Override
public String getPlayerPrefix(String world, String playerName) {
return this.perms.getUserPrefix(world, playerName);
}
@Override
public String getPlayerSuffix(String world, String playerName) {
return this.perms.getUserSuffix(world, playerName);
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
this.perms.addUserInfo(world, player, "suffix", suffix);
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
this.perms.addUserInfo(world, player, "prefix", prefix);
}
public void setPlayerInfo(String world, String playerName, String node, Object value) {
this.perms.addUserInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
Integer i = this.perms.getInfoInteger(world, groupName, node, true);
return (i == null) ? defaultValue : i;
}
public void setGroupInfo(String world, String groupName, String node, Object value) {
this.perms.addGroupInfo(world, groupName, node, value);
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
Double d = this.perms.getInfoDouble(world, groupName, node, true);
return (d == null) ? defaultValue : d;
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
Boolean b = this.perms.getInfoBoolean(world, groupName, node, true);
return (b == null) ? defaultValue : b;
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
String s = this.perms.getInfoString(world, groupName, node, true);
return (s == null) ? defaultValue : s;
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public String getGroupPrefix(String world, String group) {
try {
return perms.safeGetGroup(world, group).getPrefix();
} catch(Exception e) {
return null;
}
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
this.perms.addGroupInfo(world, group, "prefix", prefix);
}
@Override
public String getGroupSuffix(String world, String group) {
try {
return perms.safeGetGroup(world, group).getSuffix();
} catch(Exception e) {
return null;
}
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
this.perms.addGroupInfo(world, group, "suffix", suffix);
}
}

View File

@ -1,5 +1,295 @@
package net.milkbowl.vault.chat.plugins;
public class Chat_PermissionsEx {
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import ru.tehkode.permissions.PermissionGroup;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;
import net.milkbowl.vault.chat.Chat;
public class Chat_PermissionsEx extends Chat {
private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "PermissionsEx_Chat";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private PermissionsEx chat = null;
private PermissionServerListener permissionServerListener = null;
public Chat_PermissionsEx(Plugin plugin) {
this.plugin = plugin;
pluginManager = this.plugin.getServer().getPluginManager();
permissionServerListener = new PermissionServerListener(this);
this.pluginManager.registerEvent(Type.PLUGIN_ENABLE, permissionServerListener, Priority.Monitor, plugin);
this.pluginManager.registerEvent(Type.PLUGIN_DISABLE, permissionServerListener, Priority.Monitor, plugin);
// Load Plugin in case it was loaded before
if (chat == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
if (perms != null) {
if (perms.isEnabled()) {
chat = (PermissionsEx) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
}
private class PermissionServerListener extends ServerListener {
Chat_PermissionsEx chat = null;
public PermissionServerListener(Chat_PermissionsEx chat) {
this.chat = chat;
}
public void onPluginEnable(PluginEnableEvent event) {
if (chat.chat == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
if (perms != null) {
if (perms.isEnabled()) {
chat.chat = (PermissionsEx) perms;
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), chat.name));
}
}
}
}
public void onPluginDisable(PluginDisableEvent event) {
if (chat.chat != null) {
if (event.getPlugin().getDescription().getName().equals("PermissionsEx")) {
chat.chat = null;
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), chat.name));
}
}
}
}
@Override
public String getName() {
return name;
}
@Override
public boolean isEnabled() {
if (chat == null)
return false;
else
return chat.isEnabled();
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionInteger(node, world, defaultValue);
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionDouble(node, world, defaultValue);
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionBoolean(node, world, defaultValue);
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOption(node, world, defaultValue);
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOptionInteger(node, world, defaultValue);
}
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, String.valueOf(value));
}
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOptionDouble(node, world, defaultValue);
}
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, String.valueOf(value));
}
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOptionBoolean(node, world, defaultValue);
}
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, String.valueOf(value));
}
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOption(node, world, defaultValue);
}
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, value);
}
}
@Override
public String getPlayerPrefix(String world, String playerName) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
return user.getPrefix();
} else {
return null;
}
}
@Override
public String getPlayerSuffix(String world, String playerName) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
return user.getSuffix();
} else {
return null;
}
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
if (user != null) {
user.setSuffix(suffix, world);
}
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
if (user != null) {
user.setPrefix(prefix, world);
}
}
@Override
public String getGroupPrefix(String world, String group) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
return pGroup.getPrefix();
} else {
return null;
}
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
pGroup.setPrefix(prefix, world);
}
}
@Override
public String getGroupSuffix(String world, String group) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
return pGroup.getSuffix();
} else {
return null;
}
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
pGroup.setSuffix(suffix, world);
}
}
}

View File

@ -366,426 +366,6 @@ public abstract class Permission {
return playerRemoveGroup(player.getWorld().getName(), player.getName(), group);
}
/**
* Get a players informational node (Integer) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue);
/**
* Get a players informational node (Integer) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) {
return getPlayerInfoInteger(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (Integer) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public int getPlayerInfoInteger(Player player, String node, int defaultValue) {
return getPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (Integer) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoInteger(String world, String player, String node, int value);
/**
* Set a players informational node (Integer) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoInteger(World world, String player, String node, int value) {
setPlayerInfoInteger(world.getName(), player, node, value);
}
/**
* Set a players informational node (Integer) value
* @param player Player Object
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoInteger(Player player, String node, int value) {
setPlayerInfoInteger(player.getWorld().getName(), player.getName(), node, value);
}
/**
* Get a groups informational node (Integer) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public int getGroupInfoInteger(String world, String group, String node, int defaultValue);
/**
* Get a groups informational node (Integer) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public int getGroupInfoInteger(World world, String group, String node, int defaultValue) {
return getGroupInfoInteger(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (Integer) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoInteger(String world, String group, String node, int value);
/**
* Set a groups informational node (Integer) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoInteger(World world, String group, String node, int value) {
setGroupInfoInteger(world.getName(), group, node, value);
}
/**
* Get a players informational node (Double) value
* @param world World name
* @param player Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue);
/**
* Get a players informational node (Double) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) {
return getPlayerInfoDouble(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (Double) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public double getPlayerInfoDouble(Player player, String node, double defaultValue) {
return getPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (Double) value
* @param world World name
* @param player Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoDouble(String world, String player, String node, double value);
/**
* Set a players informational node (Double) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoDouble(World world, String player, String node, double value) {
setPlayerInfoDouble(world.getName(), player, node, value);
}
/**
* Set a players informational node (Double) value
* @param player Player Object
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoDouble(Player player, String node, double value) {
setPlayerInfoDouble(player.getWorld().getName(), player.getName(), node, value);
}
/**
* Get a groups informational node (Double) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public double getGroupInfoDouble(String world, String group, String node, double defaultValue);
/**
* Get a groups informational node (Double) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public double getGroupInfoDouble(World world, String group, String node, double defaultValue) {
return getGroupInfoDouble(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (Double) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoDouble(String world, String group, String node, double value);
/**
* Set a groups informational node (Double) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoDouble(World world, String group, String node, double value) {
setGroupInfoDouble(world.getName(), group, node, value);
}
/**
* Get a players informational node (Boolean) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue);
/**
* Get a players informational node (Boolean) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) {
return getPlayerInfoBoolean(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (Boolean) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) {
return getPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (Boolean) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value);
/**
* Set a players informational node (Boolean) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoBoolean(World world, String player, String node, boolean value) {
setPlayerInfoBoolean(world.getName(), player, node, value);
}
/**
* Set a players informational node (Boolean) value
* @param player Player Object
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoBoolean(Player player, String node, boolean value) {
setPlayerInfoBoolean(player.getWorld().getName(), player.getName(), node, value);
}
/**
* Get a groups informational node (Boolean) value
* @param world Name of World
* @param group Name of Group
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue);
/**
* Set a players informational node (Boolean) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue) {
return getGroupInfoBoolean(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (Boolean) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoBoolean(String world, String group, String node, boolean value);
/**
* Set a players informational node (Boolean) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoBoolean(World world, String group, String node, boolean value) {
setGroupInfoBoolean(world.getName(), group, node, value);
}
/**
* Get a players informational node (String) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue);
/**
* Get a players informational node (String) value
* @param world World Object
* @param player Player name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public String getPlayerInfoString(World world, String player, String node, String defaultValue) {
return getPlayerInfoString(world.getName(), player, node, defaultValue);
}
/**
* Get a players informational node (String) value
* @param player Player Object
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public String getPlayerInfoString(Player player, String node, String defaultValue) {
return getPlayerInfoString(player.getWorld().getName(), player.getName(), node, defaultValue);
}
/**
* Set a players informational node (String) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
abstract public void setPlayerInfoString(String world, String player, String node, String value);
/**
* Set a players informational node (String) value
* @param world World name
* @param player Player name
* @param node Permission node
* @param value Value to set
*/
public void setPlayerInfoString(World world, String player, String node, String value) {
setPlayerInfoString(world.getName(), player, node, value);
}
/**
* Set a players informational node (String) value
* @param player Player Object
* @param node Permission node
* @param value Value ot set
*/
public void setPlayerInfoString(Player player, String node, String value) {
setPlayerInfoString(player.getWorld().getName(), player.getName(), node, value);
}
/**
* Get a groups informational node (String) value
* @param world Name of World
* @param group Name of Group
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
abstract public String getGroupInfoString(String world, String group, String node, String defaultValue);
/**
* Set a players informational node (String) value
* @param world World Object
* @param group Group name
* @param node Permission node
* @param defaultValue Default value
* @return Value
*/
public String getGroupInfoString(World world, String group, String node, String defaultValue) {
return getGroupInfoString(world.getName(), group, node, defaultValue);
}
/**
* Set a groups informational node (String) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
abstract public void setGroupInfoString(String world, String group, String node, String value);
/**
* Set a groups informational node (String) value
* @param world World name
* @param group Group name
* @param node Permission node
* @param value Value to set
*/
public void setGroupInfoString(World world, String group, String node, String value) {
setGroupInfoString(world.getName(), group, node, value);
}
/**
* Gets the list of groups that this player has
* @param world World name
@ -839,186 +419,6 @@ public abstract class Permission {
public String getPrimaryGroup(Player player) {
return getPrimaryGroup(player.getWorld().getName(), player.getName());
}
/**
* Get players prefix
* @param world World name
* @param player Player name
* @return Prefix
*/
abstract public String getPlayerPrefix(String world, String player);
/**
* Get players prefix
* @param world World Object
* @param player Player name
* @return Prefix
*/
public String getPlayerPrefix(World world, String player) {
return getPlayerPrefix(world.getName(), player);
}
/**
* Get players prefix
* @param player Player Object
* @return Prefix
*/
public String getPlayerPrefix(Player player) {
return getPlayerPrefix(player.getWorld().getName(), player.getName());
}
/**
* Set players prefix
* @param world World name
* @param player Player name
* @param prefix Prefix
*/
abstract public void setPlayerPrefix(String world, String player, String prefix);
/**
* Set players prefix
* @param world World Object
* @param player Player name
* @param prefix Prefix
*/
public void setPlayerPrefix(World world, String player, String prefix) {
setPlayerPrefix(world.getName(), player, prefix);
}
/**
* Set players prefix
* @param player Player Object
* @param prefix Prefix
*/
public void setPlayerPrefix(Player player, String prefix) {
setPlayerPrefix(player.getWorld().getName(), player.getName(), prefix);
}
/**
* Get players suffix
* @param world World name
* @param player Player name
* @return Suffix
*/
abstract public String getPlayerSuffix(String world, String player);
/**
* Get players suffix
* @param world World Object
* @param player Player name
* @return Suffix
*/
public String getPlayerSuffix(World world, String player) {
return getPlayerSuffix(world.getName(), player);
}
/**
* Get players suffix
* @param player Player Object
* @return Suffix
*/
public String getPlayerSuffix(Player player) {
return getPlayerSuffix(player.getWorld().getName(), player.getName());
}
/**
* Set players suffix
* @param world World name
* @param player Player name
* @param suffix Suffix
*/
abstract public void setPlayerSuffix(String world, String player, String suffix);
/**
* Set players suffix
* @param world World Object
* @param player Player name
* @param suffix Suffix
*/
public void setPlayerSuffix(World world, String player, String suffix) {
setPlayerSuffix(world.getName(), player, suffix);
}
/**
* Set players suffix
* @param player Player Object
* @param suffix Suffix
*/
public void setPlayerSuffix(Player player, String suffix) {
setPlayerSuffix(player.getWorld().getName(), player.getName(), suffix);
}
/**
* Get group prefix
* @param world World name
* @param group Group name
* @return Prefix
*/
abstract public String getGroupPrefix(String world, String group);
/**
* Get group prefix
* @param world World Object
* @param group Group name
* @return Prefix
*/
public String getGroupPrefix(World world, String group) {
return getGroupPrefix(world.getName(), group);
}
/**
* Set group prefix
* @param world World name
* @param group Group name
* @param prefix Prefix
*/
abstract public void setGroupPrefix(String world, String group, String prefix);
/**
* Set group prefix
* @param world World Object
* @param group Group name
* @param prefix Prefix
*/
public void setGroupPrefix(World world, String group, String prefix) {
setGroupPrefix(world.getName(), group, prefix);
}
/**
* Get group suffix
* @param world World name
* @param group Group name
* @return Suffix
*/
abstract public String getGroupSuffix(String world, String group);
/**
* Get group suffix
* @param world World Object
* @param group Group name
* @return Suffix
*/
public String getGroupSuffix(World world, String group) {
return getGroupSuffix(world.getName(), group);
}
/**
* Set group suffix
* @param world World name
* @param group Group name
* @param suffix Suffix
*/
abstract public void setGroupSuffix(String world, String group, String suffix);
/**
* Set group suffix
* @param world World Object
* @param group Group name
* @param suffix Suffix
*/
public void setGroupSuffix(World world, String group, String suffix) {
setGroupSuffix(world.getName(), group, suffix);
}
/**
* Returns a list of all known groups

View File

@ -158,86 +158,6 @@ public class Permission_GroupManager extends Permission {
return false;
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
return perms.getPermissionInteger(playerName, node);
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
return perms.getGroupPermissionInteger(groupName, node);
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
return perms.getPermissionDouble(playerName, node);
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
return perms.getGroupPermissionDouble(groupName, node);
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
return perms.getPermissionBoolean(playerName, node);
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
return perms.getGroupPermissionBoolean(groupName, node);
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
return perms.getPermissionString(playerName, node);
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
return perms.getGroupPermissionString(groupName, node);
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String[] getPlayerGroups(String world, String playerName) {
return perms.getGroups(playerName);
@ -248,46 +168,6 @@ public class Permission_GroupManager extends Permission {
return perms.getGroup(playerName);
}
@Override
public String getPlayerPrefix(String world, String playerName) {
return perms.getGroupPrefix(getPrimaryGroup(world, playerName));
}
@Override
public String getPlayerSuffix(String world, String playerName) {
return perms.getGroupSuffix(getPrimaryGroup(world, playerName));
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupPrefix(String world, String group) {
return perms.getGroupPrefix(group);
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupSuffix(String world, String group) {
return perms.getGroupSuffix(group);
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean playerAddTransient(String world, String player, String permission) {
if (world != null) {

View File

@ -152,97 +152,6 @@ public class Permission_Permissions2 extends Permission {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
int i = this.perms.getPermissionInteger(world, playerName, node);
return (i == -1) ? defaultValue : i;
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
public void setGroupInfo(String world, String groupName, String node, Object value) {
this.perms.addGroupInfo(world, groupName, node, value);
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
int i = this.perms.getGroupPermissionInteger(world, groupName, node);
return (i == -1) ? defaultValue : i;
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
double d = this.perms.getPermissionDouble(world, playerName, node);
return (d == -1) ? defaultValue : d;
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
double d = this.perms.getGroupPermissionDouble(world, groupName, node);
return (d == -1) ? defaultValue : d;
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
// Warning does not support default value
return this.perms.getPermissionBoolean(world, playerName, node);
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
return this.perms.getGroupPermissionBoolean(world, groupName, node);
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
String s = this.perms.getPermissionString(world, playerName, node);
return (s == "" || s == null) ? defaultValue : s;
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
String s = this.perms.getGroupPermissionString(world, groupName, node);
return (s == "" || s == null) ? defaultValue : s;
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public String[] getPlayerGroups(String world, String playerName) {
return this.perms.getGroups(world, playerName);
@ -253,46 +162,6 @@ public class Permission_Permissions2 extends Permission {
return this.perms.getGroup(world, playerName);
}
@Override
public String getPlayerPrefix(String world, String playerName) {
return this.perms.getPermissionString(world, playerName, "prefix");
}
@Override
public String getPlayerSuffix(String world, String playerName) {
return this.perms.getPermissionString(world, playerName, "suffix");
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupPrefix(String world, String group) {
return perms.getGroupPrefix(world, group);
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupSuffix(String world, String group) {
return perms.getGroupSuffix(world, group);
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public boolean playerAddTransient(String world, String player, String permission) {
if (world != null) {
@ -343,5 +212,4 @@ public class Permission_Permissions2 extends Permission {
}
return groupNames.toArray(new String[0]);
}
}

View File

@ -114,30 +114,6 @@ public class Permission_Permissions3 extends Permission {
return name;
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
Integer i = this.perms.getInfoInteger(world, playerName, node, false);
return (i == null) ? defaultValue : i;
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
Double d = this.perms.getInfoDouble(world, playerName, node, false);
return (d == null) ? defaultValue : d;
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
Boolean b = this.perms.getInfoBoolean(world, playerName, node, false);
return (b == null) ? defaultValue : b;
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
String s = this.perms.getInfoString(world, playerName, node, false);
return (s == null) ? defaultValue : s;
}
@Override
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
// Not certain if this is possible in P3
@ -174,78 +150,6 @@ public class Permission_Permissions3 extends Permission {
return true;
}
public void setPlayerInfo(String world, String playerName, String node, Object value) {
this.perms.addUserInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
setPlayerInfo(world, playerName, node, value);
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
Integer i = this.perms.getInfoInteger(world, groupName, node, true);
return (i == null) ? defaultValue : i;
}
public void setGroupInfo(String world, String groupName, String node, Object value) {
this.perms.addGroupInfo(world, groupName, node, value);
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
Double d = this.perms.getInfoDouble(world, groupName, node, true);
return (d == null) ? defaultValue : d;
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
Boolean b = this.perms.getInfoBoolean(world, groupName, node, true);
return (b == null) ? defaultValue : b;
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
String s = this.permission.getHandler().getInfoString(world, groupName, node, true);
return (s == null) ? defaultValue : s;
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
setGroupInfo(world, groupName, node, value);
}
@Override
public boolean groupHas(String worldName, String groupName, String permission) {
try {
@ -276,53 +180,6 @@ public class Permission_Permissions3 extends Permission {
return this.perms.has(worldName, playerName, permission);
}
@Override
public String getPlayerPrefix(String world, String playerName) {
return this.perms.getUserPrefix(world, playerName);
}
@Override
public String getPlayerSuffix(String world, String playerName) {
return this.perms.getUserSuffix(world, playerName);
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
this.perms.addUserInfo(world, player, "suffix", suffix);
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
this.perms.addUserInfo(world, player, "prefix", prefix);
}
@Override
public String getGroupPrefix(String world, String group) {
try {
return perms.safeGetGroup(world, group).getPrefix();
} catch(Exception e) {
return null;
}
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
this.perms.addGroupInfo(world, group, "prefix", prefix);
}
@Override
public String getGroupSuffix(String world, String group) {
try {
return perms.safeGetGroup(world, group).getSuffix();
} catch(Exception e) {
return null;
}
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
this.perms.addGroupInfo(world, group, "suffix", suffix);
}
@Override
public boolean playerAddTransient(String world, String player, String permission) {

View File

@ -242,88 +242,7 @@ public class Permission_PermissionsBukkit extends Permission {
}
return plugin.getServer().dispatchCommand(ccs, "permission player removegroup " + group + " " + player);
}
@Override
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public void setPlayerInfoInteger(String world, String player, String node, int value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public void setGroupInfoInteger(String world, String group, String node,int value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public void setPlayerInfoDouble(String world, String player, String node, double value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public void setGroupInfoDouble(String world, String group, String node, double value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public void setPlayerInfoBoolean(String world, String player, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue) {
return this.groupHas(world, group, node);
}
@Override
public void setGroupInfoBoolean(String world, String group, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public void setPlayerInfoString(String world, String player, String node, String value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public String getGroupInfoString(String world, String group, String node, String defaultValue) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public void setGroupInfoString(String world, String group, String node, String value) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
}
@Override
public String[] getPlayerGroups(String world, String player) {
List<String> groupList = new ArrayList<String>();
@ -351,59 +270,6 @@ public class Permission_PermissionsBukkit extends Permission {
return null;
}
@Override
public String getPlayerPrefix(String world, String player) {
if (mChat == null) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
} else if (plugin.getServer().getPlayer(player) == null){
throw new UnsupportedOperationException(getName() + " does not support offline node retrieval");
} else {
return mChat.getPrefix(plugin.getServer().getPlayer(player));
}
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
}
@Override
public String getPlayerSuffix(String world, String player) {
if (mChat == null) {
throw new UnsupportedOperationException(getName() + " does not support info nodes.");
} else if (plugin.getServer().getPlayer(player) == null){
throw new UnsupportedOperationException(getName() + " does not support offline node retrieval");
} else {
return mChat.getSuffix(plugin.getServer().getPlayer(player));
}
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
// TODO Auto-generated method stub
}
@Override
public String getGroupPrefix(String world, String group) {
throw new UnsupportedOperationException(getName() + " does not support group info nodes.");
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
// TODO Auto-generated method stub
}
@Override
public String getGroupSuffix(String world, String group) {
throw new UnsupportedOperationException(getName() + " does not support group info nodes.");
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException(getName() + " does not support group info nodes.");
}
@Override
public String[] getGroups() {
List<String> groupNames = new ArrayList<String>();

View File

@ -39,7 +39,7 @@ import ru.tehkode.permissions.bukkit.PermissionsEx;
public class Permission_PermissionsEx extends Permission {
private static final Logger log = Logger.getLogger("Minecraft");
private String name = "PermissionsEx";
private final String name = "PermissionsEx";
private Plugin plugin = null;
private PluginManager pluginManager = null;
private PermissionsEx permission = null;
@ -139,26 +139,6 @@ public class Permission_PermissionsEx extends Permission {
return name;
}
@Override
public int getPlayerInfoInteger(String world, String playerName, String node, int defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionInteger(node, world, defaultValue);
}
@Override
public double getPlayerInfoDouble(String world, String playerName, String node, double defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionDouble(node, world, defaultValue);
}
@Override
public boolean getPlayerInfoBoolean(String world, String playerName, String node, boolean defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOptionBoolean(node, world, defaultValue);
}
@Override
public String getPlayerInfoString(String world, String playerName, String node, String defaultValue) {
return PermissionsEx.getPermissionManager().getUser(playerName).getOption(node, world, defaultValue);
}
@Override
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
@ -227,118 +207,6 @@ public class Permission_PermissionsEx extends Permission {
}
}
@Override
public void setPlayerInfoInteger(String world, String playerName, String node, int value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public void setPlayerInfoDouble(String world, String playerName, String node, double value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public void setPlayerInfoBoolean(String world, String playerName, String node, boolean value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public void setPlayerInfoString(String world, String playerName, String node, String value) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
user.setOption(node, String.valueOf(value), world);
}
}
@Override
public int getGroupInfoInteger(String world, String groupName, String node, int defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOptionInteger(node, world, defaultValue);
}
}
@Override
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, String.valueOf(value));
}
}
@Override
public double getGroupInfoDouble(String world, String groupName, String node, double defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOptionDouble(node, world, defaultValue);
}
}
@Override
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, String.valueOf(value));
}
}
@Override
public boolean getGroupInfoBoolean(String world, String groupName, String node, boolean defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOptionBoolean(node, world, defaultValue);
}
}
@Override
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, String.valueOf(value));
}
}
@Override
public String getGroupInfoString(String world, String groupName, String node, String defaultValue) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return defaultValue;
} else {
return group.getOption(node, world, defaultValue);
}
}
@Override
public void setGroupInfoString(String world, String groupName, String node, String value) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
if (group == null) {
return;
} else {
group.setOption(node, world, value);
}
}
@Override
public boolean groupHas(String worldName, String groupName, String permission) {
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
@ -372,79 +240,6 @@ public class Permission_PermissionsEx extends Permission {
}
}
@Override
public String getPlayerPrefix(String world, String playerName) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
return user.getPrefix();
} else {
return null;
}
}
@Override
public String getPlayerSuffix(String world, String playerName) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(playerName);
if (user != null) {
return user.getSuffix();
} else {
return null;
}
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
if (user != null) {
user.setSuffix(suffix, world);
}
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
PermissionUser user = PermissionsEx.getPermissionManager().getUser(player);
if (user != null) {
user.setPrefix(prefix, world);
}
}
@Override
public String getGroupPrefix(String world, String group) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
return pGroup.getPrefix();
} else {
return null;
}
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
pGroup.setPrefix(prefix, world);
}
}
@Override
public String getGroupSuffix(String world, String group) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
return pGroup.getSuffix();
} else {
return null;
}
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if (group != null) {
pGroup.setSuffix(suffix, world);
}
}
@Override
public boolean playerAddTransient(String world, String player, String permission) {
PermissionUser pPlayer = PermissionsEx.getPermissionManager().getUser(player);

View File

@ -112,87 +112,6 @@ public class Permission_SuperPerms extends Permission {
throw new UnsupportedOperationException(getName() + " no group permissions.");
}
@Override
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setPlayerInfoInteger(String world, String player, String node, int value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setGroupInfoInteger(String world, String group, String node, int value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setPlayerInfoDouble(String world, String player, String node, double value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setGroupInfoDouble(String world, String group, String node,double value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setPlayerInfoBoolean(String world, String player, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setGroupInfoBoolean(String world, String group, String node, boolean value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setPlayerInfoString(String world, String player, String node, String value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public String getGroupInfoString(String world, String group, String node, String defaultValue) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setGroupInfoString(String world, String group, String node, String value) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public String[] getPlayerGroups(String world, String player) {
throw new UnsupportedOperationException(getName() + " no group permissions.");
@ -203,46 +122,6 @@ public class Permission_SuperPerms extends Permission {
throw new UnsupportedOperationException(getName() + " no group permissions.");
}
@Override
public String getPlayerPrefix(String world, String player) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public String getPlayerSuffix(String world, String player) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public String getGroupPrefix(String world, String group) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public String getGroupSuffix(String world, String group) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException(getName() + " no data permissions.");
}
@Override
public String[] getGroups() {
throw new UnsupportedOperationException(getName() + " does not support group listing!");