rasmonkey17

asdfasf

Jul 22nd, 2021
1,064
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @EventHandler
  2.     fun onBlockPlace(e: BlockPlaceEvent)
  3.     {
  4.         if (e.block.type != Material.ENDER_CHEST
  5.             || e.itemInHand.itemMeta == null
  6.             || !e.itemInHand.itemMeta!!.hasDisplayName()
  7.             || !e.itemInHand.itemMeta!!.displayName.contains("crate", true)) return
  8.  
  9.         if (e.block.world.name.startsWith("skyblock"))
  10.         {
  11.             val possibleCurrentIsland = skyblockAPI.getIslandViaLocation(e.player.location)
  12.             if (possibleCurrentIsland.isEmpty) return
  13.  
  14.             val currentIsland = possibleCurrentIsland.get()
  15.             val skyblockUser = skyblockAPI.getUser(e.player)
  16.  
  17.             if (!skyblockAPI.getIslandPermission(currentIsland, skyblockUser, PermissionType.BLOCK_PLACE))
  18.             {
  19.                 e.itemInHand.amount -= 1
  20.             }
  21.         }
  22.         else if (e.block.world.name.startsWith("factions"))
  23.         {
  24.             if (!FPlayers.getInstance().getByPlayer(e.player).isInOwnTerritory)
  25.             {
  26.                 e.itemInHand.amount -= 1
  27.             }
  28.         }
  29.     }
RAW Paste Data