@EventHandler fun onBlockPlace(e: BlockPlaceEvent) { if (e.block.type != Material.ENDER_CHEST || e.itemInHand.itemMeta == null || !e.itemInHand.itemMeta!!.hasDisplayName() || !e.itemInHand.itemMeta!!.displayName.contains("crate", true)) return if (e.block.world.name.startsWith("skyblock")) { val possibleCurrentIsland = skyblockAPI.getIslandViaLocation(e.player.location) if (possibleCurrentIsland.isEmpty) return val currentIsland = possibleCurrentIsland.get() val skyblockUser = skyblockAPI.getUser(e.player) if (!skyblockAPI.getIslandPermission(currentIsland, skyblockUser, PermissionType.BLOCK_PLACE)) { e.itemInHand.amount -= 1 } } else if (e.block.world.name.startsWith("factions")) { if (!FPlayers.getInstance().getByPlayer(e.player).isInOwnTerritory) { e.itemInHand.amount -= 1 } } }