mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Check multiblock placement
This commit is contained in:
parent
51bb15a4f0
commit
a6035254b3
@ -199,7 +199,6 @@ public class Block implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
@ -215,14 +214,26 @@ public class Block implements Listener {
|
||||
Island island = islandManager.getIslandAtLocation(blockLoc);
|
||||
|
||||
// Check permissions.
|
||||
if (!plugin.getPermissionManager().processPermission(event, player, island))
|
||||
if (!plugin.getPermissionManager().processPermission(event, player, island)){
|
||||
return;
|
||||
}
|
||||
|
||||
if (island == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(ServerVersion.isServerVersionAbove(ServerVersion.V1_8)) {
|
||||
if(event instanceof BlockMultiPlaceEvent) {
|
||||
for(BlockState blockState : ((BlockMultiPlaceEvent) event).getReplacedBlockStates()) {
|
||||
if(!island.equals(islandManager.getIslandAtLocation(blockState.getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (islandLevelManager.isScanning(island)) {
|
||||
plugin.getMessageManager().sendMessage(player,
|
||||
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
||||
|
Loading…
Reference in New Issue
Block a user