C_Corp2002

Force Right Click

Jun 7th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import:
  2. java.lang.Runnable
  3. org.bukkit.plugin.PluginManager
  4. org.bukkit.Bukkit
  5. org.bukkit.event.EventHandler
  6. org.bukkit.event.EventPriority
  7. org.bukkit.event.player.PlayerInteractEvent
  8. org.bukkit.event.block.Action
  9. org.bukkit.event.Listener
  10.  
  11.  
  12. options:
  13. bukkitSrv: Bukkit.getServer()
  14.  
  15. on right click:
  16. if event-player's held item is book:
  17. set {_p} to event-player
  18. set {_craft} to getCraftFromPilot({_p})
  19. set {_target_sign} to uncoloured display name of event-player's held item
  20. set {_hitbox} to {_craft}.getHitBox()
  21. set {_world} to {_craft}.getW()
  22. set {_signs::*} to getSignsInHitBox({_hitbox}, {_world}, "%{_target_sign}%")
  23. loop {_signs::*}:
  24. set {_b} to loop-value
  25. wait 2 ticks
  26. set {_ForceClickSign} to new PlayerInteractEvent("%{_p}%" parsed as offline player, Action.RIGHT_CLICK_BLOCK, Material.AIR, {_b}, (facing of {_b}))
  27. wait 2 ticks
  28. {@bukkitSrv}.getPluginManager().callEvent({_ForceClickSign})
  29. #Trying to force the player to click a block, and execute some code.
  30.  
Advertisement
Add Comment
Please, Sign In to add comment