mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-29 09:19:51 +02:00
Allow to cancel the event
This commit is contained in:
@@ -26,6 +26,7 @@ public class PlaceBlockExecutor extends BaseEventExecutor
|
|||||||
org.bukkit.block.Block bukkitBlock = ((BlockPlaceEvent)event).getBlockPlaced();
|
org.bukkit.block.Block bukkitBlock = ((BlockPlaceEvent)event).getBlockPlaced();
|
||||||
Block block = BukkitBlockFactory.convert(bukkitBlock);
|
Block block = BukkitBlockFactory.convert(bukkitBlock);
|
||||||
String playername = ((BlockPlaceEvent)event).getPlayer().getName();
|
String playername = ((BlockPlaceEvent)event).getPlayer().getName();
|
||||||
listener.onBlockPlace(block, new UserOnDemand(playername, server));
|
boolean success = listener.onBlockPlace(block, new UserOnDemand(playername, server));
|
||||||
|
((BlockPlaceEvent)event).setCancelled(!success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user