summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--EssentialsGroupManager/src/Changelog.txt5
-rw-r--r--EssentialsGroupManager/src/globalgroups.yml6
-rw-r--r--EssentialsGroupManager/src/groups.yml2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java86
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java7
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java8
-rw-r--r--EssentialsGroupManager/src/plugin.yml2
8 files changed, 74 insertions, 44 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 9d7187690..b8b05c1b4 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -146,4 +146,7 @@ v 1.9:
- Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
- Prevent promoting players to, and demoting to GlobalGroups.
- - Make 'manload' reload the config correctly. \ No newline at end of file
+ - Make 'manload' reload the config correctly.
+ - Minor optimization when checking bukkit permissions.
+ - Better reporting when a users.yml is failing to load.
+ - Expanded '/manuadd'to accept an optional variable for the world (eg '/manuadd <player> <group> <world>'). \ No newline at end of file
diff --git a/EssentialsGroupManager/src/globalgroups.yml b/EssentialsGroupManager/src/globalgroups.yml
index f21034237..e199622ee 100644
--- a/EssentialsGroupManager/src/globalgroups.yml
+++ b/EssentialsGroupManager/src/globalgroups.yml
@@ -181,11 +181,13 @@ groups:
- towny.nation.*
- towny.chat.tc
- towny.chat.nc
- - towny.wild.block.6.*
+ - towny.wild.block.6.build
+ - towny.wild.block.6.destroy
- towny.wild.block.14.destroy
- towny.wild.block.15.destroy
- towny.wild.block.16.destroy
- - towny.wild.block.17.*
+ - towny.wild.block.17.build
+ - towny.wild.block.17.destroy
- towny.wild.block.18.destroy
- towny.wild.block.21.destroy
- towny.wild.block.31.destroy
diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml
index e50054c9f..ec8b0422f 100644
--- a/EssentialsGroupManager/src/groups.yml
+++ b/EssentialsGroupManager/src/groups.yml
@@ -24,7 +24,7 @@ groups:
inheritance:
- default
- g:essentials_builder
- - g:towny_moderator
+ - g:towny_builder
info:
prefix: '&2'
build: true
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 00c71a41e..eaa945f5d 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -374,16 +374,16 @@ public class GroupManager extends JavaPlugin {
if (isConsole || playerCanDo) {
switch (execCmd) {
case manuadd:
- // VALIDANDO ESTADO DO SENDER
- if (dataHolder == null || permissionHandler == null) {
- if (!setDefaultWorldHandler(sender))
- return true;
- }
+
// VALIDANDO ARGUMENTOS
- if (args.length != 2) {
- sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)");
+ if ((args.length != 2) && (args.length != 3)) {
+ sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group> | optional [world])");
return false;
}
+ // Select the relevant world
+ dataHolder = worldsHolder.getWorldData((args.length == 3)? args[2]:Bukkit.getWorlds().get(0).getName());
+ permissionHandler = dataHolder.getPermissionsHandler();
+
if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {
return false;
}
@@ -420,14 +420,10 @@ public class GroupManager extends JavaPlugin {
// PARECE OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
- sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "'.");
-
- //targetPlayer = this.getServer().getPlayer(auxUser.getName());
- //if (targetPlayer != null)
- // BukkitPermissions.updatePermissions(targetPlayer);
+ sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'.");
return true;
- // break;
+
case manudel:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -463,6 +459,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updatePermissions(targetPlayer);
return true;
+
case manuaddsub:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -502,11 +499,8 @@ public class GroupManager extends JavaPlugin {
else
sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getName() + "'.");
- //targetPlayer = this.getServer().getPlayer(auxUser.getName());
- //if (targetPlayer != null)
- // BukkitPermissions.updatePermissions(targetPlayer);
-
return true;
+
case manudelsub:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -547,6 +541,7 @@ public class GroupManager extends JavaPlugin {
// BukkitPermissions.updatePermissions(targetPlayer);
return true;
+
case mangadd:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -568,6 +563,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "You created a group named: " + auxGroup.getName());
return true;
+
case mangdel:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -591,6 +587,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updateAllPlayers();
return true;
+
case manuaddp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -655,7 +652,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updatePermissions(targetPlayer);
return true;
- // break;
+
case manudelp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -706,7 +703,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updatePermissions(targetPlayer);
return true;
- // break;
+
case manulistp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -771,6 +768,7 @@ public class GroupManager extends JavaPlugin {
}
return true;
+
case manucheckp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -825,6 +823,7 @@ public class GroupManager extends JavaPlugin {
}
return true;
+
case mangaddp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -879,6 +878,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updateAllPlayers();
return true;
+
case mangdelp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -919,6 +919,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updateAllPlayers();
return true;
+
case manglistp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -967,6 +968,7 @@ public class GroupManager extends JavaPlugin {
}
return true;
+
case mangcheckp:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1002,6 +1004,7 @@ public class GroupManager extends JavaPlugin {
}
return true;
+
case mangaddi:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1040,6 +1043,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updateAllPlayers();
return true;
+
case mangdeli:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1082,6 +1086,7 @@ public class GroupManager extends JavaPlugin {
BukkitPermissions.updateAllPlayers();
return true;
+
case manuaddv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1113,7 +1118,9 @@ public class GroupManager extends JavaPlugin {
}
auxUser.getVariables().addVar(args[1], Variables.parseVariableValue(auxString));
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the user " + auxUser.getName());
+
return true;
+
case manudelv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1141,7 +1148,9 @@ public class GroupManager extends JavaPlugin {
// PARECE OK
auxUser.getVariables().removeVar(args[1]);
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the user " + ChatColor.GREEN + auxUser.getName());
+
return true;
+
case manulistv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1174,7 +1183,9 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getName() + ": ");
sender.sendMessage(auxString + ".");
sender.sendMessage(ChatColor.YELLOW + "Plus all variables from group: " + auxUser.getGroupName());
+
return true;
+
case manucheckv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1219,7 +1230,9 @@ public class GroupManager extends JavaPlugin {
if (!auxGroup.equals(auxGroup2)) {
sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName());
}
+
return true;
+
case mangaddv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1253,6 +1266,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the group " + auxGroup.getName());
return true;
+
case mangdelv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1282,6 +1296,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the group " + ChatColor.GREEN + auxGroup.getName());
return true;
+
case manglistv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1322,7 +1337,9 @@ public class GroupManager extends JavaPlugin {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
sender.sendMessage(ChatColor.YELLOW + "Plus all variables from groups: " + auxString);
}
+
return true;
+
case mangcheckv:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1353,7 +1370,9 @@ public class GroupManager extends JavaPlugin {
if (!auxGroup.equals(auxGroup2)) {
sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName());
}
+
return true;
+
case manwhois:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1383,7 +1402,7 @@ public class GroupManager extends JavaPlugin {
}
// victim.permissions.add(args[1]);
return true;
- // break;
+
case tempadd:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1417,7 +1436,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Player overloaded!");
return true;
- // break;
+
case tempdel:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1453,7 +1472,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "You removed that player overload. He's back to normal!");
return true;
- // break;
+
case templist:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1482,7 +1501,9 @@ public class GroupManager extends JavaPlugin {
}
overloadedUsers.get(dataHolder.getName().toLowerCase()).removeAll(removeList);
sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode: " + ChatColor.WHITE + auxString);
+
return true;
+
case tempdelall:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1509,6 +1530,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode. Now they are normal again.");
return true;
+
case mansave:
boolean forced = false;
@@ -1583,7 +1605,9 @@ public class GroupManager extends JavaPlugin {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
}
sender.sendMessage(ChatColor.YELLOW + " Groups Available: " + ChatColor.WHITE + auxString);
+
return true;
+
case manpromote:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1638,12 +1662,8 @@ public class GroupManager extends JavaPlugin {
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
- //targetPlayer = this.getServer().getPlayer(auxUser.getName());
- //if (targetPlayer != null)
- // BukkitPermissions.updatePermissions(targetPlayer);
-
return true;
- // break;
+
case mandemote:
// VALIDANDO ESTADO DO SENDER
if (dataHolder == null || permissionHandler == null) {
@@ -1698,12 +1718,8 @@ public class GroupManager extends JavaPlugin {
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
- //targetPlayer = this.getServer().getPlayer(auxUser.getName());
- //if (targetPlayer != null)
- // BukkitPermissions.updatePermissions(targetPlayer);
-
return true;
- // break;
+
case mantogglevalidate:
validateOnlinePlayer = !validateOnlinePlayer;
sender.sendMessage(ChatColor.YELLOW + "Validade if player is online, now set to: " + Boolean.toString(validateOnlinePlayer));
@@ -1734,7 +1750,9 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Your world now uses permissions of world name: '" + dataHolder.getName() + "' ");
}
}
+
return true;
+
case manselect:
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <world>)");
@@ -1765,7 +1783,9 @@ public class GroupManager extends JavaPlugin {
permissionHandler = dataHolder.getPermissionsHandler();
selectedWorlds.put(sender, dataHolder.getName());
sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'.");
+
return true;
+
case manclear:
if (args.length != 0) {
sender.sendMessage(ChatColor.RED + "Review your arguments count!");
@@ -1773,7 +1793,9 @@ public class GroupManager extends JavaPlugin {
}
selectedWorlds.remove(sender);
sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible).");
+
return true;
+
default:
break;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
index 396240ec6..56ef7e870 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
@@ -52,7 +52,7 @@ public class Group extends DataUnit implements Cloneable {
/**
* Is this a GlobalGroup
*
- * @return
+ * @return true if this is a global group
*/
public boolean isGlobal() {
return (getDataSource() == null);
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index e766b6c78..a01381fcd 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -602,7 +602,12 @@ public class WorldDataHolder {
// Load users if the file is NOT empty
if (allUsersNode != null)
for (String usersKey : allUsersNode.keySet()) {
- Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
+ Map<String, Object> thisUserNode = null;
+ try {
+ thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
+ } catch (Exception ex) {
+ throw new IllegalArgumentException("Bad format found in file: " + usersFile.getPath());
+ }
User thisUser = ph.createUser(usersKey);
if (thisUser == null) {
throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath());
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
index bd2829f38..6b6ae58ea 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
@@ -17,9 +17,7 @@ import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type;
-import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
-import org.bukkit.permissions.Permission;
/**
* Everything here maintains the model created by Nijikokun
@@ -767,9 +765,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
// Check Bukkit perms to support plugins which add perms via code
// (Heroes).
final Player player = user.getBukkitPlayer();
- final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission);
- if (player != null && bukkitPerm != null) {
- result.resultType = player.hasPermission(bukkitPerm) ? PermissionCheckResult.Type.FOUND : PermissionCheckResult.Type.NEGATION;
+ //final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission);
+ if ((player != null) && player.hasPermission(targetPermission)) {
+ result.resultType = PermissionCheckResult.Type.FOUND;
result.owner = user;
return result;
}
diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml
index 65a5d4e95..bf42a08c3 100644
--- a/EssentialsGroupManager/src/plugin.yml
+++ b/EssentialsGroupManager/src/plugin.yml
@@ -10,7 +10,7 @@ authors:
commands:
manuadd:
description: Move a player to desired group.(Adds to the file if not exists)
- usage: /<command> <player> <group>
+ usage: /<command> <player> <group> | optional [world]
permissions: groupmanager.manuadd
manudel:
description: Remove any user specific configuration. Make him default group.