mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 18:14:38 +02:00
[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:
@@ -430,7 +430,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
User user = User.get(event.getPlayer());
|
User user = User.get(event.getPlayer());
|
||||||
ItemStack is = user.getItemInHand();
|
ItemStack is = user.getItemInHand();
|
||||||
if (is.getType() == Material.AIR) {
|
if (is == null || is.getType() == Material.AIR) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String command = user.getPowertool(is);
|
String command = user.getPowertool(is);
|
||||||
|
@@ -287,7 +287,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
|||||||
savedInventory = is;
|
savedInventory = is;
|
||||||
config.setProperty("inventory.size", is.length);
|
config.setProperty("inventory.size", is.length);
|
||||||
for (int i = 0; i < is.length; i++) {
|
for (int i = 0; i < is.length; i++) {
|
||||||
if (is[i].getType() == Material.AIR) {
|
if (is[i] == null || is[i].getType() == Material.AIR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
config.setProperty("inventory."+i, is[i]);
|
config.setProperty("inventory."+i, is[i]);
|
||||||
|
@@ -16,7 +16,7 @@ public class Commandpowertool extends EssentialsCommand {
|
|||||||
protected void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception {
|
protected void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception {
|
||||||
|
|
||||||
ItemStack is = user.getItemInHand();
|
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.");
|
user.sendMessage("Command can't be attached to air.");
|
||||||
}
|
}
|
||||||
String command = getFinalArg(args, 0);
|
String command = getFinalArg(args, 0);
|
||||||
|
Reference in New Issue
Block a user