turt2live

Untitled

Jul 29th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1.     @EventHandler
  2.     public void onPlace(BlockPlaceEvent event) {
  3.         if (event.getBlock().getType() == Material.FENCE) {
  4.             // Is fence
  5.             Block fence = event.getBlock();
  6.             Entity leash = fence.getLocation().getWorld().spawnEntity(fence.getLocation(), EntityType.LEASH);
  7.             if (leash instanceof Leash) {
  8.                 Leash l = (Leash) leash;
  9.                 doLeash(l);
  10.                 event.getPlayer().sendMessage("Leashing you to the fence");
  11.                 doLeash(l, event.getPlayer());
  12.             }
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment