diff --git a/nukkit/src/main/java/com/boydti/fawe/nukkit/core/WorldEditListener.java b/nukkit/src/main/java/com/boydti/fawe/nukkit/core/WorldEditListener.java index 5b5121ab..77198ca9 100644 --- a/nukkit/src/main/java/com/boydti/fawe/nukkit/core/WorldEditListener.java +++ b/nukkit/src/main/java/com/boydti/fawe/nukkit/core/WorldEditListener.java @@ -31,6 +31,8 @@ import cn.nukkit.event.player.PlayerChatEvent; import cn.nukkit.event.player.PlayerCommandPreprocessEvent; import cn.nukkit.event.player.PlayerGameModeChangeEvent; import cn.nukkit.event.player.PlayerInteractEvent; +import cn.nukkit.event.player.PlayerInteractEvent.Action; + import com.google.common.base.Joiner; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.LocalPlayer; @@ -142,8 +144,8 @@ public class WorldEditListener implements Listener { final World world = player.getWorld(); final WorldEdit we = WorldEdit.getInstance(); - int action = event.getAction(); - if (action == PlayerInteractEvent.LEFT_CLICK_BLOCK) { + Action action = event.getAction(); + if (action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) { final Block clickedBlock = event.getBlock(); final WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ()); @@ -155,13 +157,13 @@ public class WorldEditListener implements Listener { event.setCancelled(true); } - } else if (action == PlayerInteractEvent.LEFT_CLICK_AIR) { + } else if (action == PlayerInteractEvent.Action.LEFT_CLICK_AIR) { if (we.handleArmSwing(player)) { event.setCancelled(true); } - } else if (action == PlayerInteractEvent.RIGHT_CLICK_BLOCK) { + } else if (action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { final Block clickedBlock = event.getBlock(); final WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ()); @@ -173,7 +175,7 @@ public class WorldEditListener implements Listener { if (we.handleRightClick(player)) { event.setCancelled(true); } - } else if (action == PlayerInteractEvent.RIGHT_CLICK_AIR) { + } else if (action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { if (we.handleRightClick(player)) { event.setCancelled(true); } diff --git a/nukkit/src/main/java/com/boydti/fawe/nukkit/listener/BrushListener.java b/nukkit/src/main/java/com/boydti/fawe/nukkit/listener/BrushListener.java index 50abe07d..ec389007 100644 --- a/nukkit/src/main/java/com/boydti/fawe/nukkit/listener/BrushListener.java +++ b/nukkit/src/main/java/com/boydti/fawe/nukkit/listener/BrushListener.java @@ -76,7 +76,7 @@ public class BrushListener implements Listener { public void onPlayerInteract(final PlayerInteractEvent event) { Player nukkitPlayer = event.getPlayer(); if (nukkitPlayer.isSneaking()) { - if (event.getAction() == PlayerInteractEvent.PHYSICAL) { + if (event.getAction() == PlayerInteractEvent.Action.PHYSICAL) { return; } FawePlayer fp = FawePlayer.wrap(nukkitPlayer); diff --git a/nukkit/src/main/java/com/boydti/fawe/nukkit/optimization/FaweNukkit.java b/nukkit/src/main/java/com/boydti/fawe/nukkit/optimization/FaweNukkit.java index f4a90663..4f29bcda 100644 --- a/nukkit/src/main/java/com/boydti/fawe/nukkit/optimization/FaweNukkit.java +++ b/nukkit/src/main/java/com/boydti/fawe/nukkit/optimization/FaweNukkit.java @@ -43,15 +43,17 @@ public class FaweNukkit implements IFawe, Listener { } } - @EventHandler - public void onPlayerQuit(PlayerQuitEvent event) { - Player player = event.getPlayer(); - FawePlayer fp = FawePlayer.wrap(player); - if (fp != null) { - fp.unregister(); - } - Fawe.get().unregister(event.getPlayer().getName()); - } + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { + Player player = event.getPlayer(); + if (!event.getReason().equals("disconnectionScreen.serverFull")) { + FawePlayer fp = FawePlayer.wrap(player); + if (fp != null) { + fp.unregister(); + } + Fawe.get().unregister(event.getPlayer().getName()); + } + } @Override public void debug(String s) {