diff --git a/src/com/lishid/openinv/OpenInv.java b/src/com/lishid/openinv/OpenInv.java index 8060d62..b1be4ab 100644 --- a/src/com/lishid/openinv/OpenInv.java +++ b/src/com/lishid/openinv/OpenInv.java @@ -31,7 +31,6 @@ import com.lishid.openinv.commands.OpenEnderPluginCommand; import com.lishid.openinv.commands.OpenInvPluginCommand; import com.lishid.openinv.commands.SearchInvPluginCommand; import com.lishid.openinv.commands.SilentChestPluginCommand; -import com.lishid.openinv.commands.ToggleOpenInvPluginCommand; import com.lishid.openinv.internal.IAnySilentChest; import com.lishid.openinv.internal.IInventoryAccess; import com.lishid.openinv.internal.IPlayerDataManager; @@ -79,21 +78,16 @@ public class OpenInv extends JavaPlugin { FileConfiguration config = getConfig(); config.set("NotifySilentChest", config.getBoolean("NotifySilentChest", true)); config.set("NotifyAnyChest", config.getBoolean("NotifyAnyChest", true)); - config.set("ItemOpenInvItemID", config.getInt("ItemOpenInvItemID", 280)); - config.addDefault("ItemOpenInvItemID", 280); - config.addDefault("CheckForUpdates", true); config.addDefault("NotifySilentChest", true); config.addDefault("NotifyAnyChest", true); config.options().copyDefaults(true); saveConfig(); pm.registerEvents(new OpenInvPlayerListener(), this); - pm.registerEvents(new OpenInvEntityListener(), this); pm.registerEvents(new OpenInvInventoryListener(), this); getCommand("openinv").setExecutor(new OpenInvPluginCommand(this)); getCommand("searchinv").setExecutor(new SearchInvPluginCommand()); - getCommand("toggleopeninv").setExecutor(new ToggleOpenInvPluginCommand()); getCommand("silentchest").setExecutor(new SilentChestPluginCommand(this)); getCommand("anychest").setExecutor(new AnyChestPluginCommand(this)); getCommand("openender").setExecutor(new OpenEnderPluginCommand(this)); diff --git a/src/com/lishid/openinv/OpenInvEntityListener.java b/src/com/lishid/openinv/OpenInvEntityListener.java deleted file mode 100644 index e2a80c5..0000000 --- a/src/com/lishid/openinv/OpenInvEntityListener.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2011-2014 lishid. All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.lishid.openinv; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; - -public class OpenInvEntityListener implements Listener { - @EventHandler(priority = EventPriority.LOWEST) - public void onEntityDamage(EntityDamageEvent event) { - if (event instanceof EntityDamageByEntityEvent) { - EntityDamageByEntityEvent evt = (EntityDamageByEntityEvent) event; - Entity attacker = evt.getDamager(); - Entity defender = evt.getEntity(); - - if (!(attacker instanceof Player) || !(defender instanceof Player)) { - return; - } - - Player player = (Player) attacker; - - if (!(player.getItemInHand().getType().getId() == OpenInv.GetItemOpenInvItem()) || (!OpenInv.GetPlayerItemOpenInvStatus(player.getName())) || !OpenInv.hasPermission(player, "OpenInv.openinv")) { - return; - } - - Player target = (Player) defender; - player.performCommand("openinv " + target.getName()); - - evt.setDamage(0); - evt.setCancelled(true); - } - } -} diff --git a/src/com/lishid/openinv/OpenInvPlayerListener.java b/src/com/lishid/openinv/OpenInvPlayerListener.java index 89c3815..2026b6f 100644 --- a/src/com/lishid/openinv/OpenInvPlayerListener.java +++ b/src/com/lishid/openinv/OpenInvPlayerListener.java @@ -121,13 +121,5 @@ public class OpenInvPlayerListener implements Listener { ex.printStackTrace(); } } - - if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { - if (!(player.getItemInHand().getType().getId() == OpenInv.GetItemOpenInvItem()) || (!OpenInv.GetPlayerItemOpenInvStatus(player.getName())) || !OpenInv.hasPermission(player, Permissions.PERM_OPENINV)) { - return; - } - - player.performCommand("openinv"); - } } } \ No newline at end of file diff --git a/src/com/lishid/openinv/commands/ToggleOpenInvPluginCommand.java b/src/com/lishid/openinv/commands/ToggleOpenInvPluginCommand.java deleted file mode 100644 index d85861d..0000000 --- a/src/com/lishid/openinv/commands/ToggleOpenInvPluginCommand.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2011-2014 lishid. All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.lishid.openinv.commands; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import com.lishid.openinv.OpenInv; - -public class ToggleOpenInvPluginCommand implements CommandExecutor { - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!(sender instanceof Player)) { - sender.sendMessage(ChatColor.RED + "You can't use this from the console."); - return true; - } - - Player player = (Player) sender; - if (args.length > 0) { - if (args[0].equalsIgnoreCase("check")) { - if (OpenInv.GetPlayerItemOpenInvStatus(player.getName())) - player.sendMessage("OpenInv with " + Material.getMaterial(OpenInv.GetItemOpenInvItem()).toString() + " is ON."); - else - player.sendMessage("OpenInv with " + Material.getMaterial(OpenInv.GetItemOpenInvItem()).toString() + " is OFF."); - } - } - if (OpenInv.GetPlayerItemOpenInvStatus(player.getName())) { - OpenInv.SetPlayerItemOpenInvStatus(player.getName(), false); - player.sendMessage("OpenInv with " + Material.getMaterial(OpenInv.GetItemOpenInvItem()).toString() + " is OFF."); - } - else { - OpenInv.SetPlayerItemOpenInvStatus(player.getName(), true); - player.sendMessage("OpenInv with " + Material.getMaterial(OpenInv.GetItemOpenInvItem()).toString() + " is ON."); - } - return true; - } -} diff --git a/src/plugin.yml b/src/plugin.yml index 02b49b2..cf89c4c 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: OpenInv main: com.lishid.openinv.OpenInv -version: 2.2.10 +version: 2.3.0 author: lishid authors: [Jikoo] description: > @@ -25,12 +25,6 @@ commands: permission: OpenInv.search usage: | / [MinAmount] - Item can be the Item ID or the CraftBukkit Item Name, MinAmount is the minimum amount to be considered. - toggleopeninv: - aliases: [toi, toggleoi, toggleinv] - description: Toggle item openinv function - permission: OpenInv.openinv - usage: | - / [Check] - Checks whether item openinv is enabled silentchest: aliases: [sc, silent] description: Toggle silent chest function, which hides the animation of a chest when opened or closed, and suppresses the sound.