Advertisement
Guest User

Untitled

a guest
May 30th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. @EventHandler(priority = EventPriority.MONITOR)
  2.     public void onSignInteract(PlayerInteractEvent event) {
  3.         if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
  4.             if ((event.getClickedBlock() != null) && (event.getClickedBlock().getType() == Material.SKULL)) {
  5.            
  6.                 Skull sk = (Skull) event.getClickedBlock().getState();
  7.              
  8.               //If the skull is a player do this
  9.               if (sk.getSkullType() == SkullType.PLAYER) {
  10.                     event.getPlayer().sendMessage(ChatColor.GRAY + "Head of " + ChatColor.WHITE + sk.getOwner() + ChatColor.YELLOW + ".");
  11.               }
  12.  
  13.               //If the skull is NOT a player
  14.               if (!sk.getSkullType() == SkullType.PLAYER) {
  15.                     event.getPlayer().sendMessage(ChatColor.GRAY + "Head of " + ChatColor.WHITE + sk.getOwner() + ChatColor.YELLOW + ".");
  16.               }
  17.             }
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement