Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Main class
- public class TestVehicles extends JavaPlugin implements Listener {
- @Override
- public void onEnable() {
- Bukkit.getPluginManager().registerEvents(this, this);
- }
- @EventHandler
- public void onPlace(PlayerInteractEvent event) {
- if (event.getHand() != EquipmentSlot.HAND || event.getClickedBlock() == null || event.getItem() == null || event.getItem().getType() != Material.CHEST) return;
- new MyArmorStand(((CraftWorld) event.getClickedBlock().getWorld()).getHandle(), event.getClickedBlock().getLocation().add(0, 1, 0));
- }
- }
- // Entity Class
- public class MyArmorStand extends EntityArmorStand {
- public MyArmorStand(World world, Location location) {
- super(world, location.getX(), location.getY(), location.getZ());
- world.addEntity(this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement