1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-27 08:24:44 +02:00

Fix attachments not being reset between worlds.

This commit is contained in:
ElgarL
2014-06-20 21:48:44 +01:00
parent 9a55d32b75
commit 194de920cf
3 changed files with 11 additions and 11 deletions

View File

@@ -2208,18 +2208,18 @@ public class GroupManager extends JavaPlugin {
if (players.isEmpty()) {
// Check for an offline player (exact match).
if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) {
match.add(Bukkit.getOfflinePlayer(playerName).getUniqueId().toString());
match.add(Bukkit.getOfflinePlayer(playerName).getName()); //.getUniqueId().toString());
} else {
// look for partial matches
for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) {
if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase()))
match.add(offline.getUniqueId().toString());
match.add(offline.getName()); //.getUniqueId().toString());
}
}
} else {
for (Player player : players) {
match.add(player.getUniqueId().toString());
match.add(player.getName()); //.getUniqueId().toString());
}
}

View File

@@ -139,7 +139,6 @@ public class WorldDataHolder {
// No user account found so create a new one.
User newUser = createUser(userId);
return newUser;
}

View File

@@ -150,7 +150,8 @@ public class BukkitPermissions {
String uuid = player.getUniqueId().toString();
// Reset the User objects player reference.
User user = plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(uuid);
User user = plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getUniqueId().toString(), player.getName());
if (user != null)
user.updatePlayer(player);
@@ -399,11 +400,11 @@ public class BukkitPermissions {
*
* @param player
*/
private void removeAttachment(String playerName) {
private void removeAttachment(String uuid) {
if (attachments.containsKey(playerName)) {
attachments.get(playerName).remove();
attachments.remove(playerName);
if (attachments.containsKey(uuid)) {
attachments.get(uuid).remove();
attachments.remove(uuid);
}
}
@@ -442,7 +443,7 @@ public class BukkitPermissions {
/*
* Tidy up any lose ends
*/
removeAttachment(player.getName());
removeAttachment(player.getUniqueId().toString());
// force GM to create the player if they are not already listed.
plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getUniqueId().toString(), player.getName());
@@ -473,7 +474,7 @@ public class BukkitPermissions {
/*
* force remove any attachments as bukkit may not
*/
removeAttachment(player.getName());
removeAttachment(player.getUniqueId().toString());
}
}