diff --git a/src/lishid/openinv/OpenInv.java b/src/lishid/openinv/OpenInv.java index ac0b359..acd77af 100644 --- a/src/lishid/openinv/OpenInv.java +++ b/src/lishid/openinv/OpenInv.java @@ -60,7 +60,7 @@ public class OpenInv extends JavaPlugin pm.registerEvents(new OpenInvInventoryListener(), this); getCommand("openinv").setExecutor(new OpenInvPluginCommand(this)); - getCommand("searchinv").setExecutor(new SearchInvPluginCommand(this)); + getCommand("searchinv").setExecutor(new SearchInvPluginCommand()); getCommand("toggleopeninv").setExecutor(new ToggleOpenInvPluginCommand()); getCommand("silentchest").setExecutor(new SilentChestPluginCommand(this)); getCommand("anychest").setExecutor(new AnyChestPluginCommand(this)); diff --git a/src/lishid/openinv/commands/OpenInvPluginCommand.java b/src/lishid/openinv/commands/OpenInvPluginCommand.java index eeca5f5..b756226 100644 --- a/src/lishid/openinv/commands/OpenInvPluginCommand.java +++ b/src/lishid/openinv/commands/OpenInvPluginCommand.java @@ -88,15 +88,7 @@ public class OpenInvPluginCommand implements CommandExecutor // Read from history if target is not named if (args.length < 1) { - if (history != null && history != "") - { - name = history; - } - else - { - sender.sendMessage(ChatColor.RED + "OpenInv history is empty!"); - return true; - } + name = history; } else { @@ -104,7 +96,7 @@ public class OpenInvPluginCommand implements CommandExecutor } target = this.plugin.getServer().getPlayer(name); - + if (target == null) { // Offline inv here... @@ -135,7 +127,7 @@ public class OpenInvPluginCommand implements CommandExecutor sender.sendMessage(ChatColor.RED + "Player " + name + " not found!"); return true; } - + // Create an entity to load the player data final MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer(); final EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), playername, new ItemInWorldManager(server.getWorldServer(0))); @@ -183,7 +175,7 @@ public class OpenInvPluginCommand implements CommandExecutor // Record the target history = target.getName(); openInvHistory.put(player, history); - + // Create the inventory OpenInvPlayerInventory inv = OpenInv.inventories.get(target.getName().toLowerCase()); if (inv == null) @@ -192,7 +184,7 @@ public class OpenInvPluginCommand implements CommandExecutor OpenInv.inventories.put(target.getName().toLowerCase(), inv); } - + // Open the inventory (((CraftPlayer) player).getHandle()).openContainer(inv); diff --git a/src/lishid/openinv/commands/SearchInvPluginCommand.java b/src/lishid/openinv/commands/SearchInvPluginCommand.java index 057f13b..fa0731d 100644 --- a/src/lishid/openinv/commands/SearchInvPluginCommand.java +++ b/src/lishid/openinv/commands/SearchInvPluginCommand.java @@ -16,9 +16,9 @@ package lishid.openinv.commands; -import lishid.openinv.OpenInv; import lishid.openinv.Permissions; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.Command; @@ -28,11 +28,9 @@ import org.bukkit.entity.Player; public class SearchInvPluginCommand implements CommandExecutor { - private final OpenInv plugin; - - public SearchInvPluginCommand(OpenInv plugin) + public SearchInvPluginCommand() { - this.plugin = plugin; + } public boolean onCommand(CommandSender sender, Command command, String label, String[] args) @@ -76,7 +74,7 @@ public class SearchInvPluginCommand implements CommandExecutor return false; } - for (Player templayer : plugin.getServer().getOnlinePlayers()) + for (Player templayer : Bukkit.getServer().getOnlinePlayers()) { if (templayer.getInventory().contains(material, count)) { diff --git a/src/lishid/openinv/utils/OpenInvPlayerInventory.java b/src/lishid/openinv/utils/OpenInvPlayerInventory.java index ba04479..7171cca 100644 --- a/src/lishid/openinv/utils/OpenInvPlayerInventory.java +++ b/src/lishid/openinv/utils/OpenInvPlayerInventory.java @@ -39,7 +39,8 @@ public class OpenInvPlayerInventory extends PlayerInventory this.items = player.inventory.items; this.armor = player.inventory.armor; } - + + @Override public void onClose(CraftHumanEntity who) { super.onClose(who); @@ -70,7 +71,8 @@ public class OpenInvPlayerInventory extends PlayerInventory { playerOnline = false; } - + + @Override public ItemStack[] getContents() { ItemStack[] C = new ItemStack[getSize()]; @@ -78,12 +80,14 @@ public class OpenInvPlayerInventory extends PlayerInventory System.arraycopy(items, 0, C, items.length, armor.length); return C; } - + + @Override public int getSize() { return super.getSize() + 5; } - + + @Override public ItemStack getItem(int i) { ItemStack[] is = this.items; @@ -110,7 +114,8 @@ public class OpenInvPlayerInventory extends PlayerInventory return is[i]; } - + + @Override public ItemStack splitStack(int i, int j) { ItemStack[] is = this.items; @@ -161,7 +166,8 @@ public class OpenInvPlayerInventory extends PlayerInventory return null; } } - + + @Override public ItemStack splitWithoutUpdate(int i) { ItemStack[] is = this.items; @@ -198,7 +204,8 @@ public class OpenInvPlayerInventory extends PlayerInventory return null; } } - + + @Override public void setItem(int i, ItemStack itemstack) { ItemStack[] is = this.items; @@ -259,7 +266,8 @@ public class OpenInvPlayerInventory extends PlayerInventory else return i; } - + + @Override public String getName() { if (player.name.length() > 16) @@ -269,7 +277,8 @@ public class OpenInvPlayerInventory extends PlayerInventory return player.name; } - public boolean a(EntityHuman entityhuman) + @Override + public boolean a_(EntityHuman entityhuman) { return true; } diff --git a/src/lishid/openinv/utils/SilentContainerChest.java b/src/lishid/openinv/utils/SilentContainerChest.java index cc7c914..9e9fe40 100644 --- a/src/lishid/openinv/utils/SilentContainerChest.java +++ b/src/lishid/openinv/utils/SilentContainerChest.java @@ -33,10 +33,8 @@ public class SilentContainerChest extends ContainerChest } @Override - public void a(EntityHuman paramEntityHuman) + public void b(EntityHuman paramEntityHuman) { - super.a(paramEntityHuman); - // open signal - inv.startOpen(); + } } \ No newline at end of file diff --git a/src/plugin.yml b/src/plugin.yml index 0478072..f131328 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: OpenInv main: lishid.openinv.OpenInv -version: 1.8.8 +version: 1.9.0 author: lishid website: http://forums.bukkit.org/threads/15379/ description: >