[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
This commit is contained in:
snowleo 2011-04-08 11:43:10 +00:00
parent 51ec3434f5
commit 22f9b76d77
3 changed files with 3 additions and 3 deletions

View file

@ -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);

View file

@ -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]);

View file

@ -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);