From 77ffc9c3c22723d421ba95ced0deb1b8fcfff3b6 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 20 Jan 2013 15:59:57 -0800 Subject: [PATCH] Removing unnecessary ArrayLists --- .../java/com/gmail/nossr50/listeners/WorldListener.java | 6 ++---- .../nossr50/util/blockmeta/chunkmeta/HashChunkManager.java | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index e532966f6..9783c0086 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -2,8 +2,6 @@ package com.gmail.nossr50.listeners; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import org.bukkit.Chunk; import org.bukkit.TreeType; @@ -81,9 +79,9 @@ public class WorldListener implements Listener { @EventHandler public void onChunkLoad(ChunkLoadEvent event) { Chunk chunk = event.getChunk(); - List chunkMobs = new ArrayList(Arrays.asList(chunk.getEntities())); + Entity[] chunkMobs = chunk.getEntities(); - if (chunkMobs.isEmpty()) + if (chunkMobs.length <= 0) return; for(Entity entity : chunkMobs) { diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java index 95e85cb2f..7de158767 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java @@ -8,7 +8,6 @@ import java.io.ObjectOutputStream; import java.lang.Boolean; import java.lang.Integer; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -189,7 +188,7 @@ public class HashChunkManager implements ChunkManager { iteratingMobs = true; - List chunkMobs = new ArrayList(Arrays.asList(world.getChunkAt(cx, cz).getEntities())); + Entity[] chunkMobs = world.getChunkAt(cx, cz).getEntities(); for (Entity entity : chunkMobs) { if(!(entity instanceof LivingEntity) && !(entity instanceof FallingBlock))