Skip to content

Commit

Permalink
Applied the cleanup and formatting settings
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftedMods committed Sep 12, 2018
1 parent 168b27a commit f184c47
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
19 changes: 6 additions & 13 deletions src/main/java/pvpmode/PvPEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -361,7 +361,7 @@ public void onPlayerDeath (LivingDeathEvent event)
}
if (action == Action.NOTHING)
{
this.addStack (unprocessedStacks, inventory, stack);
addStack (unprocessedStacks, inventory, stack);
}
}
});
Expand Down Expand Up @@ -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<EnumInventory, List<ItemStack>> map, EnumInventory inventory, ItemStack stack)
{
if (!map.containsKey (inventory))
{
map.put (inventory, new ArrayList<> ());
}
map.get (inventory).add (stack);
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/pvpmode/PvPMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/pvpmode/PvPUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -444,7 +446,7 @@ public static <K, J> Map<K, J> deepUnmodifiableMap (Map<K, J> 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
Expand All @@ -458,7 +460,7 @@ public static <K> List<K> deepUnmodifiableList (List<K> 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
Expand All @@ -473,7 +475,7 @@ public static <K> Set<K> deepUnmodifiableSet (Set<K> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/pvpmode/core/PvPModeClassTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand Down Expand Up @@ -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"))
{
Expand Down Expand Up @@ -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
Expand All @@ -122,7 +122,9 @@ private byte[] patchMethod (byte[] basicClass, Predicate<MethodNode> methodProce
while (methods.hasNext ())
{
if (!methodProcessor.test (methods.next ()))
{
break;
}
}

ClassWriter writer = new ClassWriter (ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
Expand Down

0 comments on commit f184c47

Please sign in to comment.