From f184c47341bfbac48d6509c6f0833ceb1575c94d Mon Sep 17 00:00:00 2001 From: CraftedMods Date: Wed, 12 Sep 2018 14:32:59 +0200 Subject: [PATCH] Applied the cleanup and formatting settings --- src/main/java/pvpmode/PvPEventHandler.java | 19 ++++++------------- src/main/java/pvpmode/PvPMode.java | 4 ++++ src/main/java/pvpmode/PvPUtils.java | 10 ++++++---- .../LootableBodiesCompatibilityModule.java | 3 +-- .../pvpmode/core/PvPModeClassTransformer.java | 8 +++++--- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/pvpmode/PvPEventHandler.java b/src/main/java/pvpmode/PvPEventHandler.java index 3fdc68d..dc72e94 100644 --- a/src/main/java/pvpmode/PvPEventHandler.java +++ b/src/main/java/pvpmode/PvPEventHandler.java @@ -343,7 +343,7 @@ public void onPlayerDeath (LivingDeathEvent event) // Categorize and process the stacks based on the action if (action == Action.DELETE || action == Action.DELETE_AND_DROP) { - this.addStack (deletedStacks, inventory, stack); + addStack (deletedStacks, inventory, stack); actions.add ( () -> { // Delete the item from the player's inventory @@ -352,7 +352,7 @@ public void onPlayerDeath (LivingDeathEvent event) } if (action == Action.DROP || action == Action.DELETE_AND_DROP) { - this.addStack (droppedStacks, inventory, stack); + addStack (droppedStacks, inventory, stack); actions.add ( () -> { // Drops the item in the world @@ -361,7 +361,7 @@ public void onPlayerDeath (LivingDeathEvent event) } if (action == Action.NOTHING) { - this.addStack (unprocessedStacks, inventory, stack); + addStack (unprocessedStacks, inventory, stack); } } }); @@ -446,30 +446,23 @@ private ItemStack[] getPlayerInventoryFromEnum (EntityPlayer player, EnumInvento private EnumInventory getEnumFromPlayerInventory (EntityPlayer player, ItemStack[] inventory, int index) { if (inventory == player.inventory.armorInventory) - { return EnumInventory.ARMOUR; - } else { if (index == player.inventory.currentItem) - { return EnumInventory.HELD; - } else if (index < 9) - { return EnumInventory.HOTBAR; - } - else - { - return EnumInventory.MAIN; - } + else return EnumInventory.MAIN; } } private void addStack (Map> map, EnumInventory inventory, ItemStack stack) { if (!map.containsKey (inventory)) + { map.put (inventory, new ArrayList<> ()); + } map.get (inventory).add (stack); } diff --git a/src/main/java/pvpmode/PvPMode.java b/src/main/java/pvpmode/PvPMode.java index a72549d..d49cbd0 100644 --- a/src/main/java/pvpmode/PvPMode.java +++ b/src/main/java/pvpmode/PvPMode.java @@ -300,10 +300,14 @@ public void serverLoad (FMLServerStartingEvent event) event.registerServerCommand (pvpconfigCommandInstance); if (!compatibilityManager.areModulesLoaded ()) + { compatibilityManager.loadRegisteredModules (); + } if (PvPMode.config.hasChanged ()) + { PvPMode.config.save (); // Save the configs of the compatibility modules + } } @EventHandler diff --git a/src/main/java/pvpmode/PvPUtils.java b/src/main/java/pvpmode/PvPUtils.java index 00ec064..9c53b9a 100644 --- a/src/main/java/pvpmode/PvPUtils.java +++ b/src/main/java/pvpmode/PvPUtils.java @@ -254,7 +254,9 @@ public static EntityPlayerMP getMaster (Entity entity) { owner = ((IEntityOwnable) owner).getOwner (); if (owner == null || entitiesChecked.contains (owner)) + { break; + } entitiesChecked.add (owner); if (owner instanceof EntityPlayerMP) return (EntityPlayerMP) owner; @@ -424,7 +426,7 @@ public static void displayPvPStats (ICommandSender sender, EntityPlayer displaye * Returns a map with the content of the source map, which is completely * unmodifiable, inclusive it's content and the content of the content and so * on. Changes made to the source map WON'T be backed by the returned map. - * + * * @param source * The original map * @return The deep unmodifiable map @@ -444,7 +446,7 @@ public static Map deepUnmodifiableMap (Map source) * Returns a list with the content of the source list, which is completely * unmodifiable, inclusive it's content and the content of the content and so * on. Changes made to the source list WON'T be backed by the returned list. - * + * * @param source * The original list * @return The deep unmodifiable list @@ -458,7 +460,7 @@ public static List deepUnmodifiableList (List source) * Returns a set with the content of the source set, which is completely * unmodifiable, inclusive it's content and the content of the content and so * on. Changes made to the source set WON'T be backed by the returned set. - * + * * @param source * The original list * @return The deep unmodifiable list @@ -473,7 +475,7 @@ public static Set deepUnmodifiableSet (Set source) * completely unmodifiable, inclusive it's content and the content of the * content and so on. Changes made to the source collection WON'T be backed by * the returned collection. - * + * * @param source * The original collection * @return The deep unmodifiable collection diff --git a/src/main/java/pvpmode/compatibility/modules/lootableBodies/LootableBodiesCompatibilityModule.java b/src/main/java/pvpmode/compatibility/modules/lootableBodies/LootableBodiesCompatibilityModule.java index 54762d3..9b8cd1a 100644 --- a/src/main/java/pvpmode/compatibility/modules/lootableBodies/LootableBodiesCompatibilityModule.java +++ b/src/main/java/pvpmode/compatibility/modules/lootableBodies/LootableBodiesCompatibilityModule.java @@ -3,7 +3,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cyano.lootable.LootableBodies; import cyano.lootable.entities.EntityLootableBody; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.*; @@ -93,7 +92,7 @@ public void onPartialItemPostDrop (PartialItemDropEvent.Post event) corpse.vacuumItem (new ItemStack (Items.bone, world.rand.nextInt (3) + 1)); } - world.spawnEntityInWorld ((Entity) corpse); + world.spawnEntityInWorld (corpse); corpse.setOwner (player.getGameProfile ()); corpse.setRotation (rotation); } diff --git a/src/main/java/pvpmode/core/PvPModeClassTransformer.java b/src/main/java/pvpmode/core/PvPModeClassTransformer.java index 59224af..afb3cda 100644 --- a/src/main/java/pvpmode/core/PvPModeClassTransformer.java +++ b/src/main/java/pvpmode/core/PvPModeClassTransformer.java @@ -30,7 +30,7 @@ public byte[] transform (String name, String transformedName, byte[] basicClass) private byte[] patchContainerPlayer (byte[] basicClass, boolean obfuscated) { - return this.patchMethod (basicClass, (node) -> + return patchMethod (basicClass, (node) -> { if (node.name.equals ("transferStackInSlot") || node.name.equals ("func_82846_b")) { @@ -64,7 +64,7 @@ public void playerDeathEvent (LivingDeathEvent event) private byte[] patchLootableBodiesEventHandler (byte[] basicClass) { - return this.patchMethod (basicClass, (node) -> + return patchMethod (basicClass, (node) -> { if (node.name.equals ("playerDeathEvent")) { @@ -105,7 +105,7 @@ private byte[] patchLootableBodiesEventHandler (byte[] basicClass) /** * Iterates through all methods of the specified class and allows patches for * them. If the processor returns false, the iteration will be stopped. - * + * * @param basicClass * The unmodified class * @param methodProcessor @@ -122,7 +122,9 @@ private byte[] patchMethod (byte[] basicClass, Predicate methodProce while (methods.hasNext ()) { if (!methodProcessor.test (methods.next ())) + { break; + } } ClassWriter writer = new ClassWriter (ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);