Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onPlace(BlockPlaceEvent event) {
- if (event.getBlock().getType() == Material.FENCE) {
- // Is fence
- Block fence = event.getBlock();
- Entity leash = fence.getLocation().getWorld().spawnEntity(fence.getLocation(), EntityType.LEASH);
- if (leash instanceof Leash) {
- Leash l = (Leash) leash;
- doLeash(l);
- event.getPlayer().sendMessage("Leashing you to the fence");
- doLeash(l, event.getPlayer());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment