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 | |
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')
-rw-r--r-- | src/Java/gtPlusPlus/GTplusplus.java | 40 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/commands/CommandMath.java | 16 |
2 files changed, 30 insertions, 26 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 2abe195212..0aadef5e4b 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -101,7 +101,7 @@ public class GTplusplus implements ActionListener { CORE.USER_COUNTRY = GeoUtils.determineUsersCountry(); // Handle GT++ Config - ConfigHandler.handleConfigFile(event); + ConfigHandler.handleConfigFile(event); //Check for Dev CORE.DEVENV = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); @@ -146,8 +146,8 @@ public class GTplusplus implements ActionListener { proxy.postInit(event); BookHandler.runLater(); Core_Manager.postInit(); - RecipeGen_Recycling.executeGenerators(); - + RecipeGen_Recycling.executeGenerators(); + Logger.INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Logger.INFO("| Recipes succesfully Loaded: " + RegistrationHandler.recipesSuccess + " | Failed: " + RegistrationHandler.recipesFailed + " |"); @@ -162,7 +162,9 @@ public class GTplusplus implements ActionListener { @EventHandler public void serverStarting(final FMLServerStartingEvent event) { - event.registerServerCommand(new CommandMath()); + + if (CORE.DEVENV) + event.registerServerCommand(new CommandMath()); //Chunk Loading Timer h = ChunkManager.createChunkQueue(); @@ -192,15 +194,15 @@ public class GTplusplus implements ActionListener { public void actionPerformed(final ActionEvent arg0) { } - - + + /** * This {@link EventHandler} is called after the {@link FMLPostInitializationEvent} stages of all loaded mods executes successfully. * {@link #onLoadComplete(FMLLoadCompleteEvent)} exists to inject recipe generation after Gregtech and all other mods are entirely loaded and initialized. * @param event - The {@link EventHandler} object passed through from FML to {@link #GTplusplus()}'s {@link #instance}. */ @Mod.EventHandler - public void onLoadComplete(FMLLoadCompleteEvent event) { + public void onLoadComplete(FMLLoadCompleteEvent event) { RecipeGen_BlastSmelterGT_GTNH.generateGTNHBlastSmelterRecipesFromEBFList(); FishPondFakeRecipe.generateFishPondRecipes(); @@ -217,14 +219,14 @@ public class GTplusplus implements ActionListener { CORE.RA.addMultiblockElectrolyzerRecipe(x.mInputs, x.mFluidInputs, x.mFluidOutputs, x.mOutputs, x.mDuration, x.mEUt); } } - + //Advanced Vacuum Freezer generation for (GT_Recipe x : GT_Recipe.GT_Recipe_Map.sVacuumRecipes.mRecipeList) { - if (x != null && RecipeUtils.doesGregtechRecipeHaveEqualCells(x)) { + if (x != null && RecipeUtils.doesGregtechRecipeHaveEqualCells(x)) { CORE.RA.addAdvancedFreezerRecipe(x.mInputs, x.mFluidInputs, x.mFluidOutputs, x.mOutputs, (x.mDuration/2), x.mEUt); } } - + } protected void dumpGtRecipeMap(final GT_Recipe_Map r) { @@ -247,11 +249,11 @@ public class GTplusplus implements ActionListener { SegmentAnalytics.isEnabled = CORE.ConfigSwitches.enableUpdateChecker; if (!Utils.isServer() && PlayerUtils.isPlayerAlkalus()){ SegmentAnalytics.isEnabled = true; - } + } new SegmentHelper(); } - private static final boolean setupMaterialBlacklist(){ + private static final boolean setupMaterialBlacklist(){ int ID = 0; Material.invalidMaterials.put(ID++, Materials._NULL); Material.invalidMaterials.put(ID++, Materials.Clay); @@ -260,9 +262,9 @@ public class GTplusplus implements ActionListener { Material.invalidMaterials.put(ID++, Materials.Bronze); Material.invalidMaterials.put(ID++, Materials.Hydrogen); //Infused TC stuff - Material.invalidMaterials.put(ID++, Materials.InfusedAir); - Material.invalidMaterials.put(ID++, Materials.InfusedEarth); - Material.invalidMaterials.put(ID++, Materials.InfusedFire); + Material.invalidMaterials.put(ID++, Materials.InfusedAir); + Material.invalidMaterials.put(ID++, Materials.InfusedEarth); + Material.invalidMaterials.put(ID++, Materials.InfusedFire); Material.invalidMaterials.put(ID++, Materials.InfusedWater); //EIO Materials @@ -288,10 +290,10 @@ public class GTplusplus implements ActionListener { //Non GTNH Materials if (!CORE.GTNH){ //Mithril - Random Dungeon Loot - mGregMatLoader.enableMaterial(Materials.Mithril); - } + mGregMatLoader.enableMaterial(Materials.Mithril); + } //Force - Alloying - mGregMatLoader.enableMaterial(Materials.Force); + mGregMatLoader.enableMaterial(Materials.Force); } -} +}
\ No newline at end of file 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 |