summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2012-01-29 10:54:24 +0000
committerElgarL <ElgarL@palmergames.com>2012-01-29 10:54:24 +0000
commit95885e46c9f207a0c06f595fef0dbc56c7f5b59c (patch)
tree3ff22f6605fe211fb23ccd19ecf6b788cbaa57dd /EssentialsGroupManager
parent3deff2afe7b225337bd03d23022c4f4e9df8c0c9 (diff)
downloadEssentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar
Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar.gz
Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar.lz
Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar.xz
Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.zip
Fix players retaining permissions when demoted.
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/.project10
-rw-r--r--EssentialsGroupManager/src/Changelog.txt3
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java31
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java15
4 files changed, 34 insertions, 25 deletions
diff --git a/EssentialsGroupManager/.project b/EssentialsGroupManager/.project
index 6ad74b347..c0e5a6f5e 100644
--- a/EssentialsGroupManager/.project
+++ b/EssentialsGroupManager/.project
@@ -10,6 +10,16 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/GroupManager.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 127346f82..41b5613af 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -124,4 +124,5 @@ v 1.9:
- Trap errors in fetching the mirrors map.
- Fixed an infinite loop error when using '/manudel' on a logged in player. It caused setDefaultGroup to trigger a bukkit update when no GM User existed yet.
- do not allow inherited permissions to negate higher perms.
- - Fixed a bug when pushing superperms in the wrong order. \ No newline at end of file
+ - Fixed a bug when pushing superperms in the wrong order.
+ - Fix players retaining permissions when demoted. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index c0ed77adc..43b764faf 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -415,9 +415,9 @@ public class GroupManager extends JavaPlugin {
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);
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
return true;
// break;
@@ -450,6 +450,7 @@ public class GroupManager extends JavaPlugin {
dataHolder.removeUser(auxUser.getName());
sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' to default settings.");
+ // If the player is online, this will create new data for the user.
targetPlayer = this.getServer().getPlayer(auxUser.getName());
if (targetPlayer != null)
BukkitPermissions.updatePermissions(targetPlayer);
@@ -494,9 +495,9 @@ 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);
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
return true;
case manudelsub:
@@ -534,9 +535,9 @@ public class GroupManager extends JavaPlugin {
auxUser.removeSubGroup(auxGroup);
sender.sendMessage(ChatColor.YELLOW + "You removed subgroup '" + auxGroup.getName() + "' from player '" + auxUser.getName() + "' list.");
- targetPlayer = this.getServer().getPlayer(auxUser.getName());
- if (targetPlayer != null)
- BukkitPermissions.updatePermissions(targetPlayer);
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
return true;
case mangadd:
@@ -1614,9 +1615,9 @@ 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);
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
return true;
// break;
@@ -1670,9 +1671,9 @@ 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);
+ //targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ //if (targetPlayer != null)
+ // BukkitPermissions.updatePermissions(targetPlayer);
return true;
// break;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
index 396b49583..d1193510e 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -28,7 +28,6 @@ import java.util.Map;
import java.util.Set;
import org.anjocaido.groupmanager.GroupManager;
-import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -136,33 +135,30 @@ public class BukkitPermissions {
}
PermissionAttachment attachment;
+
// Find the players current attachment, or add a new one.
if (this.attachments.containsKey(player)) {
attachment = this.attachments.get(player);
} else {
attachment = player.addAttachment(plugin);
- this.attachments.put(player, attachment);;
+ this.attachments.put(player, attachment);
}
if (world == null) {
world = player.getWorld().getName();
}
- OverloadedWorldHolder worldData = plugin.getWorldsHolder().getWorldData(world);
- Boolean value = false;
-
// Add all permissions for this player (GM only)
// child nodes will be calculated by Bukkit.
- List<String> playerPermArray = new ArrayList<String>(worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName(), false));
+ List<String> playerPermArray = new ArrayList<String>(plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getAllPlayersPermissions(player.getName(), false));
LinkedHashMap<String, Boolean> newPerms = new LinkedHashMap<String, Boolean>();
// Sort the perm list by parent/child, so it will push to superperms correctly.
playerPermArray = sort(playerPermArray);
-
+ Boolean value = false;
for (String permission : playerPermArray) {
value = (!permission.startsWith("-"));
-
newPerms.put((value? permission : permission.substring(1)), value);
}
@@ -178,7 +174,8 @@ public class BukkitPermissions {
// Then whack our map into there
orig.putAll(newPerms);
// That's all folks!
- attachment.getPermissible().recalculatePermissions();
+ //attachment.getPermissible().recalculatePermissions();
+ player.recalculatePermissions();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {