Advertisement
Guest User

TheWreckage Dev. App. Example [GENEX]

a guest
Aug 21st, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. This is an example of what I can do for the wreckage, I just decided to make this simple and easy. This is when somebody right clicks a WOOL block it will open a double chest of soup and the chest's inventory name will be 'Wreckage Soup' in the color purple and, when somebody right clicks the wool it will play a 'ding' sound.
  2.  
  3. @EventHandler(priority = EventPriority.HIGH)
  4.     public void Chest(PlayerInteractEvent e) {
  5.         if ((e.getAction() == Action.RIGHT_CLICK_BLOCK)
  6.                 && (e.getClickedBlock().getType() == Material.WOOL)) {
  7.             Inventory soup = Bukkit.createInventory(null, 54, ChatColor
  8.                     .translateAlternateColorCodes('&', "§5Wreckage Soup"));
  9.             for (int i = 0; i < 54; i++) {
  10.                 soup.addItem(new ItemStack[] { new ItemStack(Material.MUSHROOM_SOUP) });
  11.             }
  12.             e.setCancelled(true);
  13.             e.getPlayer().playSound(e.getPlayer().getLocation(),
  14.                     Sound.NOTE_PLING, 1, 0);
  15.             e.getPlayer().openInventory(soup);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement