By: Tahg <tahgtahv@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2011-02-10 09:24:14 -05:00
commit 4b63a73ffe
3 changed files with 33 additions and 5 deletions

View file

@ -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<String, World> worlds = new HashMap<String, World>();
private final Map<String, World> worlds = new LinkedHashMap<String, World>();
public CraftServer(MinecraftServer console, ServerConfigurationManager server) {
this.console = console;

View file

@ -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);

View file

@ -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";
}
}