From 961da1b93fe5328213798f2476a8c372bcb7e13a Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 30 Mar 2019 17:32:10 -0400 Subject: [PATCH] Add BukkitPlayer constructor without plugin. tbh I don't know why we even need to keep the plugin object around. --- .../main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java | 4 ++++ .../com/sk89q/worldedit/bukkit/BukkitServerInterface.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 3e2b5cd3f..d814cc7ba 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -52,6 +52,10 @@ public class BukkitPlayer extends AbstractPlayerActor { private Player player; private WorldEditPlugin plugin; + public BukkitPlayer(Player player) { + this(WorldEditPlugin.getInstance(), player); + } + public BukkitPlayer(WorldEditPlugin plugin, Player player) { this.plugin = plugin; this.player = player; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java index 3e8f4bcf9..adfc64bc0 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java @@ -100,7 +100,7 @@ public class BukkitServerInterface implements MultiUserPlatform { return player; } else { org.bukkit.entity.Player bukkitPlayer = server.getPlayerExact(player.getName()); - return bukkitPlayer != null ? new BukkitPlayer(plugin, bukkitPlayer) : null; + return bukkitPlayer != null ? WorldEditPlugin.getInstance().wrapPlayer(bukkitPlayer) : null; } } @@ -177,7 +177,7 @@ public class BukkitServerInterface implements MultiUserPlatform { public Collection getConnectedUsers() { List users = new ArrayList<>(); for (org.bukkit.entity.Player player : Bukkit.getServer().getOnlinePlayers()) { - users.add(new BukkitPlayer(plugin, player)); + users.add(WorldEditPlugin.getInstance().wrapPlayer(player)); } return users; }