mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
PlayerInteract listener should now respect cancelled status.
This commit is contained in:
parent
d69863db59
commit
c2460a6305
@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
@ -66,7 +67,7 @@ public class WorldEditPlayerListener extends PlayerListener {
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
plugin.getWorldEdit().markExpire(wrapPlayer(event.getPlayer()));
|
||||
plugin.getWorldEdit().markExpire(plugin.wrapPlayer(event.getPlayer()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +83,7 @@ public class WorldEditPlayerListener extends PlayerListener {
|
||||
|
||||
String[] split = event.getMessage().split(" ");
|
||||
|
||||
if (plugin.getWorldEdit().handleCommand(wrapPlayer(event.getPlayer()), split)) {
|
||||
if (plugin.getWorldEdit().handleCommand(plugin.wrapPlayer(event.getPlayer()), split)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -96,7 +97,11 @@ public class WorldEditPlayerListener extends PlayerListener {
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
final LocalPlayer player = wrapPlayer(event.getPlayer());
|
||||
if (event.useItemInHand() == Event.Result.DENY) {
|
||||
return;
|
||||
}
|
||||
|
||||
final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
|
||||
final LocalWorld world = player.getWorld();
|
||||
final WorldEdit we = plugin.getWorldEdit();
|
||||
|
||||
@ -162,8 +167,4 @@ public class WorldEditPlayerListener extends PlayerListener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private BukkitPlayer wrapPlayer(Player player) {
|
||||
return new BukkitPlayer(plugin, plugin.getServerInterface(), player);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user