diff options
author | Alkalus <draknyte1@hotmail.com> | 2018-05-07 00:01:30 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 00:01:30 +0900 |
commit | 30c22ef725680a8e63a950bf34343d68c96340b2 (patch) | |
tree | b80773fdb59a8c6cc58b1cd50648b84515049a97 /src/Java/gtPlusPlus/core/commands | |
parent | 783fab7fbc954e2d5e1dd095f87f5e218907f279 (diff) | |
parent | 77ae94e6e239df8eccbace527f36a2dbc77af98a (diff) | |
download | GT5-Unofficial-30c22ef725680a8e63a950bf34343d68c96340b2.tar.gz GT5-Unofficial-30c22ef725680a8e63a950bf34343d68c96340b2.tar.bz2 GT5-Unofficial-30c22ef725680a8e63a950bf34343d68c96340b2.zip |
Merge pull request #270 from GTNewHorizons/DevCommandFix
Fixes the Dev command @Draknyte1 previously implemented.
Checks for valid player and also restricts usage to dev environments.
Diffstat (limited to 'src/Java/gtPlusPlus/core/commands')
-rw-r--r-- | src/Java/gtPlusPlus/core/commands/CommandMath.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/core/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java index a05bb42756..6ab0b2cbc6 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandMath.java +++ b/src/Java/gtPlusPlus/core/commands/CommandMath.java @@ -55,8 +55,8 @@ public class CommandMath implements ICommand public void processCommand(final ICommandSender S, final String[] argString){ final World W = S.getEntityWorld(); final EntityPlayer P = CommandUtils.getPlayer(S); - if (!W.isRemote){ - if (P.getDisplayName().toLowerCase().equals("draknyte1") || P.getCommandSenderName().toLowerCase().equals("draknyte1")) { + if (!W.isRemote && P != null){ + if (P.getDisplayName().toLowerCase().equals("draknyte1") || P.getCommandSenderName().toLowerCase().equals("draknyte1")) { String[] prefixes = new String[] { "ingot", "plate", @@ -83,8 +83,8 @@ public class CommandMath implements ICommand "Silver", "Lead", "Aluminium" - }; - AutoMap<EntityItem> itemEntities = new AutoMap<EntityItem>(); + }; + AutoMap<EntityItem> itemEntities = new AutoMap<EntityItem>(); for (String g : prefixes) { for (String s : loots) { itemEntities.put(new EntityItem(W, P.posX, P.posY, P.posZ, ItemUtils.getItemStackOfAmountFromOreDictNoBroken(g+s, 64))); @@ -92,7 +92,7 @@ public class CommandMath implements ICommand for (EntityItem e : itemEntities.values()) { e.lifespan = 30000; } - + } } @@ -194,6 +194,9 @@ public class CommandMath implements ICommand @Override public boolean canCommandSenderUseCommand(final ICommandSender var1){ final EntityPlayer P = CommandUtils.getPlayer(var1); + if (P == null){ + return false; + } if (P.getDisplayName().toLowerCase().equals("draknyte1") || P.getCommandSenderName().toLowerCase().equals("draknyte1")) { return true; } @@ -217,5 +220,4 @@ public class CommandMath implements ICommand return true; } -} - +}
\ No newline at end of file |