From 9edaca011d148744fed8546bac424aca6ea36b6d Mon Sep 17 00:00:00 2001 From: Xefir Date: Sun, 29 Apr 2012 02:22:45 +0200 Subject: [PATCH] 1.6.2 in github (the previous commit is 1.6.1) --- META-INF/MANIFEST.MF | 2 - config.yml | 1 + .../bukkit/simplyperms/SimplyAPI.java | 33 +++++----- .../bukkit/simplyperms/SimplyCommands.java | 39 +++++++++--- .../bukkit/simplyperms/SimplyPlugin.java | 24 +++++-- .../bukkit/simplyperms/imports/ImportDB.java | 0 .../simplyperms/imports/ImportFile.java | 0 .../simplyperms/imports/ImportManager.java | 0 .../simplyperms/imports/ImportPermBukkit.java | 0 .../simplyperms/imports/ImportPermEx.java | 62 +++++++++++++++++++ .../simplyperms/imports/ImportPrivileges.java | 14 ++--- .../bukkit/simplyperms/io/ConfigFile.java | 16 ++--- .../bukkit/simplyperms/preventions/Bow.java | 0 .../simplyperms/preventions/Changesign.java | 0 .../bukkit/simplyperms/preventions/Chat.java | 0 .../simplyperms/preventions/Command.java | 0 .../simplyperms/preventions/Damage.java | 0 .../bukkit/simplyperms/preventions/Fight.java | 0 .../simplyperms/preventions/Hunger.java | 0 .../bukkit/simplyperms/preventions/Item.java | 0 .../simplyperms/preventions/Monster.java | 0 .../bukkit/simplyperms/preventions/Sneak.java | 0 .../simplyperms/preventions/Vehicle.java | 0 .../preventions/animals/Shear.java | 0 .../simplyperms/preventions/animals/Tame.java | 0 .../preventions/bucket/Lavabucket.java | 0 .../preventions/bucket/Milking.java | 0 .../preventions/bucket/Waterbucket.java | 0 .../preventions/build/Breakblock.java | 0 .../preventions/build/Placeblock.java | 0 .../simplyperms/preventions/craft/Brew.java | 0 .../simplyperms/preventions/craft/Chest.java | 0 .../preventions/craft/Dispenser.java | 0 .../preventions/craft/Enchant.java | 0 .../preventions/craft/Furnace.java | 0 .../preventions/craft/Workbench.java | 0 .../preventions/fire/Fireball.java | 0 .../preventions/fire/FlintAndSteel.java | 0 .../simplyperms/preventions/interact/Bed.java | 0 .../preventions/interact/Button.java | 0 .../preventions/interact/Cake.java | 0 .../preventions/interact/Door.java | 0 .../preventions/interact/Fish.java | 0 .../preventions/interact/Jukebox.java | 0 .../preventions/interact/Lever.java | 0 .../preventions/interact/Noteblock.java | 0 .../preventions/interact/Pressureplate.java | 0 .../preventions/interact/Repeater.java | 0 .../simplyperms/preventions/loot/Drop.java | 0 .../simplyperms/preventions/loot/Pickup.java | 0 .../preventions/projectile/Egg.java | 0 .../preventions/projectile/Potion.java | 0 .../preventions/projectile/Snowball.java | 0 .../preventions/spam/CapsLock.java | 0 .../simplyperms/preventions/spam/Flood.java | 0 plugin.yml | 3 +- 56 files changed, 150 insertions(+), 44 deletions(-) delete mode 100755 META-INF/MANIFEST.MF mode change 100755 => 100644 config.yml mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/SimplyAPI.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/imports/ImportDB.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/imports/ImportFile.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/imports/ImportManager.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/imports/ImportPermBukkit.java create mode 100644 net/crystalyx/bukkit/simplyperms/imports/ImportPermEx.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/imports/ImportPrivileges.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Bow.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Changesign.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Chat.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Command.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Damage.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Fight.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Hunger.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Item.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Monster.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Sneak.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/Vehicle.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/animals/Shear.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/animals/Tame.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/bucket/Lavabucket.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/bucket/Milking.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/bucket/Waterbucket.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/build/Breakblock.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/build/Placeblock.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/craft/Brew.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/craft/Chest.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/craft/Dispenser.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/craft/Enchant.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/craft/Furnace.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/craft/Workbench.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/fire/Fireball.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/fire/FlintAndSteel.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Bed.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Button.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Cake.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Door.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Fish.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Jukebox.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Lever.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Noteblock.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Pressureplate.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/interact/Repeater.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/loot/Drop.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/loot/Pickup.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/projectile/Egg.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/projectile/Potion.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/projectile/Snowball.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/spam/CapsLock.java mode change 100755 => 100644 net/crystalyx/bukkit/simplyperms/preventions/spam/Flood.java mode change 100755 => 100644 plugin.yml diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF deleted file mode 100755 index 58630c0..0000000 --- a/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/config.yml b/config.yml old mode 100755 new mode 100644 index 086fae5..09636b2 --- a/config.yml +++ b/config.yml @@ -1,4 +1,5 @@ debug: false +default: default db: type: file database: minecraft diff --git a/net/crystalyx/bukkit/simplyperms/SimplyAPI.java b/net/crystalyx/bukkit/simplyperms/SimplyAPI.java old mode 100755 new mode 100644 index 10ab582..18e54e8 --- a/net/crystalyx/bukkit/simplyperms/SimplyAPI.java +++ b/net/crystalyx/bukkit/simplyperms/SimplyAPI.java @@ -108,7 +108,7 @@ public class SimplyAPI implements PermsConfig { } public List getGroupWorlds(String group) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); if (plugin.getNode("groups/" + group + "/worlds") != null) { return new ArrayList(plugin.getNode("groups/" + group + "/worlds").getKeys(false)); } @@ -118,31 +118,31 @@ public class SimplyAPI implements PermsConfig { } public List getGroupInheritance(String group) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); return plugin.getConfig().getStringList("groups/" + group + "/inheritance"); } public void addGroupInheritance(String group, String inherit) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); List inheritances = getGroupInheritance(group); if (!inheritances.contains(inherit)) inheritances.add(inherit); plugin.getConfig().set("groups/" + group + "/inheritance", inheritances); } public void removeGroupInheritance(String group, String inherit) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); List inheritances = getGroupInheritance(group); inheritances.remove(inherit); plugin.getConfig().set("groups/" + group + "/inheritance", inheritances); } public void removeGroupInheritances(String group) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); plugin.getConfig().set("groups/" + group + "/inheritance", null); } public Map getGroupPermissions(String group, String world) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); Map finalPerms = new HashMap(); String permNode = (!world.isEmpty()) ? "groups/" + group + "/worlds/" + world : "groups/" + group + "/permissions"; if (plugin.getNode(permNode) != null) { @@ -158,7 +158,7 @@ public class SimplyAPI implements PermsConfig { } public void addGroupPermission(String group, String world, String permission, boolean value) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); Map permissions = getGroupPermissions(group, world); if (permissions.containsKey(permission)) permissions.remove(permission); permissions.put(permission, value); @@ -175,7 +175,7 @@ public class SimplyAPI implements PermsConfig { } public void removeGroupPermission(String group, String world, String permission) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); Map permissions = getGroupPermissions(group, world); permissions.remove(permission); if (!world.isEmpty()) { @@ -191,15 +191,11 @@ public class SimplyAPI implements PermsConfig { } public void removeGroupPermissions(String group) { - if (group.isEmpty()) group = "default"; + if (group.isEmpty()) group = getDefaultGroup(); plugin.getConfig().set("groups/" + group + "/permissions", null); } public void removeGroup(String group) { - if (group.isEmpty() || group.equals("default")) { - plugin.debug("You can't delete default group !"); - return; - } plugin.getConfig().set("groups/" + group, null); } @@ -224,12 +220,21 @@ public class SimplyAPI implements PermsConfig { plugin.getConfig().set("messages", messages); } + public String getDefaultGroup() { + return plugin.getConfig().getString("default", "default"); + } + + public void setDefaultGroup(String group) { + if (group.isEmpty()) group = "default"; + plugin.getConfig().set("default", group); + } + public void refreshPermissions() { plugin.refreshPermissions(); } protected List getKeys(YamlConfiguration config, String node) { - if (config.getConfigurationSection(node) != null) { + if (config.isConfigurationSection(node)) { return new ArrayList(config.getConfigurationSection(node).getKeys(false)); } else { diff --git a/net/crystalyx/bukkit/simplyperms/SimplyCommands.java b/net/crystalyx/bukkit/simplyperms/SimplyCommands.java index 6581800..3824f64 100755 --- a/net/crystalyx/bukkit/simplyperms/SimplyCommands.java +++ b/net/crystalyx/bukkit/simplyperms/SimplyCommands.java @@ -4,12 +4,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; +import java.util.List; import java.util.Map; import net.crystalyx.bukkit.simplyperms.imports.ImportDB; import net.crystalyx.bukkit.simplyperms.imports.ImportFile; import net.crystalyx.bukkit.simplyperms.imports.ImportManager; import net.crystalyx.bukkit.simplyperms.imports.ImportPermBukkit; +import net.crystalyx.bukkit.simplyperms.imports.ImportPermEx; import net.crystalyx.bukkit.simplyperms.imports.ImportPrivileges; import org.bukkit.ChatColor; @@ -168,6 +170,8 @@ public class SimplyCommands implements CommandExecutor { manager = new ImportPermBukkit(plugin); } else if (pluginName.equals("privileges")) { manager = new ImportPrivileges(plugin); + } else if (pluginName.equals("permissionsex")) { + manager = new ImportPermEx(plugin); } else if (pluginName.equals("file")) { manager = new ImportFile(plugin); } else if (plugin.getConfig().getString("db/type") != null @@ -227,7 +231,7 @@ public class SimplyCommands implements CommandExecutor { sender.sendMessage(ChatColor.GREEN + "Users in " + ChatColor.WHITE + group + ChatColor.GREEN + " (" + ChatColor.WHITE + count + ChatColor.GREEN + "): " + ChatColor.WHITE + text); return true; } else if (subcommand.equals("setperm")) { - if (!checkPerm(sender, "group.setperm")) return true; + if (split.length >= 4 && !checkPerm(sender, "group.setperm", Arrays.asList(split[3].split(",")))) return true; if (split.length != 4 && split.length != 5) return usage(sender, command, "group setperm"); String group = split[2]; String perm = split[3]; @@ -254,7 +258,7 @@ public class SimplyCommands implements CommandExecutor { sender.sendMessage(ChatColor.GREEN + "Group " + ChatColor.WHITE + group + ChatColor.GREEN + " now has " + ChatColor.WHITE + perm + ChatColor.GREEN + " = " + ChatColor.WHITE + value + ChatColor.GREEN + "."); return true; } else if (subcommand.equals("unsetperm")) { - if (!checkPerm(sender, "group.unsetperm")) return true; + if (split.length >= 4 && !checkPerm(sender, "group.unsetperm", Arrays.asList(split[3].split(",")))) return true; if (split.length != 4) return usage(sender, command, "group unsetperm"); String group = split[2].toLowerCase(); String perm = split[3]; @@ -312,7 +316,7 @@ public class SimplyCommands implements CommandExecutor { sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is in groups (" + ChatColor.WHITE + count + ChatColor.GREEN + "): " + ChatColor.WHITE + text); return true; } else if (subcommand.equals("setgroup")) { - if (!checkPerm(sender, "player.setgroup")) return true; + if (split.length == 4 && !checkPerm(sender, "player.setgroup", Arrays.asList(split[3].split(",")))) return true; if (split.length != 4) return usage(sender, command, "player setgroup"); String player = split[2].toLowerCase(); String[] groups = split[3].split(","); @@ -327,7 +331,7 @@ public class SimplyCommands implements CommandExecutor { sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is now in " + ChatColor.WHITE + split[3] + ChatColor.GREEN + "."); return true; } else if (subcommand.equals("addgroup")) { - if (!checkPerm(sender, "player.addgroup")) return true; + if (split.length == 4 && !checkPerm(sender, "player.addgroup", Arrays.asList(split[3]))) return true; if (split.length != 4) return usage(sender, command, "player addgroup"); String player = split[2].toLowerCase(); String group = split[3]; @@ -343,7 +347,7 @@ public class SimplyCommands implements CommandExecutor { sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is now in " + ChatColor.WHITE + group + ChatColor.GREEN + "."); return true; } else if (subcommand.equals("removegroup")) { - if (!checkPerm(sender, "player.removegroup")) return true; + if (split.length == 4 && !checkPerm(sender, "player.removegroup", Arrays.asList(split[3]))) return true; if (split.length != 4) return usage(sender, command, "player removegroup"); String player = split[2].toLowerCase(); String group = split[3]; @@ -374,7 +378,7 @@ public class SimplyCommands implements CommandExecutor { sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is no longer in config file."); return true; } else if (subcommand.equals("setperm")) { - if (!checkPerm(sender, "player.setperm")) return true; + if (split.length >= 4 && !checkPerm(sender, "player.setperm", Arrays.asList(split[3].split(",")))) return true; if (split.length != 4 && split.length != 5) return usage(sender, command, "player setperm"); String player = split[2].toLowerCase(); String perm = split[3]; @@ -392,7 +396,7 @@ public class SimplyCommands implements CommandExecutor { sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " now has " + ChatColor.WHITE + perm + ChatColor.GREEN + " = " + ChatColor.WHITE + value + ChatColor.GREEN + "."); return true; } else if (subcommand.equals("unsetperm")) { - if (!checkPerm(sender, "player.unsetperm")) return true; + if (split.length >= 4 && !checkPerm(sender, "player.unsetperm", Arrays.asList(split[3].split(",")))) return true; if (split.length != 4) return usage(sender, command, "player unsetperm"); String player = split[2].toLowerCase(); String perm = split[3]; @@ -428,6 +432,27 @@ public class SimplyCommands implements CommandExecutor { return ok; } + private boolean checkPerm(CommandSender sender, String node, List subnodes) { + boolean ok = sender.hasPermission("permissions." + node); + if (!ok) { + for (String subnode : subnodes) { + String testnode = ""; + for (String sub : subnode.split(".")) { + testnode += sub; + if (sender.hasPermission("permissions." + node + "." + testnode)) { + ok = true; + break; + } + } + if (ok) break; + } + } + if (!ok) { + sender.sendMessage(ChatColor.RED + "You do not have permissions to do that."); + } + return ok; + } + private boolean usage(CommandSender sender, Command command) { sender.sendMessage(ChatColor.RED + "[====" + ChatColor.GREEN + " /permissons " + ChatColor.RED + "====]"); for (String line : command.getUsage().split("\\n")) { diff --git a/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java b/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java index cec48f7..9c17582 100755 --- a/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java +++ b/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java @@ -16,6 +16,7 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; +import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.plugin.java.JavaPlugin; @@ -32,13 +33,27 @@ public class SimplyPlugin extends JavaPlugin { // -- Basic stuff @Override public void onEnable() { + // Unregister existing PermissionsBukkit nodes + if (getServer().getPluginManager().isPluginEnabled("PermissionsBukkit")) { + for (Permission perm : getServer().getPluginManager().getPlugin("PermissionsBukkit").getDescription().getPermissions()) { + getServer().getPluginManager().removePermission(perm); + } + } + + // Disable others permissions plugin + for (String permPlugin : getDescription().getSoftDepend()) { + if (getServer().getPluginManager().isPluginEnabled(permPlugin)) { + getServer().getPluginManager().disablePlugin(getServer().getPluginManager().getPlugin(permPlugin)); + } + } + // Take care of configuration configFile = new File(getDataFolder(), "config.yml"); if (!configFile.exists()) { saveDefaultConfig(); } reloadConfig(); - + // Register stuff getCommand("permissions").setExecutor(commandExecutor); getServer().getPluginManager().registerEvents(playerListener, this); @@ -146,7 +161,7 @@ public class SimplyPlugin extends JavaPlugin { } } - protected ConfigurationSection getNode(String node) { + public ConfigurationSection getNode(String node) { for (String entry : getConfig().getKeys(true)) { if (node.equalsIgnoreCase(entry) && getConfig().isConfigurationSection(entry)) { return getConfig().getConfigurationSection(entry); @@ -213,13 +228,14 @@ public class SimplyPlugin extends JavaPlugin { // -- Private stuff private Map calculatePlayerPermissions(String player, String world) { + String default_group = getConfig().getString("default", "default"); if (!config.isPlayerInDB(player)) { - return calculateGroupPermissions("default", world); + return calculateGroupPermissions(default_group, world); } Map perms = new HashMap(); List groups = config.getPlayerGroups(player); - if (groups.isEmpty()) groups.add("default"); + if (groups.isEmpty()) groups.add(default_group); for (Entry entry : config.getPlayerPermissions(player).entrySet()) { perms.put(entry.getKey(), entry.getValue()); diff --git a/net/crystalyx/bukkit/simplyperms/imports/ImportDB.java b/net/crystalyx/bukkit/simplyperms/imports/ImportDB.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/imports/ImportFile.java b/net/crystalyx/bukkit/simplyperms/imports/ImportFile.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/imports/ImportManager.java b/net/crystalyx/bukkit/simplyperms/imports/ImportManager.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/imports/ImportPermBukkit.java b/net/crystalyx/bukkit/simplyperms/imports/ImportPermBukkit.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/imports/ImportPermEx.java b/net/crystalyx/bukkit/simplyperms/imports/ImportPermEx.java new file mode 100644 index 0000000..8e708f0 --- /dev/null +++ b/net/crystalyx/bukkit/simplyperms/imports/ImportPermEx.java @@ -0,0 +1,62 @@ +package net.crystalyx.bukkit.simplyperms.imports; + +import org.bukkit.configuration.file.YamlConfiguration; + +import net.crystalyx.bukkit.simplyperms.SimplyAPI; +import net.crystalyx.bukkit.simplyperms.SimplyPlugin; + +public class ImportPermEx extends SimplyAPI implements ImportManager { + + private SimplyPlugin plugin; + private YamlConfiguration permEx; + + public ImportPermEx(SimplyPlugin plugin) { + super(plugin); + this.plugin = plugin; + this.permEx = new YamlConfiguration(); + } + + @Override + public void run() throws Exception { + try { + permEx.load("plugins/PermissionsEx/config.yml"); + plugin.getConfig().set("debug", permEx.getBoolean("permissions.debug")); + permEx.load("plugins/PermissionsEx/" + permEx.getString("permissions.backends.file.file")); + + for (String player : getKeys(permEx, "users")) { + for (String group : permEx.getStringList("users." + player + ".group")) { + addPlayerGroup(player, group); + } + + for (String perm : permEx.getStringList("users." + player + ".permissions")) { + addPlayerPermission(player, perm.replace("-", ""), !perm.startsWith("-")); + } + + for (String world : getKeys(permEx, "users." + player + ".permissions.worlds")) { + for (String worldperm : permEx.getStringList("users." + player + ".permissions.worlds." + world)) { + addPlayerPermission(player, world, worldperm.replace("-", ""), !worldperm.startsWith("-")); + } + } + } + + for (String group : getKeys(permEx, "groups")) { + for (String perm : permEx.getStringList("groups." + group + ".permissions")) { + addGroupPermission(group, perm.replace("-", ""), !perm.startsWith("-")); + } + + for (String world : getKeys(permEx, "groups." + group + ".permissions.worlds")) { + for (String worldperm : permEx.getStringList("groups." + group + ".permissions.worlds." + world)) { + addGroupPermission(group, world, worldperm.replace("-", ""), !worldperm.startsWith("-")); + } + } + + for (String inherit : permEx.getStringList("groups." + group + ".inheritance")) { + addGroupInheritance(group, inherit); + } + } + } catch (Exception e) { + throw e; + } + } + +} diff --git a/net/crystalyx/bukkit/simplyperms/imports/ImportPrivileges.java b/net/crystalyx/bukkit/simplyperms/imports/ImportPrivileges.java old mode 100755 new mode 100644 index 2308079..9825e3e --- a/net/crystalyx/bukkit/simplyperms/imports/ImportPrivileges.java +++ b/net/crystalyx/bukkit/simplyperms/imports/ImportPrivileges.java @@ -20,7 +20,7 @@ public class ImportPrivileges extends SimplyAPI implements ImportManager { public void run() throws Exception { try { privileges.load("plugins/Privileges/config.yml"); - String defaultGroup = privileges.getString("default_group"); + setDefaultGroup(privileges.getString("default_group")); plugin.getConfig().set("debug", privileges.getBoolean("debug")); privileges.load("plugins/Privileges/users.yml"); @@ -28,32 +28,30 @@ public class ImportPrivileges extends SimplyAPI implements ImportManager { addPlayerGroup(player, privileges.getString("users." + player + ".group")); for (String permission : privileges.getStringList("users." + player + ".permissions")) { - addPlayerPermission(player, permission, !permission.contains("-")); + addPlayerPermission(player, permission.replace("-", ""), !permission.startsWith("-")); } for (String world : getKeys(privileges, "users." + player + ".worlds")) { for (String worldpermission : privileges.getStringList("users." + player + ".worlds." + world)) { - addPlayerPermission(player, world, worldpermission, !worldpermission.contains("-")); + addPlayerPermission(player, world, worldpermission.replace("-", ""), !worldpermission.startsWith("-")); } } } privileges.load("plugins/Privileges/groups.yml"); for (String group : getKeys(privileges, "groups")) { - String simplyGroup = (group.equals(defaultGroup)) ? "default" : group; - for (String permission : privileges.getStringList("groups." + group + ".permissions")) { - addGroupPermission(simplyGroup, permission, !permission.contains("-")); + addGroupPermission(group, permission.replace("-", ""), !permission.startsWith("-")); } for (String world : getKeys(privileges, "groups." + group + ".worlds")) { for (String worldpermission : privileges.getStringList("groups." + group + ".worlds." + world)) { - addGroupPermission(simplyGroup, world, worldpermission, !worldpermission.contains("-")); + addGroupPermission(group, world, worldpermission.replace("-", ""), !worldpermission.startsWith("-")); } } for (String inherit : privileges.getStringList("groups." + group + ".inheritance")) { - addGroupInheritance(simplyGroup, inherit); + addGroupInheritance(group, inherit); } } } catch (Exception e) { diff --git a/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java b/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java index 4978c26..28d8b49 100755 --- a/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java +++ b/net/crystalyx/bukkit/simplyperms/io/ConfigFile.java @@ -35,7 +35,7 @@ public class ConfigFile implements PermsConfig { @Override public void addPlayerGroup(String player, String group) { - if (group.isEmpty() || group.equals("default")) return; + if (group.isEmpty()) return; List groups = getPlayerGroups(player); if (!groups.contains(group)) groups.add(group); plugin.getConfig().set("users/" + player + "/groups", groups); @@ -108,8 +108,8 @@ public class ConfigFile implements PermsConfig { public Map getPlayerPermissions(String player, String world) { Map finalPerms = new HashMap(); String permNode = (!world.isEmpty()) ? "users/" + player + "/worlds/" + world : "users/" + player + "/permissions"; - if (plugin.getConfig().getConfigurationSection(permNode) != null) { - for (Entry permPlayer : plugin.getConfig().getConfigurationSection(permNode).getValues(false).entrySet()) { + if (plugin.getNode(permNode) != null) { + for (Entry permPlayer : plugin.getNode(permNode).getValues(false).entrySet()) { finalPerms.put(permPlayer.getKey(), (Boolean) permPlayer.getValue()); } } @@ -118,13 +118,13 @@ public class ConfigFile implements PermsConfig { @Override public boolean isPlayerInDB(String player) { - return plugin.getConfig().getConfigurationSection("users/" + player) != null; + return plugin.getNode("users/" + player) != null; } @Override public List getPlayerWorlds(String player) { - if (plugin.getConfig().getConfigurationSection("users/" + player + "/worlds") != null) { - return new ArrayList(plugin.getConfig().getConfigurationSection("users/" + player + "/worlds").getKeys(false)); + if (plugin.getNode("users/" + player + "/worlds") != null) { + return new ArrayList(plugin.getNode("users/" + player + "/worlds").getKeys(false)); } else { return new ArrayList(); @@ -133,8 +133,8 @@ public class ConfigFile implements PermsConfig { @Override public List getAllPlayers() { - if (plugin.getConfig().getConfigurationSection("users") != null) { - return new ArrayList(plugin.getConfig().getConfigurationSection("users").getKeys(false)); + if (plugin.getNode("users") != null) { + return new ArrayList(plugin.getNode("users").getKeys(false)); } else { return new ArrayList(); diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Bow.java b/net/crystalyx/bukkit/simplyperms/preventions/Bow.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Changesign.java b/net/crystalyx/bukkit/simplyperms/preventions/Changesign.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Chat.java b/net/crystalyx/bukkit/simplyperms/preventions/Chat.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Command.java b/net/crystalyx/bukkit/simplyperms/preventions/Command.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Damage.java b/net/crystalyx/bukkit/simplyperms/preventions/Damage.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Fight.java b/net/crystalyx/bukkit/simplyperms/preventions/Fight.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Hunger.java b/net/crystalyx/bukkit/simplyperms/preventions/Hunger.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Item.java b/net/crystalyx/bukkit/simplyperms/preventions/Item.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Monster.java b/net/crystalyx/bukkit/simplyperms/preventions/Monster.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Sneak.java b/net/crystalyx/bukkit/simplyperms/preventions/Sneak.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/Vehicle.java b/net/crystalyx/bukkit/simplyperms/preventions/Vehicle.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/animals/Shear.java b/net/crystalyx/bukkit/simplyperms/preventions/animals/Shear.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/animals/Tame.java b/net/crystalyx/bukkit/simplyperms/preventions/animals/Tame.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/bucket/Lavabucket.java b/net/crystalyx/bukkit/simplyperms/preventions/bucket/Lavabucket.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/bucket/Milking.java b/net/crystalyx/bukkit/simplyperms/preventions/bucket/Milking.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/bucket/Waterbucket.java b/net/crystalyx/bukkit/simplyperms/preventions/bucket/Waterbucket.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/build/Breakblock.java b/net/crystalyx/bukkit/simplyperms/preventions/build/Breakblock.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/build/Placeblock.java b/net/crystalyx/bukkit/simplyperms/preventions/build/Placeblock.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/craft/Brew.java b/net/crystalyx/bukkit/simplyperms/preventions/craft/Brew.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/craft/Chest.java b/net/crystalyx/bukkit/simplyperms/preventions/craft/Chest.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/craft/Dispenser.java b/net/crystalyx/bukkit/simplyperms/preventions/craft/Dispenser.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/craft/Enchant.java b/net/crystalyx/bukkit/simplyperms/preventions/craft/Enchant.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/craft/Furnace.java b/net/crystalyx/bukkit/simplyperms/preventions/craft/Furnace.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/craft/Workbench.java b/net/crystalyx/bukkit/simplyperms/preventions/craft/Workbench.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/fire/Fireball.java b/net/crystalyx/bukkit/simplyperms/preventions/fire/Fireball.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/fire/FlintAndSteel.java b/net/crystalyx/bukkit/simplyperms/preventions/fire/FlintAndSteel.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Bed.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Bed.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Button.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Button.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Cake.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Cake.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Door.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Door.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Fish.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Fish.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Jukebox.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Jukebox.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Lever.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Lever.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Noteblock.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Noteblock.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Pressureplate.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Pressureplate.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/interact/Repeater.java b/net/crystalyx/bukkit/simplyperms/preventions/interact/Repeater.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/loot/Drop.java b/net/crystalyx/bukkit/simplyperms/preventions/loot/Drop.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/loot/Pickup.java b/net/crystalyx/bukkit/simplyperms/preventions/loot/Pickup.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/projectile/Egg.java b/net/crystalyx/bukkit/simplyperms/preventions/projectile/Egg.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/projectile/Potion.java b/net/crystalyx/bukkit/simplyperms/preventions/projectile/Potion.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/projectile/Snowball.java b/net/crystalyx/bukkit/simplyperms/preventions/projectile/Snowball.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/spam/CapsLock.java b/net/crystalyx/bukkit/simplyperms/preventions/spam/CapsLock.java old mode 100755 new mode 100644 diff --git a/net/crystalyx/bukkit/simplyperms/preventions/spam/Flood.java b/net/crystalyx/bukkit/simplyperms/preventions/spam/Flood.java old mode 100755 new mode 100644 diff --git a/plugin.yml b/plugin.yml old mode 100755 new mode 100644 index 87b75a3..6555312 --- a/plugin.yml +++ b/plugin.yml @@ -2,7 +2,8 @@ name: SimplyPerms main: net.crystalyx.bukkit.simplyperms.SimplyPlugin author: Xefir Destiny website: http://www.crystalyx.net/ -version: 1.6.1 +version: 1.6.2 +softdepend: [ PermissionsBukkit, Privileges, GroupManager, PermissionsEx, bPermissions, zPermissions ] commands: permissions: aliases: [ perms, perm, p ]