Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2021
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. // Main class
  2. public class TestVehicles extends JavaPlugin implements Listener {
  3.  
  4. @Override
  5. public void onEnable() {
  6. Bukkit.getPluginManager().registerEvents(this, this);
  7. }
  8.  
  9. @EventHandler
  10. public void onPlace(PlayerInteractEvent event) {
  11. if (event.getHand() != EquipmentSlot.HAND || event.getClickedBlock() == null || event.getItem() == null || event.getItem().getType() != Material.CHEST) return;
  12. new MyArmorStand(((CraftWorld) event.getClickedBlock().getWorld()).getHandle(), event.getClickedBlock().getLocation().add(0, 1, 0));
  13.  
  14. }
  15. }
  16.  
  17. // Entity Class
  18. public class MyArmorStand extends EntityArmorStand {
  19.  
  20. public MyArmorStand(World world, Location location) {
  21. super(world, location.getX(), location.getY(), location.getZ());
  22.  
  23. world.addEntity(this);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement