Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. import org.bukkit.Bukkit;
  2. import org.bukkit.ChatColor;
  3. import org.bukkit.Material;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.block.Action;
  10. import org.bukkit.event.player.PlayerInteractEvent;
  11. import org.bukkit.inventory.Inventory;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. public class Halp extends JavaPlugin implements Listener{
  15.  
  16. public static Inventory LevisInventory;
  17.  
  18. public void onEnable() {
  19. LevisInventory = Bukkit.createInventory(null, 36, ChatColor.BOLD + "Trash");
  20. }
  21. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  22. if(label.equalsIgnoreCase("Trash")){
  23. if(sender instanceof Player){
  24. ((Player) sender).openInventory(LevisInventory);
  25. this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  26. public void run() {
  27. LevisInventory.clear();
  28. }
  29. }, 2, 20);
  30. }
  31. }
  32. return false;
  33. }
  34. @EventHandler
  35. public void diamond(PlayerInteractEvent event){
  36. Player player = event.getPlayer();
  37. if(player.getInventory().getItemInHand().getType() == Material.BEDROCK){
  38. if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK){
  39. player.openInventory(LevisInventory);
  40. }
  41. }
  42. }
  43.  
  44. {
  45.  
  46.  
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement