diff --git a/.classpath b/.classpath
index a5b87fa..57c5bd4 100644
--- a/.classpath
+++ b/.classpath
@@ -4,6 +4,9 @@
-
+
+
+
+
diff --git a/src/lishid/openinv/OpenInv.java b/src/lishid/openinv/OpenInv.java
index da8d092..a06dfa1 100644
--- a/src/lishid/openinv/OpenInv.java
+++ b/src/lishid/openinv/OpenInv.java
@@ -74,8 +74,8 @@ public class OpenInv extends JavaPlugin {
player.setHandle(entityplayer);
}
catch(Exception e)
- {}
+ {
+ System.out.println("[OpenInv] Error while trying to override player inventory, error: " + e.getMessage());
+ }
}
-
-
}
\ No newline at end of file
diff --git a/src/lishid/openinv/OpenInvInventoryListener.java b/src/lishid/openinv/OpenInvInventoryListener.java
new file mode 100644
index 0000000..3bd6548
--- /dev/null
+++ b/src/lishid/openinv/OpenInvInventoryListener.java
@@ -0,0 +1,10 @@
+package lishid.openinv;
+
+import org.bukkit.event.inventory.InventoryListener;
+
+public class OpenInvInventoryListener extends InventoryListener{
+ OpenInv plugin;
+ public OpenInvInventoryListener(OpenInv scrap) {
+ plugin = scrap;
+ }
+}
diff --git a/src/lishid/openinv/commands/OpenInvPluginCommand.java b/src/lishid/openinv/commands/OpenInvPluginCommand.java
index 56a1e31..e8cd90a 100644
--- a/src/lishid/openinv/commands/OpenInvPluginCommand.java
+++ b/src/lishid/openinv/commands/OpenInvPluginCommand.java
@@ -19,7 +19,7 @@ import org.bukkit.entity.Player;
public class OpenInvPluginCommand implements CommandExecutor {
private final OpenInv plugin;
- public static HashMap offlineInv = new HashMap();
+ //public static HashMap offlineInv = new HashMap();
public static HashMap theOpenInvHistory = new HashMap();
public OpenInvPluginCommand(OpenInv plugin) {
this.plugin = plugin;
@@ -33,6 +33,8 @@ public class OpenInvPluginCommand implements CommandExecutor {
//boolean Offline = false;
Player player = (Player)sender;
+
+ //History management
OpenInvHistory history = theOpenInvHistory.get(player);
if(history == null)
@@ -41,11 +43,22 @@ public class OpenInvPluginCommand implements CommandExecutor {
theOpenInvHistory.put(player, history);
}
+ //Toggleopeninv command
if(command.getName().equalsIgnoreCase("toggleopeninv"))
{
- if(OpenInvToggleState.openInvState.get(player.getName()) != null && OpenInvToggleState.openInvState.get(player.getName()) == 1)
+ if(args.length > 0)
{
- OpenInvToggleState.openInvState.put(player.getName(), 0);
+ if(args[0].equalsIgnoreCase("check"))
+ {
+ if(OpenInvToggleState.openInvState.containsKey(player.getName()))
+ player.sendMessage("OpenInv with stick is ON.");
+ else
+ player.sendMessage("OpenInv with stick is OFF.");
+ }
+ }
+ if(OpenInvToggleState.openInvState.containsKey(player.getName()))
+ {
+ OpenInvToggleState.openInvState.remove(player.getName());
player.sendMessage("OpenInv with stick is OFF.");
}
else
@@ -56,6 +69,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
return true;
}
+ //Target selecting
Player target;
if (args.length < 1) {
@@ -99,12 +113,15 @@ public class OpenInvPluginCommand implements CommandExecutor {
return true;
/*}*/
}
+
+ //Check if target is the player him/her self
if(target == player)
{
sender.sendMessage(ChatColor.RED + "Cannot OpenInv yourself!");
return true;
}
+ //Permissions checks
if (!PermissionRelay.hasPermission(player, "OpenInv.override") && PermissionRelay.hasPermission(target, "OpenInv.exempt")) {
sender.sendMessage(ChatColor.RED + target.getDisplayName() + "'s inventory is protected!");
return true;
@@ -116,6 +133,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
return true;
}
+ //The actual openinv
history.lastPlayer = target.getName();
// Get the EntityPlayer handle from the sender
diff --git a/src/lishid/openinv/utils/PlayerInventoryChest.java b/src/lishid/openinv/utils/PlayerInventoryChest.java
index f199445..c3279a9 100644
--- a/src/lishid/openinv/utils/PlayerInventoryChest.java
+++ b/src/lishid/openinv/utils/PlayerInventoryChest.java
@@ -13,18 +13,18 @@ public class PlayerInventoryChest extends InventoryPlayer
this.items = inventory.items;
this.itemInHandIndex = inventory.itemInHandIndex;
this.e = inventory.e;
- this.b(inventory.j());
+ this.b(inventory.l());
inventory.d.defaultContainer = new ContainerPlayer(this, !inventory.d.world.isStatic);
inventory.d.activeContainer = inventory.d.defaultContainer;
}
@Override
public String getName() {
- return ((EntityPlayer)this.d).displayName + " (" + this.itemInHandIndex + ")";
+ return ((EntityPlayer)this.d).displayName;
}
@Override
- public boolean a_(EntityHuman entityhuman)
+ public boolean a(EntityHuman entityhuman)
{
return true;
}
diff --git a/src/plugin.yml b/src/plugin.yml
index 7c738b3..e40710c 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,6 +1,6 @@
name: OpenInv
main: lishid.openinv.OpenInv
-version: 1.3.3
+version: 1.4.1
author: lishid
description: >
This plugin allows you to open another player's inventory as a chest
@@ -14,4 +14,6 @@ commands:
usage: |
/ - [MinAmount] - Item can be the Item ID or the CraftBukkit Item Name, MinAmount is the minimum amount to be considered.
toggleopeninv:
- description: Toggle the stick usage
\ No newline at end of file
+ description: Toggle the stick openinv
+ usage: |
+ / [check] - Checks whether stick openinv is enabled
\ No newline at end of file