summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElgarL <ElgarL@Palmergames.com>2014-04-14 22:19:14 +0100
committerKHobbits <rob@khobbits.co.uk>2014-05-04 12:50:17 +0100
commit9739784e7501c906dec19bb169e762a5313df213 (patch)
treee86e4da79a758ff5d33067c3a364eee719fab46d
parenta0e93af758b8f31e30b86b4062734e82492f8491 (diff)
downloadEssentials-9739784e7501c906dec19bb169e762a5313df213.tar
Essentials-9739784e7501c906dec19bb169e762a5313df213.tar.gz
Essentials-9739784e7501c906dec19bb169e762a5313df213.tar.lz
Essentials-9739784e7501c906dec19bb169e762a5313df213.tar.xz
Essentials-9739784e7501c906dec19bb169e762a5313df213.zip
v2.1: - Update for CraftBukkit 1.7.8-R0.1(3050). - Add UUID support. Plugins can still query by player name but a UUID is faster and preferable.
-rw-r--r--EssentialsGroupManager/src/Changelog.txt6
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java106
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java41
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java8
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java45
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java65
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java137
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java9
9 files changed, 284 insertions, 135 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 7a7aa45b4..f01b2261c 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -223,4 +223,8 @@ v 2.0:
- Check subgroup permissions with an equal priority so no one subgroup is higher ranked than another.
- add recursive permission adding/deleting
- Prevent adding sub groups for ranks the granting player doesn't have access to.
- - Allow Exceptions in any inherited group to override negation of permissions. \ No newline at end of file
+ - Allow Exceptions in any inherited group to override negation of permissions.
+v2.1:
+ - Update for CraftBukkit 1.7.8-R0.1(3050).
+ - Add UUID support.
+ Plugins can still query by player name but a UUID is faster and preferable. \ 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 aa7bae338..81eb3064f 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -522,7 +522,7 @@ public class GroupManager extends JavaPlugin {
}
// Validating permissions
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "Can't modify a player with the same permissions as you, or higher.");
return true;
}
@@ -530,7 +530,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
return true;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getLastName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getLastName(), auxGroup.getName()))) {
sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
return true;
}
@@ -538,7 +538,7 @@ public class GroupManager extends JavaPlugin {
// Seems OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
- sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'.");
+ sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getLastName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'.");
return true;
@@ -563,16 +563,16 @@ public class GroupManager extends JavaPlugin {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return true;
}
// Seems OK
- dataHolder.removeUser(auxUser.getName());
- sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' to default settings.");
+ dataHolder.removeUser(auxUser.getLastName());
+ sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getLastName() + "' to default settings.");
// If the player is online, this will create new data for the user.
- targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ targetPlayer = this.getServer().getPlayer(auxUser.getLastName());
if (targetPlayer != null)
BukkitPermissions.updatePermissions(targetPlayer);
@@ -607,7 +607,7 @@ public class GroupManager extends JavaPlugin {
return true;
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return true;
}
@@ -615,15 +615,15 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "The sub-group can't be the same as yours, or higher.");
return true;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getLastName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getLastName(), auxGroup.getName()))) {
sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
return true;
}
// Seems OK
if (auxUser.addSubGroup(auxGroup))
- sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getName() + "'.");
+ sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getLastName() + "'.");
else
- sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getName() + "'.");
+ sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getLastName() + "'.");
return true;
@@ -654,13 +654,13 @@ public class GroupManager extends JavaPlugin {
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return true;
}
// Seems OK
auxUser.removeSubGroup(auxGroup);
- sender.sendMessage(ChatColor.YELLOW + "You removed subgroup '" + auxGroup.getName() + "' from player '" + auxUser.getName() + "' list.");
+ sender.sendMessage(ChatColor.YELLOW + "You removed subgroup '" + auxGroup.getName() + "' from player '" + auxUser.getLastName() + "' list.");
// targetPlayer = this.getServer().getPlayer(auxUser.getName());
// if (targetPlayer != null)
@@ -737,7 +737,7 @@ public class GroupManager extends JavaPlugin {
}
// Validating your permissions
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher.");
return true;
}
@@ -759,11 +759,11 @@ public class GroupManager extends JavaPlugin {
}
// Seems Ok
auxUser.addPermission(auxString);
- sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to player '" + auxUser.getName() + "' permissions.");
+ sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to player '" + auxUser.getLastName() + "' permissions.");
}
- targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ targetPlayer = this.getServer().getPlayer(auxUser.getLastName());
if (targetPlayer != null)
BukkitPermissions.updatePermissions(targetPlayer);
@@ -795,7 +795,7 @@ public class GroupManager extends JavaPlugin {
{
auxString = args[i].replace("'", "");
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher.");
continue;
}
@@ -817,11 +817,11 @@ public class GroupManager extends JavaPlugin {
continue;
}
auxUser.removePermission(auxString);
- sender.sendMessage(ChatColor.YELLOW + "You removed '" + auxString + "' from player '" + auxUser.getName() + "' permissions.");
+ sender.sendMessage(ChatColor.YELLOW + "You removed '" + auxString + "' from player '" + auxUser.getLastName() + "' permissions.");
}
// Seems OK
- targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ targetPlayer = this.getServer().getPlayer(auxUser.getLastName());
if (targetPlayer != null)
BukkitPermissions.updatePermissions(targetPlayer);
@@ -849,7 +849,7 @@ public class GroupManager extends JavaPlugin {
auxUser = dataHolder.getUser(args[0]);
}
// Validating your permissions
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher.");
return true;
}
@@ -863,9 +863,9 @@ public class GroupManager extends JavaPlugin {
auxUser.removePermission(perm);
}
}
- sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from player '" + auxUser.getName() + "'.");
+ sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from player '" + auxUser.getLastName() + "'.");
- targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ targetPlayer = this.getServer().getPlayer(auxUser.getLastName());
if (targetPlayer != null)
BukkitPermissions.updatePermissions(targetPlayer);
@@ -900,7 +900,7 @@ public class GroupManager extends JavaPlugin {
}
if (auxString.lastIndexOf(",") > 0) {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
- sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getName() + "' has following permissions: " + ChatColor.WHITE + auxString);
+ sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getLastName() + "' has following permissions: " + ChatColor.WHITE + auxString);
sender.sendMessage(ChatColor.YELLOW + "And all permissions from group: " + auxUser.getGroupName());
auxString = "";
for (String subGroup : auxUser.subGroupListStringCopy()) {
@@ -911,7 +911,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString);
}
} else {
- sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getName() + "' has no specific permissions.");
+ sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getLastName() + "' has no specific permissions.");
sender.sendMessage(ChatColor.YELLOW + "Only all permissions from group: " + auxUser.getGroupName());
auxString = "";
for (String subGroup : auxUser.subGroupListStringCopy()) {
@@ -925,7 +925,7 @@ public class GroupManager extends JavaPlugin {
// bukkit perms
if ((args.length == 2) && (args[1].equalsIgnoreCase("+"))) {
- targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ targetPlayer = this.getServer().getPlayer(auxUser.getLastName());
if (targetPlayer != null) {
sender.sendMessage(ChatColor.YELLOW + "Superperms reports: ");
for (String line : BukkitPermissions.listPerms(targetPlayer))
@@ -959,7 +959,7 @@ public class GroupManager extends JavaPlugin {
} else {
auxUser = dataHolder.getUser(args[0]);
}
- targetPlayer = this.getServer().getPlayer(auxUser.getName());
+ targetPlayer = this.getServer().getPlayer(auxUser.getLastName());
// Validating permission
permissionResult = permissionHandler.checkFullGMPermission(auxUser, auxString, false);
@@ -980,11 +980,11 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
} else if (permissionResult.owner instanceof Group) {
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
- sender.sendMessage(ChatColor.YELLOW + "The user inherits a negation permission from group: " + permissionResult.owner.getName());
+ sender.sendMessage(ChatColor.YELLOW + "The user inherits a negation permission from group: " + permissionResult.owner.getLastName());
} else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
- sender.sendMessage(ChatColor.YELLOW + "The user inherits an Exception permission from group: " + permissionResult.owner.getName());
+ sender.sendMessage(ChatColor.YELLOW + "The user inherits an Exception permission from group: " + permissionResult.owner.getLastName());
} else {
- sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getName());
+ sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getLastName());
}
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
}
@@ -1203,11 +1203,11 @@ public class GroupManager extends JavaPlugin {
// auxString = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);
if (permissionResult.owner instanceof Group) {
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
- sender.sendMessage(ChatColor.YELLOW + "The group inherits the negation permission from group: " + permissionResult.owner.getName());
+ sender.sendMessage(ChatColor.YELLOW + "The group inherits the negation permission from group: " + permissionResult.owner.getLastName());
} else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {
- sender.sendMessage(ChatColor.YELLOW + "The group inherits an Exception permission from group: " + permissionResult.owner.getName());
+ sender.sendMessage(ChatColor.YELLOW + "The group inherits an Exception permission from group: " + permissionResult.owner.getLastName());
} else {
- sender.sendMessage(ChatColor.YELLOW + "The group inherits the permission from group: " + permissionResult.owner.getName());
+ sender.sendMessage(ChatColor.YELLOW + "The group inherits the permission from group: " + permissionResult.owner.getLastName());
}
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
@@ -1327,7 +1327,7 @@ public class GroupManager extends JavaPlugin {
}
auxString = auxString.replace("'", "");
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());
+ sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the user " + auxUser.getLastName());
return true;
@@ -1358,7 +1358,7 @@ public class GroupManager extends JavaPlugin {
}
// Seems 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());
+ sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the user " + ChatColor.GREEN + auxUser.getLastName());
return true;
@@ -1391,7 +1391,7 @@ public class GroupManager extends JavaPlugin {
if (auxString.lastIndexOf(",") > 0) {
auxString = auxString.substring(0, auxString.lastIndexOf(","));
}
- sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getName() + ": ");
+ sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getLastName() + ": ");
sender.sendMessage(auxString + ".");
sender.sendMessage(ChatColor.YELLOW + "Plus all variables from group: " + auxUser.getGroupName());
@@ -1608,7 +1608,7 @@ public class GroupManager extends JavaPlugin {
auxUser = dataHolder.getUser(args[0]);
}
// Seems OK
- sender.sendMessage(ChatColor.YELLOW + "Name: " + ChatColor.GREEN + auxUser.getName());
+ sender.sendMessage(ChatColor.YELLOW + "Name: " + ChatColor.GREEN + auxUser.getLastName());
sender.sendMessage(ChatColor.YELLOW + "Group: " + ChatColor.GREEN + auxUser.getGroup().getName());
// Compile a list of subgroups
auxString = "";
@@ -1620,8 +1620,8 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "subgroups: " + auxString);
}
- sender.sendMessage(ChatColor.YELLOW + "Overloaded: " + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getName()));
- auxGroup = dataHolder.surpassOverload(auxUser.getName()).getGroup();
+ sender.sendMessage(ChatColor.YELLOW + "Overloaded: " + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getLastName()));
+ auxGroup = dataHolder.surpassOverload(auxUser.getLastName()).getGroup();
if (!auxGroup.equals(auxUser.getGroup())) {
sender.sendMessage(ChatColor.YELLOW + "Original Group: " + ChatColor.GREEN + auxGroup.getName());
}
@@ -1648,7 +1648,7 @@ public class GroupManager extends JavaPlugin {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
return true;
}
@@ -1656,8 +1656,8 @@ public class GroupManager extends JavaPlugin {
if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
- dataHolder.overloadUser(auxUser.getName());
- overloadedUsers.get(dataHolder.getName().toLowerCase()).add(dataHolder.getUser(auxUser.getName()));
+ dataHolder.overloadUser(auxUser.getLastName());
+ overloadedUsers.get(dataHolder.getName().toLowerCase()).add(dataHolder.getUser(auxUser.getLastName()));
sender.sendMessage(ChatColor.YELLOW + "Player set to overload mode!");
return true;
@@ -1682,7 +1682,7 @@ public class GroupManager extends JavaPlugin {
auxUser = dataHolder.getUser(args[0]);
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return true;
}
@@ -1690,7 +1690,7 @@ public class GroupManager extends JavaPlugin {
if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {
overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());
}
- dataHolder.removeOverload(auxUser.getName());
+ dataHolder.removeOverload(auxUser.getLastName());
if (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser)) {
overloadedUsers.get(dataHolder.getName().toLowerCase()).remove(auxUser);
}
@@ -1709,10 +1709,10 @@ public class GroupManager extends JavaPlugin {
removeList = new ArrayList<User>();
count = 0;
for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) {
- if (!dataHolder.isOverloaded(u.getName())) {
+ if (!dataHolder.isOverloaded(u.getLastName())) {
removeList.add(u);
} else {
- auxString += u.getName() + ", ";
+ auxString += u.getLastName() + ", ";
count++;
}
}
@@ -1739,8 +1739,8 @@ public class GroupManager extends JavaPlugin {
removeList = new ArrayList<User>();
count = 0;
for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) {
- if (dataHolder.isOverloaded(u.getName())) {
- dataHolder.removeOverload(u.getName());
+ if (dataHolder.isOverloaded(u.getLastName())) {
+ dataHolder.removeOverload(u.getLastName());
count++;
}
}
@@ -1880,7 +1880,7 @@ public class GroupManager extends JavaPlugin {
return true;
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return true;
}
@@ -1888,7 +1888,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
return true;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getLastName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getLastName(), auxGroup.getName()))) {
sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
return true;
}
@@ -1903,7 +1903,7 @@ public class GroupManager extends JavaPlugin {
// Seems OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
- sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
+ sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getLastName() + " group to " + auxGroup.getName() + ".");
return true;
@@ -1936,7 +1936,7 @@ public class GroupManager extends JavaPlugin {
return true;
}
// Validating permission
- if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
+ if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getLastName(), senderGroup.getName()) : false)) {
sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher.");
return true;
}
@@ -1944,7 +1944,7 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
return true;
}
- if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
+ if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getLastName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getLastName(), auxGroup.getName()))) {
sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit.");
return true;
}
@@ -1959,7 +1959,7 @@ public class GroupManager extends JavaPlugin {
// Seems OK
auxUser.setGroup(auxGroup);
if (!sender.hasPermission("groupmanager.notify.other") || (isConsole))
- sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + ".");
+ sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getLastName() + " group to " + auxGroup.getName() + ".");
return true;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
index 48d0e55e9..36c26bb1d 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java
@@ -19,19 +19,20 @@ import org.anjocaido.groupmanager.utils.StringPermissionComparator;
public abstract class DataUnit {
private WorldDataHolder dataSource;
- private String name;
+ private String uUID;
+ private String lastName;
private boolean changed, sorted = false;
private List<String> permissions = Collections.unmodifiableList(Collections.<String>emptyList());
public DataUnit(WorldDataHolder dataSource, String name) {
this.dataSource = dataSource;
- this.name = name;
+ this.uUID = name;
}
public DataUnit(String name) {
- this.name = name;
+ this.uUID = name;
}
/**
@@ -45,7 +46,7 @@ public abstract class DataUnit {
if (o instanceof DataUnit) {
DataUnit go = (DataUnit) o;
- if (this.getName().equalsIgnoreCase(go.getName())) {
+ if (this.getUUID().equalsIgnoreCase(go.getUUID())) {
// Global Group match.
if (this.dataSource == null && go.getDataSource() == null)
return true;
@@ -67,7 +68,7 @@ public abstract class DataUnit {
public int hashCode() {
int hash = 5;
- hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0);
+ hash = 71 * hash + (this.uUID != null ? this.uUID.toLowerCase().hashCode() : 0);
return hash;
}
@@ -90,13 +91,29 @@ public abstract class DataUnit {
return dataSource;
}
+
+ public String getUUID() {
- /**
- * @return the name
- */
- public String getName() {
+ return uUID;
+ }
+
+ public String getLastName() {
- return name;
+ if (uUID.length() < 36)
+ return uUID;
+
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+
+ if (!this.lastName.equals(lastName)) {
+
+ this.lastName = lastName;
+ changed = true;
+
+ }
+
}
public void flagAsChanged() {
@@ -109,7 +126,7 @@ public abstract class DataUnit {
else
source = testSource.getName();
- GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as changed!");
+ GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getUUID() + " flagged as changed!");
// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
// GroupManager.logger.finest(st.toString());
// }
@@ -132,7 +149,7 @@ public abstract class DataUnit {
else
source = testSource.getName();
- GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as saved!");
+ GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getUUID() + " flagged as saved!");
changed = false;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
index c0c19c997..d07edcef2 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
@@ -48,6 +48,14 @@ public class Group extends DataUnit implements Cloneable {
super(name);
}
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+
+ return this.getUUID();
+ }
/**
* Is this a GlobalGroup
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index adec183cd..61efdc3de 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -51,7 +51,7 @@ public class User extends DataUnit implements Cloneable {
@Override
public User clone() {
- User clone = new User(getDataSource(), this.getName());
+ User clone = new User(getDataSource(), this.getLastName());
clone.group = this.group;
for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
@@ -69,10 +69,10 @@ public class User extends DataUnit implements Cloneable {
*/
public User clone(WorldDataHolder dataSource) {
- if (dataSource.isUserDeclared(this.getName())) {
+ if (dataSource.isUserDeclared(this.getLastName())) {
return null;
}
- User clone = dataSource.createUser(this.getName());
+ User clone = dataSource.createUser(this.getLastName());
if (dataSource.getGroup(group) == null) {
clone.setGroup(dataSource.getDefaultGroup());
} else {
@@ -85,6 +85,28 @@ public class User extends DataUnit implements Cloneable {
clone.flagAsChanged();
return clone;
}
+
+ public User clone(String uUID) {
+
+ User clone = this.getDataSource().createUser(uUID);
+
+ if (this.getDataSource().getGroup(group) == null) {
+ clone.setGroup(this.getDataSource().getDefaultGroup());
+ } else {
+ clone.setGroup(this.getDataSource().getGroup(this.getGroupName()));
+ }
+
+ clone.setLastName(this.getLastName());
+
+ for (String perm : this.getPermissionList()) {
+ clone.addPermission(perm);
+ }
+
+ clone.variables = this.variables.clone(this);
+ clone.flagAsChanged();
+
+ return clone;
+ }
public Group getGroup() {
@@ -107,6 +129,19 @@ public class User extends DataUnit implements Cloneable {
}
return group;
}
+
+ /**
+ * Place holder to let people know to stop using this method.
+ *
+ * @deprecated use {@link getLastName()} and {@link getUUID()}.
+ * @return a string containing the players last known name.
+ */
+ @Deprecated
+ public String getName() {
+
+ return this.getLastName();
+
+ }
/**
@@ -144,7 +179,7 @@ public class User extends DataUnit implements Cloneable {
boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName)));
if (notify)
- GroupManager.notify(this.getName(), String.format(" moved to the group %s in %s.", group.getName(), this.getDataSource().getName()));
+ GroupManager.notify(this.getLastName(), String.format(" moved to the group %s in %s.", group.getName(), this.getDataSource().getName()));
GroupManager.getGMEventHandler().callEvent(this, Action.USER_GROUP_CHANGED);
}
@@ -269,7 +304,7 @@ public class User extends DataUnit implements Cloneable {
public Player getBukkitPlayer() {
if (bukkitPlayer == null) {
- bukkitPlayer = Bukkit.getPlayer(this.getName());
+ bukkitPlayer = Bukkit.getPlayer(this.getLastName());
}
return bukkitPlayer;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
index ef9f605ed..831b99bd7 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java
@@ -74,33 +74,33 @@ public class OverloadedWorldHolder extends WorldDataHolder {
theUser.setGroup(getDefaultGroup());
}
//OVERLOADED CODE
- if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) {
- overloadedUsers.remove(theUser.getName().toLowerCase());
- overloadedUsers.put(theUser.getName().toLowerCase(), theUser);
+ if (overloadedUsers.containsKey(theUser.getUUID().toLowerCase())) {
+ overloadedUsers.remove(theUser.getUUID().toLowerCase());
+ overloadedUsers.put(theUser.getUUID().toLowerCase(), theUser);
return;
}
//END CODE
- removeUser(theUser.getName());
- getUsers().put(theUser.getName().toLowerCase(), theUser);
+ removeUser(theUser.getUUID());
+ getUsers().put(theUser.getUUID().toLowerCase(), theUser);
setUsersChanged(true);
}
/**
*
- * @param userName
+ * @param userId
* @return true if removed/false if not found.
*/
@Override
- public boolean removeUser(String userName) {
+ public boolean removeUser(String userId) {
//OVERLOADED CODE
- if (overloadedUsers.containsKey(userName.toLowerCase())) {
- overloadedUsers.remove(userName.toLowerCase());
+ if (overloadedUsers.containsKey(userId.toLowerCase())) {
+ overloadedUsers.remove(userId.toLowerCase());
return true;
}
//END CODE
- if (getUsers().containsKey(userName.toLowerCase())) {
- getUsers().remove(userName.toLowerCase());
+ if (getUsers().containsKey(userId.toLowerCase())) {
+ getUsers().remove(userId.toLowerCase());
setUsersChanged(true);
return true;
}
@@ -156,8 +156,8 @@ public class OverloadedWorldHolder extends WorldDataHolder {
synchronized(getUsers()) {
Collection<User> normalList = getUsers().values();
for (User u : normalList) {
- if (overloadedUsers.containsKey(u.getName().toLowerCase())) {
- overloadedList.add(overloadedUsers.get(u.getName().toLowerCase()));
+ if (overloadedUsers.containsKey(u.getUUID().toLowerCase())) {
+ overloadedList.add(overloadedUsers.get(u.getUUID().toLowerCase()));
} else {
overloadedList.add(u);
}
@@ -171,34 +171,35 @@ public class OverloadedWorldHolder extends WorldDataHolder {
* @param userName
* @return true if user is overloaded.
*/
- public boolean isOverloaded(String userName) {
+ public boolean isOverloaded(String userId) {
- return overloadedUsers.containsKey(userName.toLowerCase());
+ return overloadedUsers.containsKey(userId.toLowerCase());
}
/**
*
- * @param userName
+ * @param userId
*/
- public void overloadUser(String userName) {
+ public void overloadUser(String userId) {
- if (!isOverloaded(userName)) {
- User theUser = getUser(userName);
+ if (!isOverloaded(userId)) {
+ User theUser = getUser(userId);
theUser = theUser.clone();
- if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) {
- overloadedUsers.remove(theUser.getName().toLowerCase());
+ if (overloadedUsers.containsKey(theUser.getUUID().toLowerCase())) {
+ overloadedUsers.remove(theUser.getUUID().toLowerCase());
}
- overloadedUsers.put(theUser.getName().toLowerCase(), theUser);
+ overloadedUsers.put(theUser.getUUID().toLowerCase(), theUser);
}
}
/**
*
- * @param userName
+ * @param userId
*/
- public void removeOverload(String userName) {
+ public void removeOverload(String userId) {
- overloadedUsers.remove(userName.toLowerCase());
+ User theUser = getUser(userId);
+ overloadedUsers.remove(theUser.getUUID().toLowerCase());
}
/**
@@ -206,18 +207,18 @@ public class OverloadedWorldHolder extends WorldDataHolder {
* It doesn't affect permissions. But it enables plugins change the
* actual user permissions even in overload mode.
*
- * @param userName
+ * @param userId
* @return user object
*/
- public User surpassOverload(String userName) {
+ public User surpassOverload(String userId) {
- if (!isOverloaded(userName)) {
- return getUser(userName);
+ if (!isOverloaded(userId)) {
+ return getUser(userId);
}
- if (getUsers().containsKey(userName.toLowerCase())) {
- return getUsers().get(userName.toLowerCase());
+ if (getUsers().containsKey(userId.toLowerCase())) {
+ return getUsers().get(userId.toLowerCase());
}
- User newUser = createUser(userName);
+ User newUser = createUser(userId);
return newUser;
}
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index 095b99a50..75d8ed570 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -104,15 +104,76 @@ public class WorldDataHolder {
* Search for a user. If it doesn't exist, create a new one with default
* group.
*
- * @param userName the name of the user
+ * @param userId the UUID String or name of the user
* @return class that manage that user permission
*/
- public User getUser(String userName) {
-
- if (getUsers().containsKey(userName.toLowerCase())) {
- return getUsers().get(userName.toLowerCase());
+ public User getUser(String userId) {
+
+ if (getUsers().containsKey(userId.toLowerCase())) {
+ return getUsers().get(userId.toLowerCase());
+ }
+
+ // Legacy name matching
+ if (userId.length() < 36) {
+
+ // Search for a LastName match
+ for (User user : getUserList()) {
+
+ if (user.getLastName().equalsIgnoreCase(userId))
+ return user;
+ }
+
+ }
+
+ // No user account found so create a new one.
+ User newUser = createUser(userId);
+
+ return newUser;
+ }
+
+ /**
+ * *** Internal GM use only ***
+ * This is called when a player joins to update/add their UUID.
+ *
+ * @param uUID the player objects UUID.
+ * @param currentName the name they have just logged in with.
+ * @return the user object for this player.
+ */
+ public User getUser(String uUID, String currentName) {
+
+ // Check for a UUID account
+ User user = getUsers().get(uUID.toLowerCase());
+
+ if (user != null) {
+
+ user.setLastName(currentName);
+ return user;
+
}
- User newUser = createUser(userName);
+
+ // Search for a LastName match
+ for (User usr : getUserList()) {
+
+ if (usr.getLastName().equalsIgnoreCase(currentName)) {
+
+ // Clone this user so we can set it's uUID
+ user = usr.clone(uUID);
+
+ // Delete it and replace with the new clone.
+ this.removeUser(usr.getUUID());
+ user.setLastName(currentName);
+ this.addUser(user);
+
+ return user;
+ }
+
+ }
+
+
+ // No user account found so create a new one.
+ User newUser = createUser(uUID);
+ newUser.setLastName(currentName);
+
return newUser;
}
@@ -132,8 +193,8 @@ public class WorldDataHolder {
if ((theUser.getGroup() == null)) {
theUser.setGroup(groups.getDefaultGroup());
}
- removeUser(theUser.getName());
- getUsers().put(theUser.getName().toLowerCase(), theUser);
+ removeUser(theUser.getUUID());
+ getUsers().put(theUser.getUUID().toLowerCase(), theUser);
setUsersChanged(true);
if (GroupManager.isLoaded())
GroupManager.getGMEventHandler().callEvent(theUser, Action.USER_ADDED);
@@ -142,16 +203,16 @@ public class WorldDataHolder {
/**
* Removes the user from the list. (he might become a default user)
*
- * @param userName the username from the user to remove
+ * @param userId the UUID or username for the user to remove
* @return true if it had something to remove
*/
- public boolean removeUser(String userName) {
+ public boolean removeUser(String userId) {
- if (getUsers().containsKey(userName.toLowerCase())) {
- getUsers().remove(userName.toLowerCase());
+ if (getUsers().containsKey(userId.toLowerCase())) {
+ getUsers().remove(userId.toLowerCase());
setUsersChanged(true);
if (GroupManager.isLoaded())
- GroupManager.getGMEventHandler().callEvent(userName, GMUserEvent.Action.USER_REMOVED);
+ GroupManager.getGMEventHandler().callEvent(userId, GMUserEvent.Action.USER_REMOVED);
return true;
}
return false;
@@ -159,12 +220,12 @@ public class WorldDataHolder {
/**
*
- * @param userName
+ * @param userId
* @return true if we have data for this player.
*/
- public boolean isUserDeclared(String userName) {
+ public boolean isUserDeclared(String userId) {
- return getUsers().containsKey(userName.toLowerCase());
+ return getUsers().containsKey(userId.toLowerCase());
}
/**
@@ -275,15 +336,15 @@ public class WorldDataHolder {
/**
* Creates a new User with the given name and adds it to this holder.
*
- * @param userName the username you want
+ * @param userId the UUID or username you want
* @return null if user already exists. or new User
*/
- public User createUser(String userName) {
+ public User createUser(String userId) {
- if (getUsers().containsKey(userName.toLowerCase())) {
+ if (getUsers().containsKey(userId.toLowerCase())) {
return null;
}
- User newUser = new User(this, userName);
+ User newUser = new User(this, userId);
newUser.setGroup(groups.getDefaultGroup(), false);
addUser(newUser);
setUsersChanged(true);
@@ -808,10 +869,27 @@ public class WorldDataHolder {
throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath());
}
- // USER PERMISSIONS NODES
+ // LASTNAME NODES
Object nodeData = null;
try {
+
+ nodeData = thisUserNode.get("lastname");
+
+ } catch (Exception ex) {
+ throw new IllegalArgumentException("Bad format found in 'subgroups' for user: " + usersKey + " in file: " + usersFile.getPath());
+ }
+
+ if ((nodeData != null) && (nodeData instanceof String)) {
+
+ thisUser.setLastName((String) nodeData);
+
+ }
+
+ // USER PERMISSIONS NODES
+
+ nodeData = null;
+ try {
nodeData = thisUserNode.get("permissions");
} catch (Exception ex) {
throw new IllegalArgumentException("Bad format found in 'permissions' for user: " + usersKey + " in file: " + usersFile.getPath());
@@ -848,6 +926,7 @@ public class WorldDataHolder {
}
thisUser.sortPermissions();
}
+
// SUBGROUPS NODES
@@ -865,13 +944,13 @@ public class WorldDataHolder {
} else if (nodeData instanceof List) {
for (Object o : ((List) nodeData)) {
if (o == null) {
- GroupManager.logger.warning("Invalid Subgroup data for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath());
+ GroupManager.logger.warning("Invalid Subgroup data for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
} else {
Group subGrp = ph.getGroup(o.toString());
if (subGrp != null) {
thisUser.addSubGroup(subGrp);
} else {
- GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath());
+ GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
}
@@ -880,7 +959,7 @@ public class WorldDataHolder {
if (subGrp != null) {
thisUser.addSubGroup(subGrp);
} else {
- GroupManager.logger.warning("Subgroup '" + nodeData.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath());
+ GroupManager.logger.warning("Subgroup '" + nodeData.toString() + "' not found for user: " + thisUser.getLastName() + ". Ignoring entry in file: " + usersFile.getPath());
}
}
@@ -901,7 +980,7 @@ public class WorldDataHolder {
thisUser.setVariables((Map<String, Object>) nodeData);
} else
- throw new IllegalArgumentException("Unknown entry found in 'info' section for user: " + thisUser.getName() + " in file: " + usersFile.getPath());
+ throw new IllegalArgumentException("Unknown entry found in 'info' section for user: " + thisUser.getLastName() + " in file: " + usersFile.getPath());
// END INFO NODE
@@ -917,7 +996,7 @@ public class WorldDataHolder {
if (nodeData != null) {
Group hisGroup = ph.getGroup(nodeData.toString());
if (hisGroup == null) {
- GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath());
+ GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getLastName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath());
hisGroup = ph.getDefaultGroup();
}
thisUser.setGroup(hisGroup);
@@ -1036,8 +1115,12 @@ public class WorldDataHolder {
}
LinkedHashMap<String, Object> aUserMap = new LinkedHashMap<String, Object>();
- usersMap.put(user.getName(), aUserMap);
+ usersMap.put(user.getUUID(), aUserMap);
+ if (!user.getUUID().equalsIgnoreCase(user.getLastName())) {
+ aUserMap.put("lastname", user.getLastName());
+ }
+
// GROUP NODE
if (user.getGroup() == null) {
aUserMap.put("group", ph.getDefaultGroup().getName());
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
index 12c9baa0e..cc7f00eee 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
@@ -41,7 +41,7 @@ public class GMUserEvent extends Event {
this.user = user;
this.action = action;
- this.userName = user.getName();
+ this.userName = user.getLastName();
}
public GMUserEvent(String userName, Action action) {
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
index 03742b023..a4f68864f 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -445,10 +445,11 @@ public class BukkitPermissions {
removeAttachment(player.getName());
// force GM to create the player if they are not already listed.
- if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
- setPlayer_join(false);
- updatePermissions(event.getPlayer());
- }
+ plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getUniqueId().toString(), player.getName());
+
+ setPlayer_join(false);
+ updatePermissions(event.getPlayer());
+
setPlayer_join(false);
}