Merge pull request #583 from Goodstuff4UonYT/master

Real Nukkit 1.1 Fix - Try it
This commit is contained in:
Jesse Boyd 2017-07-02 23:18:03 +10:00 committed by GitHub
commit 3c44e75139
3 changed files with 19 additions and 15 deletions

View File

@ -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);
}

View File

@ -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<Object> fp = FawePlayer.wrap(nukkitPlayer);

View File

@ -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) {