CustomCode

Untitled

Feb 5th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
  2. public void onPlayerInteract(PlayerInteractEvent event)
  3. {
  4. if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
  5. {
  6. Player player = event.getPlayer();
  7. BlockState state = event.getClickedBlock().getState();
  8. if ((state instanceof Skull))
  9. {
  10. Skull skull = (Skull)state;
  11. player.sendMessage(ChatColor.YELLOW + "This head belongs to " + ChatColor.WHITE + ((skull.getSkullType() == SkullType.PLAYER) && (skull.hasOwner()) ? skull.getOwner() : new StringBuilder().append("a ").append(WordUtils.capitalizeFully(skull.getSkullType().name())).append(" skull").toString()) + ChatColor.YELLOW + '.');
Advertisement
Add Comment
Please, Sign In to add comment