1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Added onBlockPlace event

Added onBlockPlace event to prevent block placements (by players) above the pedestals
This commit is contained in:
Redemption 2017-11-22 18:36:12 +01:00 committed by GitHub
parent 1749ae4131
commit e57eec9b14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,5 +179,17 @@ public class AncientAltarListener implements Listener {
e.getItem().remove();
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
if(e.isCancelled()) return;
Block b = e.getBlockPlaced().getRelative(0, -1, 0);
SlimefunItem item = BlockStorage.check(b);
if(item == null) return;
if(item.getName().equalsIgnoreCase("ANCIENT_PEDESTAL")) {
Messages.local.sendTranslation(e.getPlayer(), "messages.cant-place", true);
e.setCancelled(true);
} else return;
}
}