Advertisement
Guest User

Untitled

a guest
Mar 25th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. package com.astred.gptotnt;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.inventory.Inventory;
  9. import org.bukkit.inventory.ItemStack;
  10.  
  11. public class TNT implements CommandExecutor
  12. {
  13. Player player;
  14. Inventory inv;
  15. ItemStack powder;
  16. ItemStack boom;
  17.  
  18. public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args)
  19. {
  20. if (cmd.getName().equalsIgnoreCase("tntc"))
  21. {
  22. if (sender instanceof Player)
  23. {
  24. this.player = ((Player)sender);
  25. this.inv = this.player.getInventory();
  26. this.powder = new ItemStack(Material.SULPHUR, 5);
  27. this.boom = new ItemStack(Material.TNT, 1);
  28. if (this.inv.containsAtLeast(this.powder, 5))
  29. {
  30. this.inv.removeItem(new ItemStack[] { this.powder });
  31. this.inv.addItem(new ItemStack[] { this.boom });
  32. this.player.sendMessage("success");
  33. }
  34. }
  35. }
  36. return true;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement