Removing unnecessary ArrayLists

This commit is contained in:
Glitchfinder 2013-01-20 15:59:57 -08:00
parent 9a6ebb0b9a
commit 77ffc9c3c2
2 changed files with 3 additions and 6 deletions

View File

@ -2,8 +2,6 @@ package com.gmail.nossr50.listeners;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.TreeType; import org.bukkit.TreeType;
@ -81,9 +79,9 @@ public class WorldListener implements Listener {
@EventHandler @EventHandler
public void onChunkLoad(ChunkLoadEvent event) { public void onChunkLoad(ChunkLoadEvent event) {
Chunk chunk = event.getChunk(); Chunk chunk = event.getChunk();
List<Entity> chunkMobs = new ArrayList(Arrays.asList(chunk.getEntities())); Entity[] chunkMobs = chunk.getEntities();
if (chunkMobs.isEmpty()) if (chunkMobs.length <= 0)
return; return;
for(Entity entity : chunkMobs) { for(Entity entity : chunkMobs) {

View File

@ -8,7 +8,6 @@ import java.io.ObjectOutputStream;
import java.lang.Boolean; import java.lang.Boolean;
import java.lang.Integer; import java.lang.Integer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -189,7 +188,7 @@ public class HashChunkManager implements ChunkManager {
iteratingMobs = true; iteratingMobs = true;
List<Entity> chunkMobs = new ArrayList(Arrays.asList(world.getChunkAt(cx, cz).getEntities())); Entity[] chunkMobs = world.getChunkAt(cx, cz).getEntities();
for (Entity entity : chunkMobs) { for (Entity entity : chunkMobs) {
if(!(entity instanceof LivingEntity) && !(entity instanceof FallingBlock)) if(!(entity instanceof LivingEntity) && !(entity instanceof FallingBlock))