Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Halp extends JavaPlugin implements Listener{
- public static Inventory LevisInventory;
- public void onEnable() {
- LevisInventory = Bukkit.createInventory(null, 36, ChatColor.BOLD + "Trash");
- }
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if(label.equalsIgnoreCase("Trash")){
- if(sender instanceof Player){
- ((Player) sender).openInventory(LevisInventory);
- this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- public void run() {
- LevisInventory.clear();
- }
- }, 2, 20);
- }
- }
- return false;
- }
- @EventHandler
- public void diamond(PlayerInteractEvent event){
- Player player = event.getPlayer();
- if(player.getInventory().getItemInHand().getType() == Material.BEDROCK){
- if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK){
- player.openInventory(LevisInventory);
- }
- }
- }
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement