mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-27 04:35:46 +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)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -215,14 +214,26 @@ public class Block implements Listener {
|
|||||||
Island island = islandManager.getIslandAtLocation(blockLoc);
|
Island island = islandManager.getIslandAtLocation(blockLoc);
|
||||||
|
|
||||||
// Check permissions.
|
// Check permissions.
|
||||||
if (!plugin.getPermissionManager().processPermission(event, player, island))
|
if (!plugin.getPermissionManager().processPermission(event, player, island)){
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
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)) {
|
if (islandLevelManager.isScanning(island)) {
|
||||||
plugin.getMessageManager().sendMessage(player,
|
plugin.getMessageManager().sendMessage(player,
|
||||||
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
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