mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 06:58:34 +00:00
Check cached bukkit player is the same as the current player online (#1732)
* Check cached bukkit player is the same as the current player online - If plugins do silly things like teleport, deop (anything that requires a perm-recheck) (anything that ultimately requires a BukkitPlayer at some point) then the retention of metadata by the server (as it's stored based on a string value indescriminate of player a player relogging) means that a BukkitPlayer caching an old player object will be kept, cached and retrieved by FAWE. Adding a simple memory-based equality check when the player rejoins, and then "invaliding" (redoing) the cache if the players are not equal, fixes this. - Fixes #1730 * Address comments * Add comment explaining reference equality check to code
This commit is contained in:
@ -573,6 +573,14 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
}
|
||||
return (BukkitPlayer) meta.get(0).value();
|
||||
}
|
||||
|
||||
BukkitPlayer reCachePlayer(Player player) {
|
||||
synchronized (player) {
|
||||
BukkitPlayer wePlayer = new BukkitPlayer(this, player);
|
||||
player.setMetadata("WE", new FixedMetadataValue(this, wePlayer));
|
||||
return wePlayer;
|
||||
}
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
public Actor wrapCommandSender(CommandSender sender) {
|
||||
|
Reference in New Issue
Block a user