diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-08 11:43:10 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-08 11:43:10 +0000 |
commit | 22f9b76d77b78645b7a340980eadd241c5ef86c0 (patch) | |
tree | 4219975d70287117aa97378bcc8d4f4c4abce737 | |
parent | 51ec3434f5cd63dfd8b5f3b2090f37532a3ee399 (diff) | |
download | Essentials-22f9b76d77b78645b7a340980eadd241c5ef86c0.tar Essentials-22f9b76d77b78645b7a340980eadd241c5ef86c0.tar.gz Essentials-22f9b76d77b78645b7a340980eadd241c5ef86c0.tar.lz Essentials-22f9b76d77b78645b7a340980eadd241c5ef86c0.tar.xz Essentials-22f9b76d77b78645b7a340980eadd241c5ef86c0.zip |
[trunk] empty fields in Inventory now return null instead of Material.AIR
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1156 e251c2fe-e539-e718-e476-b85c1f46cddb
3 files changed, 3 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index b04ada85a..0259331c3 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -430,7 +430,7 @@ public class EssentialsPlayerListener extends PlayerListener } User user = User.get(event.getPlayer()); ItemStack is = user.getItemInHand(); - if (is.getType() == Material.AIR) { + if (is == null || is.getType() == Material.AIR) { return; } String command = user.getPowertool(is); diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index d7a6ff2e2..12f294dc7 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -287,7 +287,7 @@ public abstract class UserData extends PlayerExtension implements IConf { savedInventory = is; config.setProperty("inventory.size", is.length); for (int i = 0; i < is.length; i++) { - if (is[i].getType() == Material.AIR) { + if (is[i] == null || is[i].getType() == Material.AIR) { continue; } config.setProperty("inventory."+i, is[i]); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index 480097ca3..9489d4a1e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -16,7 +16,7 @@ public class Commandpowertool extends EssentialsCommand { protected void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception { ItemStack is = user.getItemInHand(); - if (is.getType() == Material.AIR) { + if (is == null || is.getType() == Material.AIR) { user.sendMessage("Command can't be attached to air."); } String command = getFinalArg(args, 0); |