diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index a034bae108..623fc3f9e9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -4,7 +4,7 @@ import org.bukkit.command.*; import org.bukkit.entity.Player; import java.io.File; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -34,7 +34,7 @@ public final class CraftServer implements Server { private final CommandMap commandMap = new SimpleCommandMap(this); protected final MinecraftServer console; protected final ServerConfigurationManager server; - private final Map worlds = new HashMap(); + private final Map worlds = new LinkedHashMap(); public CraftServer(MinecraftServer console, ServerConfigurationManager server) { this.console = console; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0abcc9417f..168d85e575 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -73,11 +73,12 @@ public class CraftWorld implements World { } public Chunk[] getLoadedChunks() { - net.minecraft.server.Chunk[] chunks = (net.minecraft.server.Chunk[])provider.e.values().toArray(); + Object[] chunks = provider.e.values().toArray(); org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length]; for (int i = 0; i < chunks.length; i++) { - craftChunks[i] = chunks[i].bukkitChunk; + net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk)chunks[i]; + craftChunks[i] = chunk.bukkitChunk; } return craftChunks; @@ -122,6 +123,7 @@ public class CraftWorld implements World { provider.a(chunk); } + provider.a.remove(x, z); provider.a.remove(x, z); provider.e.remove(x, z); provider.f.remove(chunk); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index 24b8b22761..d881c0e821 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -1,18 +1,44 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityCreature; +import net.minecraft.server.EntityLiving; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Creature; +import org.bukkit.entity.LivingEntity; public class CraftCreature extends CraftLivingEntity implements Creature{ + private EntityCreature entity; public CraftCreature(CraftServer server, EntityCreature entity) { super(server, entity); + this.entity = entity; + } + + public void setTarget(LivingEntity target) { + if (target == null) { + entity.d = null; + } else if (target instanceof CraftLivingEntity) { + EntityLiving victim = ((CraftLivingEntity)target).getHandle(); + entity.d = victim; + entity.a = entity.world.a(entity, entity.d, 16.0F); + } + } + + public CraftLivingEntity getTarget() { + if (entity.d == null) { + return null; + } else { + return (CraftLivingEntity)entity.d.getBukkitEntity(); + } + } + + @Override + public EntityCreature getHandle() { + return entity; } @Override public String toString() { return "CraftCreature"; } - }