mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-23 00:21:26 +01:00
Better update for the User object player reference.
This commit is contained in:
parent
78d4987d5d
commit
5683ea35fc
@ -256,15 +256,10 @@ public class User extends DataUnit implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
public void clearPlayer() {
|
||||
bukkitPlayer = null;
|
||||
}
|
||||
|
||||
public User updatePlayer(Player player) {
|
||||
|
||||
if (player != null) {
|
||||
bukkitPlayer = player;
|
||||
}
|
||||
bukkitPlayer = player;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,11 @@ public class BukkitPermissions {
|
||||
if (player == null || !GroupManager.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset the User objects player reference.
|
||||
User user = plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName());
|
||||
if (user != null)
|
||||
user.updatePlayer(player);
|
||||
|
||||
PermissionAttachment attachment;
|
||||
|
||||
@ -441,10 +446,6 @@ public class BukkitPermissions {
|
||||
public void onPlayerKick(PlayerKickEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
User user = plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName());
|
||||
if (user != null)
|
||||
user.clearPlayer();
|
||||
|
||||
/*
|
||||
* force remove any attachments as bukkit may not
|
||||
@ -459,10 +460,6 @@ public class BukkitPermissions {
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
User user = plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName());
|
||||
if (user != null)
|
||||
user.clearPlayer();
|
||||
|
||||
/*
|
||||
* force remove any attachments as bukkit may not
|
||||
|
Loading…
Reference in New Issue
Block a user