13
0
geforkt von Mirrors/Paper

Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.

By: Erik Broes <erikbroes@grum.nl>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2011-04-20 19:05:14 +02:00
Ursprung 91e69e54b4
Commit 070c214267
28 geänderte Dateien mit 255 neuen und 288 gelöschten Zeilen

Datei anzeigen

@ -39,7 +39,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId> <artifactId>minecraft-server</artifactId>
<version>1.4</version> <version>1.4_00_01</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -47,36 +47,11 @@
<groupId>net.sf.jopt-simple</groupId> <groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId> <artifactId>jopt-simple</artifactId>
<version>3.2</version> <version>3.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jline</groupId> <groupId>jline</groupId>
<artifactId>jline</artifactId> <artifactId>jline</artifactId>
<version>0.9.94</version> <version>0.9.94</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.14</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.avaje</groupId>
<artifactId>ebean</artifactId>
<version>2.7.3</version>
<type>jar</type>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<!-- This builds a completely 'ready to start' jar with all dependencies inside --> <!-- This builds a completely 'ready to start' jar with all dependencies inside -->
@ -149,13 +124,6 @@
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration>
<artifactSet>
<excludes>
<exclude>junit:junit</exclude>
</excludes>
</artifactSet>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>

Datei anzeigen

@ -23,9 +23,9 @@ public class CraftChunk implements Chunk {
public CraftChunk(net.minecraft.server.Chunk chunk) { public CraftChunk(net.minecraft.server.Chunk chunk) {
this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk); this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk);
worldServer = (WorldServer) getHandle().d; worldServer = (WorldServer) getHandle().world;
x = getHandle().j; x = getHandle().x;
z = getHandle().k; z = getHandle().z;
} }
public World getWorld() { public World getWorld() {
@ -35,7 +35,7 @@ public class CraftChunk implements Chunk {
public net.minecraft.server.Chunk getHandle() { public net.minecraft.server.Chunk getHandle() {
net.minecraft.server.Chunk c = weakChunk.get(); net.minecraft.server.Chunk c = weakChunk.get();
if (c == null) { if (c == null) {
c = worldServer.c(x,z); c = worldServer.getChunkAt(x,z);
weakChunk = new WeakReference<net.minecraft.server.Chunk>(c); weakChunk = new WeakReference<net.minecraft.server.Chunk>(c);
} }
return c; return c;
@ -77,12 +77,12 @@ public class CraftChunk implements Chunk {
int count = 0, index = 0; int count = 0, index = 0;
net.minecraft.server.Chunk chunk = getHandle(); net.minecraft.server.Chunk chunk = getHandle();
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
count += chunk.m[i].size(); count += chunk.entitySlices[i].size();
} }
Entity[] entities = new Entity[count]; Entity[] entities = new Entity[count];
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
for (Object obj: chunk.m[i].toArray()) { for (Object obj: chunk.entitySlices[i].toArray()) {
if (!(obj instanceof net.minecraft.server.Entity)) continue; if (!(obj instanceof net.minecraft.server.Entity)) continue;
entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity(); entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity();
} }
@ -93,11 +93,11 @@ public class CraftChunk implements Chunk {
public BlockState[] getTileEntities() { public BlockState[] getTileEntities() {
int index = 0; int index = 0;
net.minecraft.server.Chunk chunk = getHandle(); net.minecraft.server.Chunk chunk = getHandle();
BlockState[] entities = new BlockState[chunk.l.size()]; BlockState[] entities = new BlockState[chunk.tileEntities.size()];
for (Object obj : chunk.l.keySet().toArray()) { for (Object obj : chunk.tileEntities.keySet().toArray()) {
if (!(obj instanceof ChunkPosition)) continue; if (!(obj instanceof ChunkPosition)) continue;
ChunkPosition position = (ChunkPosition) obj; ChunkPosition position = (ChunkPosition) obj;
entities[index++] = worldServer.getWorld().getBlockAt(position.a + (chunk.j << 4), position.b, position.c + (chunk.k << 4)).getState(); entities[index++] = worldServer.getWorld().getBlockAt(position.x + (chunk.x << 4), position.y, position.z + (chunk.z << 4)).getState();
} }
return entities; return entities;
} }

Datei anzeigen

@ -127,11 +127,11 @@ public final class CraftServer implements Server {
} }
public Player[] getOnlinePlayers() { public Player[] getOnlinePlayers() {
List<EntityPlayer> online = server.b; List<EntityPlayer> online = server.players;
Player[] players = new Player[online.size()]; Player[] players = new Player[online.size()];
for (int i = 0; i < players.length; i++) { for (int i = 0; i < players.length; i++) {
players[i] = online.get(i).a.getPlayer(); players[i] = online.get(i).netServerHandler.getPlayer();
} }
return players; return players;
@ -167,7 +167,7 @@ public final class CraftServer implements Server {
} }
public Player getPlayer(final EntityPlayer entity) { public Player getPlayer(final EntityPlayer entity) {
return entity.a.getPlayer(); return entity.netServerHandler.getPlayer();
} }
public List<Player> matchPlayer(String partialName) { public List<Player> matchPlayer(String partialName) {
@ -192,7 +192,7 @@ public final class CraftServer implements Server {
} }
public int getMaxPlayers() { public int getMaxPlayers() {
return server.e; return server.maxPlayers;
} }
// NOTE: These are dependent on the corrisponding call in MinecraftServer // NOTE: These are dependent on the corrisponding call in MinecraftServer
@ -215,11 +215,11 @@ public final class CraftServer implements Server {
// NOTE: Temporary calls through to server.properies until its replaced // NOTE: Temporary calls through to server.properies until its replaced
private String getConfigString(String variable, String defaultValue) { private String getConfigString(String variable, String defaultValue) {
return this.console.d.a(variable, defaultValue); return this.console.propertyManager.getString(variable, defaultValue);
} }
private int getConfigInt(String variable, int defaultValue) { private int getConfigInt(String variable, int defaultValue) {
return this.console.d.a(variable, defaultValue); return this.console.propertyManager.getInt(variable, defaultValue);
} }
// End Temporary calls // End Temporary calls
@ -243,10 +243,10 @@ public final class CraftServer implements Server {
// NOTE: Should only be called from MinecraftServer.b() // NOTE: Should only be called from MinecraftServer.b()
public boolean dispatchCommand(CommandSender sender, ServerCommand serverCommand) { public boolean dispatchCommand(CommandSender sender, ServerCommand serverCommand) {
if ( commandMap.dispatch(sender, serverCommand.a) ) { if ( commandMap.dispatch(sender, serverCommand.command) ) {
return true; return true;
} }
return console.o.a(serverCommand); return console.consoleCommandHandler.handle(serverCommand);
} }
public boolean dispatchCommand(CommandSender sender, String commandLine) { public boolean dispatchCommand(CommandSender sender, String commandLine) {
@ -260,24 +260,24 @@ public final class CraftServer implements Server {
} }
// See if the server can process this command // See if the server can process this command
return console.o.a(new ServerCommand(commandLine, new CommandListener(sender))); return console.consoleCommandHandler.handle(new ServerCommand(commandLine, new CommandListener(sender)));
} }
public void reload() { public void reload() {
PropertyManager config = new PropertyManager(console.options); PropertyManager config = new PropertyManager(console.options);
console.d = config; console.propertyManager = config;
boolean animals = config.a("spawn-monsters", console.m); boolean animals = config.getBoolean("spawn-monsters", console.spawnAnimals);
boolean monsters = config.a("spawn-monsters", console.worlds.get(0).j > 0); boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).spawnMonsters > 0);
console.l = config.a("online-mode", console.l); console.onlineMode = config.getBoolean("online-mode", console.onlineMode);
console.m = config.a("spawn-animals", console.m); console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals);
console.n = config.a("pvp", console.n); console.pvpMode = config.getBoolean("pvp", console.pvpMode);
for (WorldServer world : console.worlds) { for (WorldServer world : console.worlds) {
world.j = monsters ? 1 : 0; world.spawnMonsters = monsters ? 1 : 0;
world.a(monsters, animals); world.setSpawnFlags(monsters, animals);
} }
pluginManager.clearPlugins(); pluginManager.clearPlugins();
@ -307,17 +307,17 @@ public final class CraftServer implements Server {
} }
Convertable converter = new WorldLoaderServer(folder); Convertable converter = new WorldLoaderServer(folder);
if (converter.a(name)) { if (converter.isConvertable(name)) {
getLogger().info("Converting world '" + name + "'"); getLogger().info("Converting world '" + name + "'");
converter.a(name, new ConvertProgressUpdater(console)); converter.convert(name, new ConvertProgressUpdater(console));
} }
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0, seed); WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0, seed);
internal.a(new WorldManager(console, internal)); internal.addIWorldAccess(new WorldManager(console, internal));
internal.j = 1; internal.spawnMonsters = 1;
internal.a(true, true); internal.setSpawnFlags(true, true);
console.f.a(internal); console.serverConfigurationManager.setPlayerFileData(internal);
console.worlds.add(internal); console.worlds.add(internal);
short short1 = 196; short short1 = 196;
@ -338,10 +338,10 @@ public final class CraftServer implements Server {
i = l; i = l;
} }
ChunkCoordinates chunkcoordinates = internal.m(); ChunkCoordinates chunkcoordinates = internal.getSpawn();
internal.u.c(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4); internal.chunkProviderServer.getChunkAt(chunkcoordinates.x + j >> 4, chunkcoordinates.z + k >> 4);
while (internal.f()) { while (internal.doLighting()) {
; ;
} }
} }
@ -363,7 +363,7 @@ public final class CraftServer implements Server {
} }
public Logger getLogger() { public Logger getLogger() {
return MinecraftServer.a; return MinecraftServer.log;
} }
public ConsoleReader getReader() { public ConsoleReader getReader() {
@ -381,7 +381,7 @@ public final class CraftServer implements Server {
} }
public void savePlayers() { public void savePlayers() {
server.d(); server.savePlayers();
} }
public void configureDbConfig(ServerConfig config) { public void configureDbConfig(ServerConfig config) {
@ -410,11 +410,11 @@ public final class CraftServer implements Server {
this.prefix = parts[parts.length-1]; this.prefix = parts[parts.length-1];
} }
public void b(String msg) { public void sendMessage(String msg) {
this.commandSender.sendMessage(msg); this.commandSender.sendMessage(msg);
} }
public String c() { public String getName() {
return this.prefix; return this.prefix;
} }
} }

Datei anzeigen

@ -34,9 +34,9 @@ public class CraftWorld implements World {
public CraftWorld(WorldServer world) { public CraftWorld(WorldServer world) {
this.world = world; this.world = world;
this.server = world.getServer(); this.server = world.getServer();
this.provider = world.u; this.provider = world.chunkProviderServer;
if (world.m instanceof WorldProviderHell) { if (world.worldProvider instanceof WorldProviderHell) {
environment = Environment.NETHER; environment = Environment.NETHER;
} else { } else {
environment = Environment.NORMAL; environment = Environment.NORMAL;
@ -63,18 +63,18 @@ public class CraftWorld implements World {
} }
public int getHighestBlockYAt(int x, int z) { public int getHighestBlockYAt(int x, int z) {
return world.d(x, z); return world.getHighestBlockYAt(x, z);
} }
public Location getSpawnLocation() { public Location getSpawnLocation() {
ChunkCoordinates spawn = world.m(); ChunkCoordinates spawn = world.getSpawn();
return new Location(this, spawn.a, spawn.b, spawn.c); return new Location(this, spawn.x, spawn.y, spawn.z);
} }
public boolean setSpawnLocation(int x, int y, int z) { public boolean setSpawnLocation(int x, int y, int z) {
try { try {
Location previousLocation = getSpawnLocation(); Location previousLocation = getSpawnLocation();
world.q.a(x, y, z); world.worldData.setSpawn(x, y, z);
// Notify anyone who's listening. // Notify anyone who's listening.
SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
@ -87,7 +87,7 @@ public class CraftWorld implements World {
} }
public Chunk getChunkAt(int x, int z) { public Chunk getChunkAt(int x, int z) {
return this.provider.c(x, z).bukkitChunk; return this.provider.getChunkAt(x,z).bukkitChunk;
} }
public Chunk getChunkAt(Block block) { public Chunk getChunkAt(Block block) {
@ -95,11 +95,11 @@ public class CraftWorld implements World {
} }
public boolean isChunkLoaded(int x, int z) { public boolean isChunkLoaded(int x, int z) {
return provider.a( x, z ); return provider.isChunkLoaded( x, z );
} }
public Chunk[] getLoadedChunks() { public Chunk[] getLoadedChunks() {
Object[] chunks = provider.e.values().toArray(); Object[] chunks = provider.chunks.values().toArray();
org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length]; org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length];
for (int i = 0; i < chunks.length; i++) { for (int i = 0; i < chunks.length; i++) {
@ -131,7 +131,7 @@ public class CraftWorld implements World {
return false; return false;
} }
provider.d(x, z); provider.queueUnload(x, z);
return true; return true;
} }
@ -141,18 +141,18 @@ public class CraftWorld implements World {
return false; return false;
} }
net.minecraft.server.Chunk chunk = provider.b(x, z); net.minecraft.server.Chunk chunk = provider.getOrCreateChunk(x, z);
if (save) { if (save) {
chunk.e(); chunk.removeEntities();
provider.b(chunk); provider.saveChunk(chunk);
provider.a(chunk); provider.saveChunkNOP(chunk);
} }
preserveChunk((CraftChunk)chunk.bukkitChunk); preserveChunk((CraftChunk) chunk.bukkitChunk);
provider.a.remove(x, z); provider.unloadQueue.remove(x, z);
provider.e.remove(x, z); provider.chunks.remove(x, z);
provider.f.remove(chunk); provider.chunkList.remove(chunk);
return true; return true;
} }
@ -160,14 +160,14 @@ public class CraftWorld implements World {
public boolean regenerateChunk(int x, int z) { public boolean regenerateChunk(int x, int z) {
unloadChunk(x, z, false, false); unloadChunk(x, z, false, false);
provider.a.remove(x, z); provider.unloadQueue.remove(x, z);
net.minecraft.server.Chunk chunk = null; net.minecraft.server.Chunk chunk = null;
if (provider.c == null) { if (provider.chunkProvider == null) {
chunk = provider.b; chunk = provider.emptyChunk;
} else { } else {
chunk = provider.c.b(x, z); chunk = provider.chunkProvider.getOrCreateChunk(x, z);
} }
chunkLoadPostProcess(chunk, x, z); chunkLoadPostProcess(chunk, x, z);
@ -191,9 +191,9 @@ public class CraftWorld implements World {
// The server will compress the chunk and send it to all clients // The server will compress the chunk and send it to all clients
for(int xx = px; xx < (px + 16); xx++) { for(int xx = px; xx < (px + 16); xx++) {
world.g(xx, 0, pz); world.notify(xx, 0, pz);
} }
world.g(px, 127, pz+15); world.notify(px, 127, pz+15);
return true; return true;
} }
@ -204,7 +204,7 @@ public class CraftWorld implements World {
for (Player player : players) { for (Player player : players) {
Location loc = player.getLocation(); Location loc = player.getLocation();
if (loc.getWorld() != provider.g.getWorld()) { if (loc.getWorld() != provider.world.getWorld()) {
continue; continue;
} }
@ -221,14 +221,14 @@ public class CraftWorld implements World {
public boolean loadChunk(int x, int z, boolean generate) { public boolean loadChunk(int x, int z, boolean generate) {
if (generate) { if (generate) {
// Use the default variant of loadChunk when generate == true. // Use the default variant of loadChunk when generate == true.
return provider.c(x, z) != null; return provider.getChunkAt(x, z) != null;
} }
provider.a.remove(x, z); provider.unloadQueue.remove(x, z);
net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) provider.e.get(x, z); net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) provider.chunks.get(x, z);
if (chunk == null) { if (chunk == null) {
chunk = provider.e(x, z); chunk = provider.loadChunk(x, z);
chunkLoadPostProcess(chunk, x, z); chunkLoadPostProcess(chunk, x, z);
} }
@ -237,26 +237,26 @@ public class CraftWorld implements World {
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) { private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
if (chunk != null) { if (chunk != null) {
provider.e.put(x, z, chunk); provider.chunks.put(x, z, chunk);
provider.f.add(chunk); provider.chunkList.add(chunk);
chunk.c(); chunk.loadNOP();
chunk.d(); chunk.addEntities();
if (!chunk.n && provider.a(x + 1, z + 1) && provider.a(x, z + 1) && provider.a(x + 1, z)) { if (!chunk.done && provider.isChunkLoaded(x + 1, z + 1) && provider.isChunkLoaded(x, z + 1) && provider.isChunkLoaded(x + 1, z)) {
provider.a(provider, x, z); provider.getChunkAt(provider, x, z);
} }
if (provider.a(x - 1, z) && !provider.b(x - 1, z).n && provider.a(x - 1, z + 1) && provider.a(x, z + 1) && provider.a(x - 1, z)) { if (provider.isChunkLoaded(x - 1, z) && !provider.getOrCreateChunk(x - 1, z).done && provider.isChunkLoaded(x - 1, z + 1) && provider.isChunkLoaded(x, z + 1) && provider.isChunkLoaded(x - 1, z)) {
provider.a(provider, x - 1, z); provider.getChunkAt(provider, x - 1, z);
} }
if (provider.a(x, z - 1) && !provider.b(x, z - 1).n && provider.a(x + 1, z - 1) && provider.a(x, z - 1) && provider.a(x + 1, z)) { if (provider.isChunkLoaded(x, z - 1) && !provider.getOrCreateChunk(x, z - 1).done && provider.isChunkLoaded(x + 1, z - 1) && provider.isChunkLoaded(x, z - 1) && provider.isChunkLoaded(x + 1, z)) {
provider.a(provider, x, z - 1); provider.getChunkAt(provider, x, z - 1);
} }
if (provider.a(x - 1, z - 1) && !provider.b(x - 1, z - 1).n && provider.a(x - 1, z - 1) && provider.a(x, z - 1) && provider.a(x - 1, z)) { if (provider.isChunkLoaded(x - 1, z - 1) && !provider.getOrCreateChunk(x - 1, z - 1).done && provider.isChunkLoaded(x - 1, z - 1) && provider.isChunkLoaded(x, z - 1) && provider.isChunkLoaded(x - 1, z)) {
provider.a(provider, x - 1, z - 1); provider.getChunkAt(provider, x - 1, z - 1);
} }
} }
} }
@ -281,17 +281,17 @@ public class CraftWorld implements World {
item.getDurability() item.getDurability()
); );
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack); EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
entity.c = 10; entity.pickupDelay = 10;
world.a(entity); world.addEntity(entity);
//TODO this is inconsistent with how Entity.getBukkitEntity() works. //TODO this is inconsistent with how Entity.getBukkitEntity() works.
// However, this entity is not at the moment backed by a server entity class so it may be left. // However, this entity is not at the moment backed by a server entity class so it may be left.
return new CraftItem(world.getServer(), entity); return new CraftItem(world.getServer(), entity);
} }
public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) { public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) {
double xs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; double xs = world.random.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
double ys = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; double ys = world.random.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
double zs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; double zs = world.random.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
loc = loc.clone(); loc = loc.clone();
loc.setX(loc.getX() + xs); loc.setX(loc.getX() + xs);
loc.setY(loc.getY() + ys); loc.setY(loc.getY() + ys);
@ -301,8 +301,8 @@ public class CraftWorld implements World {
public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) { public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) {
EntityArrow arrow = new EntityArrow(world); EntityArrow arrow = new EntityArrow(world);
arrow.c(loc.getX(), loc.getY(), loc.getZ(), 0, 0); arrow.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
world.a(arrow); world.addEntity(arrow);
arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread); arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
return (Arrow) arrow.getBukkitEntity(); return (Arrow) arrow.getBukkitEntity();
} }
@ -315,7 +315,7 @@ public class CraftWorld implements World {
loc.getZ(), loc.getZ(),
CraftMinecart.Type.Minecart.getId() CraftMinecart.Type.Minecart.getId()
); );
world.a(minecart); world.addEntity(minecart);
return (Minecart) minecart.getBukkitEntity(); return (Minecart) minecart.getBukkitEntity();
} }
@ -327,7 +327,7 @@ public class CraftWorld implements World {
loc.getZ(), loc.getZ(),
CraftMinecart.Type.StorageMinecart.getId() CraftMinecart.Type.StorageMinecart.getId()
); );
world.a(minecart); world.addEntity(minecart);
return (StorageMinecart) minecart.getBukkitEntity(); return (StorageMinecart) minecart.getBukkitEntity();
} }
@ -339,13 +339,13 @@ public class CraftWorld implements World {
loc.getZ(), loc.getZ(),
CraftMinecart.Type.PoweredMinecart.getId() CraftMinecart.Type.PoweredMinecart.getId()
); );
world.a(minecart); world.addEntity(minecart);
return (PoweredMinecart) minecart.getBukkitEntity(); return (PoweredMinecart) minecart.getBukkitEntity();
} }
public Boat spawnBoat(Location loc) { public Boat spawnBoat(Location loc) {
EntityBoat boat = new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ()); EntityBoat boat = new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ());
world.a(boat); world.addEntity(boat);
return (Boat) boat.getBukkitEntity(); return (Boat) boat.getBukkitEntity();
} }
@ -353,9 +353,9 @@ public class CraftWorld implements World {
LivingEntity creature; LivingEntity creature;
try { try {
EntityLiving entityCreature = (EntityLiving) EntityTypes.a(creatureType.getName(), world); EntityLiving entityCreature = (EntityLiving) EntityTypes.a(creatureType.getName(), world);
entityCreature.a(loc.getX(), loc.getY(), loc.getZ()); entityCreature.setPosition(loc.getX(), loc.getY(), loc.getZ());
creature = (LivingEntity) CraftEntity.getEntity(server, entityCreature); creature = (LivingEntity) CraftEntity.getEntity(server, entityCreature);
world.a(entityCreature); world.addEntity(entityCreature);
} catch (Exception e) { } catch (Exception e) {
// if we fail, for any reason, return null. // if we fail, for any reason, return null.
creature = null; creature = null;
@ -388,11 +388,11 @@ public class CraftWorld implements World {
} }
public String getName() { public String getName() {
return world.q.j; return world.worldData.name;
} }
public long getId() { public long getId() {
return world.q.b(); return world.worldData.b();
} }
@Override @Override
@ -413,16 +413,16 @@ public class CraftWorld implements World {
} }
public long getFullTime() { public long getFullTime() {
return world.l(); return world.getTime();
} }
public void setFullTime(long time) { public void setFullTime(long time) {
world.a(time); world.setTime(time);
//Forces the client to update to the new time immediately //Forces the client to update to the new time immediately
for (Player p: getPlayers()) { for (Player p: getPlayers()) {
CraftPlayer cp = (CraftPlayer) p; CraftPlayer cp = (CraftPlayer) p;
cp.getHandle().a.b(new Packet4UpdateTime(time)); cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(time));
} }
} }
@ -485,7 +485,7 @@ public class CraftWorld implements World {
public List<Entity> getEntities() { public List<Entity> getEntities() {
List<Entity> list = new ArrayList<Entity>(); List<Entity> list = new ArrayList<Entity>();
for (Object o: world.b) { for (Object o: world.entityList) {
if (o instanceof net.minecraft.server.Entity) { if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
Entity bukkitEntity = mcEnt.getBukkitEntity(); Entity bukkitEntity = mcEnt.getBukkitEntity();
@ -503,7 +503,7 @@ public class CraftWorld implements World {
public List<LivingEntity> getLivingEntities() { public List<LivingEntity> getLivingEntities() {
List<LivingEntity> list = new ArrayList<LivingEntity>(); List<LivingEntity> list = new ArrayList<LivingEntity>();
for (Object o: world.b) { for (Object o: world.entityList) {
if (o instanceof net.minecraft.server.Entity) { if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
Entity bukkitEntity = mcEnt.getBukkitEntity(); Entity bukkitEntity = mcEnt.getBukkitEntity();
@ -521,7 +521,7 @@ public class CraftWorld implements World {
public List<Player> getPlayers() { public List<Player> getPlayers() {
List<Player> list = new ArrayList<Player>(); List<Player> list = new ArrayList<Player>();
for (Object o : world.b) { for (Object o : world.entityList) {
if (o instanceof net.minecraft.server.Entity) { if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
Entity bukkitEntity = mcEnt.getBukkitEntity(); Entity bukkitEntity = mcEnt.getBukkitEntity();
@ -537,9 +537,9 @@ public class CraftWorld implements World {
public void save() { public void save() {
// Writes level.dat // Writes level.dat
world.t(); world.saveLevel();
// Saves all chunks/regions // Saves all chunks/regions
world.o.a(true, null); world.chunkProvider.saveChunks(true, null);
} }
} }

Datei anzeigen

@ -88,14 +88,14 @@ public class CraftBlock implements Block {
* @param data New block specific metadata * @param data New block specific metadata
*/ */
public void setData(final byte data) { public void setData(final byte data) {
chunk.getHandle().d.c(x, y, z, data); chunk.getHandle().world.setData(x, y, z, data);
} }
public void setData(final byte data, boolean applyPhysics) { public void setData(final byte data, boolean applyPhysics) {
if (applyPhysics) { if (applyPhysics) {
chunk.getHandle().d.c(x, y, z, data); chunk.getHandle().world.setData(x, y, z, data);
} else { } else {
chunk.getHandle().d.d(x, y, z, data); chunk.getHandle().world.setRawData(x, y, z, data);
} }
} }
@ -105,7 +105,7 @@ public class CraftBlock implements Block {
* @return block specific metadata * @return block specific metadata
*/ */
public byte getData() { public byte getData() {
return (byte) chunk.getHandle().b(this.x & 0xF, this.y & 0x7F, this.z & 0xF); return (byte) chunk.getHandle().getData(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
} }
/** /**
@ -124,24 +124,24 @@ public class CraftBlock implements Block {
* @return whether the block was changed * @return whether the block was changed
*/ */
public boolean setTypeId(final int type) { public boolean setTypeId(final int type) {
return chunk.getHandle().d.e(x, y, z, type); return chunk.getHandle().world.setRawTypeId(x, y, z, type);
} }
public boolean setTypeId(final int type, final boolean applyPhysics) { public boolean setTypeId(final int type, final boolean applyPhysics) {
if (applyPhysics) { if (applyPhysics) {
return setTypeId(type); return setTypeId(type);
} else { } else {
return chunk.getHandle().d.setTypeId(x, y, z, type); return chunk.getHandle().world.setRawTypeId(x, y, z, type);
} }
} }
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) { public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
if (applyPhysics) { if (applyPhysics) {
return chunk.getHandle().d.b(x, y, z, type, data); return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data);
} else { } else {
boolean success = chunk.getHandle().d.setTypeIdAndData(x, y, z, type, data); boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data);
if(success) { if (success) {
chunk.getHandle().d.g(x, y, z); chunk.getHandle().world.notify(x, y, z);
} }
return success; return success;
} }
@ -162,7 +162,7 @@ public class CraftBlock implements Block {
* @return block type-id * @return block type-id
*/ */
public int getTypeId() { public int getTypeId() {
return chunk.getHandle().a(this.x & 0xF, this.y & 0x7F, this.z & 0xF); return chunk.getHandle().getTypeId(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
} }
/** /**
@ -171,7 +171,7 @@ public class CraftBlock implements Block {
* @return light level * @return light level
*/ */
public byte getLightLevel() { public byte getLightLevel() {
return (byte) chunk.getHandle().d.j(this.x, this.y, this.z); return (byte) chunk.getHandle().world.getLightLevel(this.x, this.y, this.z);
} }
/** /**
@ -331,7 +331,7 @@ public class CraftBlock implements Block {
} }
public Biome getBiome() { public Biome getBiome() {
BiomeBase base = chunk.getHandle().d.a().a(x, z); BiomeBase base = chunk.getHandle().world.getWorldChunkManager().getBiome(x, z);
if (base == BiomeBase.RAINFOREST) { if (base == BiomeBase.RAINFOREST) {
return Biome.RAINFOREST; return Biome.RAINFOREST;
@ -363,11 +363,11 @@ public class CraftBlock implements Block {
} }
public boolean isBlockPowered() { public boolean isBlockPowered() {
return chunk.getHandle().d.o(x, y, z); return chunk.getHandle().world.isBlockPowered(x, y, z);
} }
public boolean isBlockIndirectlyPowered() { public boolean isBlockIndirectlyPowered() {
return chunk.getHandle().d.p(x, y, z); return chunk.getHandle().world.isBlockIndirectlyPowered(x, y, z);
} }
@Override @Override
@ -376,23 +376,23 @@ public class CraftBlock implements Block {
} }
public boolean isBlockFacePowered(BlockFace face) { public boolean isBlockFacePowered(BlockFace face) {
return chunk.getHandle().d.i(x, y, z, blockFaceToNotch(face)); return chunk.getHandle().world.isBlockFacePowered(x, y, z, blockFaceToNotch(face));
} }
public boolean isBlockFaceIndirectlyPowered(BlockFace face) { public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
return chunk.getHandle().d.j(x, y, z, blockFaceToNotch(face)); return chunk.getHandle().world.isBlockFaceIndirectlyPowered(x, y, z, blockFaceToNotch(face));
} }
public int getBlockPower(BlockFace face) { public int getBlockPower(BlockFace face) {
int power = 0; int power = 0;
BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE; BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE;
net.minecraft.server.World world = chunk.getHandle().d; net.minecraft.server.World world = chunk.getHandle().world;
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.i(x, y - 1, z, 0)) power = wire.f(world, x, y - 1, z, power); if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(x, y - 1, z, 0)) power = wire.getPower(world, x, y - 1, z, power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.i(x, y + 1, z, 1)) power = wire.f(world, x, y + 1, z, power); if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(x, y + 1, z, 1)) power = wire.getPower(world, x, y + 1, z, power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.i(x, y, z - 1, 2)) power = wire.f(world, x, y, z - 1, power); if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z - 1, 2)) power = wire.getPower(world, x, y, z - 1, power);
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.i(x, y, z + 1, 3)) power = wire.f(world, x, y, z + 1, power); if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(x, y, z + 1, 3)) power = wire.getPower(world, x, y, z + 1, power);
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.i(x - 1, y, z, 4)) power = wire.f(world, x - 1, y, z, power); if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(x - 1, y, z, 4)) power = wire.getPower(world, x - 1, y, z, power);
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.i(x + 1, y, z, 5)) power = wire.f(world, x + 1, y, z, power); if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(x + 1, y, z, 5)) power = wire.getPower(world, x + 1, y, z, power);
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0; return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
} }

Datei anzeigen

@ -32,7 +32,7 @@ public class CraftChest extends CraftBlockState implements Chest {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
chest.i(); chest.update();
} }
return result; return result;

Datei anzeigen

@ -18,15 +18,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
} }
public CreatureType getCreatureType() { public CreatureType getCreatureType() {
return CreatureType.fromName(spawner.h); return CreatureType.fromName(spawner.mobName);
} }
public void setCreatureType(CreatureType creatureType) { public void setCreatureType(CreatureType creatureType) {
spawner.h = creatureType.getName(); spawner.mobName = creatureType.getName();
} }
public String getCreatureTypeId() { public String getCreatureTypeId() {
return spawner.h; return spawner.mobName;
} }
public void setCreatureTypeId(String creatureType) { public void setCreatureTypeId(String creatureType) {
@ -35,15 +35,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
if (type == null) { if (type == null) {
return; return;
} }
spawner.h = type.getName(); spawner.mobName = type.getName();
} }
public int getDelay() { public int getDelay() {
return spawner.a; return spawner.spawnDelay;
} }
public void setDelay(int delay) { public void setDelay(int delay) {
spawner.a = delay; spawner.spawnDelay = delay;
} }
} }

Datei anzeigen

@ -36,7 +36,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
synchronized (block) { synchronized (block) {
if (block.getType() == Material.DISPENSER) { if (block.getType() == Material.DISPENSER) {
BlockDispenser dispense = (BlockDispenser)net.minecraft.server.Block.DISPENSER; BlockDispenser dispense = (BlockDispenser)net.minecraft.server.Block.DISPENSER;
dispense.b(world.getHandle(), getX(), getY(), getZ(), new Random()); dispense.dispense(world.getHandle(), getX(), getY(), getZ(), new Random());
return true; return true;
} else { } else {
return false; return false;
@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
dispenser.i(); dispenser.update();
} }
return result; return result;

Datei anzeigen

@ -32,25 +32,25 @@ public class CraftFurnace extends CraftBlockState implements Furnace {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
furnace.i(); furnace.update();
} }
return result; return result;
} }
public short getBurnTime() { public short getBurnTime() {
return (short)furnace.a; return (short)furnace.burnTime;
} }
public void setBurnTime(short burnTime) { public void setBurnTime(short burnTime) {
furnace.a = burnTime; furnace.burnTime = burnTime;
} }
public short getCookTime() { public short getCookTime() {
return (short)furnace.c; return (short)furnace.cookTime;
} }
public void setCookTime(short cookTime) { public void setCookTime(short cookTime) {
furnace.c = cookTime; furnace.cookTime = cookTime;
} }
} }

Datei anzeigen

@ -23,11 +23,11 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
} }
public byte getNote() { public byte getNote() {
return note.a; return note.note;
} }
public void setNote(byte n) { public void setNote(byte n) {
note.a = n; note.note = n;
} }
public boolean play() { public boolean play() {
@ -35,7 +35,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
synchronized (block) { synchronized (block) {
if (block.getType() == Material.NOTE_BLOCK) { if (block.getType() == Material.NOTE_BLOCK) {
note.a(world.getHandle(), getX(), getY(), getZ()); note.play(world.getHandle(), getX(), getY(), getZ());
return true; return true;
} else { } else {
return false; return false;

Datei anzeigen

@ -17,15 +17,15 @@ public class CraftSign extends CraftBlockState implements Sign {
} }
public String[] getLines() { public String[] getLines() {
return sign.a; return sign.lines;
} }
public String getLine(int index) throws IndexOutOfBoundsException { public String getLine(int index) throws IndexOutOfBoundsException {
return sign.a[index]; return sign.lines[index];
} }
public void setLine(int index, String line) throws IndexOutOfBoundsException { public void setLine(int index, String line) throws IndexOutOfBoundsException {
sign.a[index] = line; sign.lines[index] = line;
} }
@Override @Override
@ -33,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign {
boolean result = super.update(force); boolean result = super.update(force);
if (result) { if (result) {
sign.i(); sign.update();
} }
return result; return result;

Datei anzeigen

@ -14,18 +14,18 @@ public class CraftCreature extends CraftLivingEntity implements Creature{
public void setTarget(LivingEntity target) { public void setTarget(LivingEntity target) {
EntityCreature entity = getHandle(); EntityCreature entity = getHandle();
if (target == null) { if (target == null) {
entity.d = null; entity.target = null;
} else if (target instanceof CraftLivingEntity) { } else if (target instanceof CraftLivingEntity) {
EntityLiving victim = ((CraftLivingEntity) target).getHandle(); EntityLiving victim = ((CraftLivingEntity) target).getHandle();
entity.d = victim; entity.target = victim;
entity.a = entity.world.a(entity, entity.d, 16.0F); entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F);
} }
} }
public CraftLivingEntity getTarget() { public CraftLivingEntity getTarget() {
if (getHandle().d == null) return null; if (getHandle().target == null) return null;
return (CraftLivingEntity) getHandle().d.getBukkitEntity(); return (CraftLivingEntity) getHandle().target.getBukkitEntity();
} }
@Override @Override

Datei anzeigen

@ -77,9 +77,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityItem) { return new CraftItem( server, (EntityItem) entity); } else if (entity instanceof EntityItem) { return new CraftItem( server, (EntityItem) entity); }
else if (entity instanceof EntityMinecart) { else if (entity instanceof EntityMinecart) {
EntityMinecart mc = (EntityMinecart) entity; EntityMinecart mc = (EntityMinecart) entity;
if (mc.d == CraftMinecart.Type.StorageMinecart.getId()) { if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) {
return new CraftStorageMinecart(server, mc); return new CraftStorageMinecart(server, mc);
} else if (mc.d == CraftMinecart.Type.PoweredMinecart.getId()) { } else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) {
return new CraftPoweredMinecart(server, mc); return new CraftPoweredMinecart(server, mc);
} else { } else {
return new CraftMinecart(server, mc); return new CraftMinecart(server, mc);
@ -103,7 +103,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.motX = vel.getX(); entity.motX = vel.getX();
entity.motY = vel.getY(); entity.motY = vel.getY();
entity.motZ = vel.getZ(); entity.motZ = vel.getZ();
entity.aZ = true; entity.velocityChanged = true;
} }
public World getWorld() { public World getWorld() {
@ -112,8 +112,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean teleport(Location location) { public boolean teleport(Location location) {
entity.world = ((CraftWorld)location.getWorld()).getHandle(); entity.world = ((CraftWorld)location.getWorld()).getHandle();
entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// entity.b() throws no event, and so cannot be cancelled // entity.setLocation() throws no event, and so cannot be cancelled
return true; return true;
} }

Datei anzeigen

@ -15,11 +15,11 @@ public class CraftItem extends CraftEntity implements Item {
} }
public ItemStack getItemStack() { public ItemStack getItemStack() {
return new CraftItemStack(item.a); return new CraftItemStack(item.itemStack);
} }
public void setItemStack(ItemStack stack) { public void setItemStack(ItemStack stack) {
item.a = new net.minecraft.server.ItemStack(stack.getTypeId(), stack.getAmount(), stack.getDurability()); item.itemStack = new net.minecraft.server.ItemStack(stack.getTypeId(), stack.getAmount(), stack.getDurability());
} }
@Override @Override

Datei anzeigen

@ -59,14 +59,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Egg throwEgg() { public Egg throwEgg() {
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
EntityEgg egg = new EntityEgg(world, getHandle()); EntityEgg egg = new EntityEgg(world, getHandle());
world.a(egg); world.addEntity(egg);
return (Egg) egg.getBukkitEntity(); return (Egg) egg.getBukkitEntity();
} }
public Snowball throwSnowball() { public Snowball throwSnowball() {
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
EntitySnowball snowball = new EntitySnowball(world, getHandle()); EntitySnowball snowball = new EntitySnowball(world, getHandle());
world.a(snowball); world.addEntity(snowball);
return (Snowball) snowball.getBukkitEntity(); return (Snowball) snowball.getBukkitEntity();
} }
@ -120,7 +120,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Arrow shootArrow() { public Arrow shootArrow() {
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
EntityArrow arrow = new EntityArrow(world, getHandle()); EntityArrow arrow = new EntityArrow(world, getHandle());
world.a(arrow); world.addEntity(arrow);
return (Arrow) arrow.getBukkitEntity(); return (Arrow) arrow.getBukkitEntity();
} }
@ -167,11 +167,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} }
public void damage(int amount) { public void damage(int amount) {
entity.a((Entity)null, amount); entity.damageEntity((Entity) null, amount);
} }
public void damage(int amount, org.bukkit.entity.Entity source) { public void damage(int amount, org.bukkit.entity.Entity source) {
entity.a(((CraftEntity)source).getHandle(), amount); entity.damageEntity(((CraftEntity) source).getHandle(), amount);
} }
public Location getEyeLocation() { public Location getEyeLocation() {

Datei anzeigen

@ -39,11 +39,11 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
} }
public void setDamage(int damage) { public void setDamage(int damage) {
minecart.a = damage; minecart.damage = damage;
} }
public int getDamage() { public int getDamage() {
return minecart.a; return minecart.damage;
} }
public double getMaxSpeed() { public double getMaxSpeed() {

Datei anzeigen

@ -23,7 +23,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public boolean isOp() { public boolean isOp() {
return server.getHandle().h(getName()); return server.getHandle().isOp(getName());
} }
public boolean isPlayer() { public boolean isPlayer() {
@ -31,7 +31,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public boolean isOnline() { public boolean isOnline() {
for (Object obj: server.getHandle().b) { for (Object obj: server.getHandle().players) {
EntityPlayer player = (EntityPlayer) obj; EntityPlayer player = (EntityPlayer) obj;
if (player.name.equalsIgnoreCase(getName())) { if (player.name.equalsIgnoreCase(getName())) {
return true; return true;
@ -41,7 +41,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public InetSocketAddress getAddress() { public InetSocketAddress getAddress() {
SocketAddress addr = getHandle().a.b.b(); SocketAddress addr = getHandle().netServerHandler.networkManager.getSocketAddress();
if (addr instanceof InetSocketAddress) { if (addr instanceof InetSocketAddress) {
return (InetSocketAddress) addr; return (InetSocketAddress) addr;
} else { } else {
@ -76,12 +76,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void sendRawMessage(String message) { public void sendRawMessage(String message) {
getHandle().a.b(new Packet3Chat(message)); getHandle().netServerHandler.sendPacket(new Packet3Chat(message));
} }
public void sendMessage(String message) { public void sendMessage(String message) {
for (final String line: TextWrapper.wrapText(message)) { for (final String line: TextWrapper.wrapText(message)) {
getHandle().a.b(new Packet3Chat(line)); getHandle().netServerHandler.sendPacket(new Packet3Chat(line));
} }
} }
@ -121,12 +121,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void kickPlayer(String message) { public void kickPlayer(String message) {
getHandle().a.a(message == null ? "" : message); getHandle().netServerHandler.disconnect(message == null ? "" : message);
} }
public void setCompassTarget(Location loc) { public void setCompassTarget(Location loc) {
// Do not directly assign here, from the packethandler we'll assign it. // Do not directly assign here, from the packethandler we'll assign it.
getHandle().a.b((Packet) new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); getHandle().netServerHandler.sendPacket(new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
} }
public Location getCompassTarget() { public Location getCompassTarget() {
@ -134,7 +134,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void chat(String msg) { public void chat(String msg) {
getHandle().a.chat(msg); getHandle().netServerHandler.chat(msg);
} }
public boolean performCommand(String command) { public boolean performCommand(String command) {
@ -151,10 +151,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (oldWorld != newWorld) { if (oldWorld != newWorld) {
EntityPlayer newEntity = new EntityPlayer(manager.c, newWorld, entity.name, new ItemInWorldManager(newWorld)); EntityPlayer newEntity = new EntityPlayer(manager.server, newWorld, entity.name, new ItemInWorldManager(newWorld));
newEntity.id = entity.id; newEntity.id = entity.id;
newEntity.a = entity.a; newEntity.netServerHandler = entity.netServerHandler;
newEntity.health = entity.health; newEntity.health = entity.health;
newEntity.fireTicks = entity.fireTicks; newEntity.fireTicks = entity.fireTicks;
newEntity.inventory = entity.inventory; newEntity.inventory = entity.inventory;
@ -167,22 +167,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
newEntity.displayName = entity.displayName; newEntity.displayName = entity.displayName;
newEntity.compassTarget = entity.compassTarget; newEntity.compassTarget = entity.compassTarget;
newEntity.fauxSleeping = entity.fauxSleeping; newEntity.fauxSleeping = entity.fauxSleeping;
newWorld.u.c((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4); newWorld.chunkProviderServer.getChunkAt((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
teleportSuccess = newEntity.a.teleport(location); teleportSuccess = newEntity.netServerHandler.teleport(location);
if (teleportSuccess) { if (teleportSuccess) {
manager.c.k.a(entity); manager.server.tracker.trackPlayer(entity);
manager.c.k.b(entity); manager.server.tracker.untrackEntity(entity);
oldWorld.manager.b(entity); oldWorld.manager.removePlayer(entity);
manager.b.remove(entity); manager.players.remove(entity);
oldWorld.e(entity); oldWorld.removeEntity(entity);
newWorld.manager.a(newEntity); newWorld.manager.addPlayer(newEntity);
newWorld.a(newEntity); newWorld.addEntity(newEntity);
manager.b.add(newEntity); manager.players.add(newEntity);
entity.a.e = newEntity; entity.netServerHandler.player = newEntity;
this.entity = newEntity; this.entity = newEntity;
setCompassTarget(getCompassTarget()); setCompassTarget(getCompassTarget());
@ -190,33 +190,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return teleportSuccess; return teleportSuccess;
} else { } else {
return entity.a.teleport(location); return entity.netServerHandler.teleport(location);
} }
} }
public void setSneaking(boolean sneak) { public void setSneaking(boolean sneak) {
getHandle().e(sneak); getHandle().setSneak(sneak);
} }
public boolean isSneaking() { public boolean isSneaking() {
return getHandle().Z(); return getHandle().isSneaking();
} }
public void loadData() { public void loadData() {
server.getHandle().n.b(getHandle()); server.getHandle().playerFileData.b(getHandle());
} }
public void saveData() { public void saveData() {
server.getHandle().n.a(getHandle()); server.getHandle().playerFileData.a(getHandle());
} }
public void updateInventory() { public void updateInventory() {
getHandle().m(); getHandle().syncInventory();
} }
public void setSleepingIgnored(boolean isSleeping) { public void setSleepingIgnored(boolean isSleeping) {
getHandle().fauxSleeping = isSleeping; getHandle().fauxSleeping = isSleeping;
((CraftWorld)getWorld()).getHandle().checkSleepStatus(); ((CraftWorld) getWorld()).getHandle().checkSleepStatus();
} }
public boolean isSleepingIgnored() { public boolean isSleepingIgnored() {

Datei anzeigen

@ -10,8 +10,7 @@ import org.bukkit.entity.PoweredMinecart;
* *
* @author sk89q * @author sk89q
*/ */
public class CraftPoweredMinecart extends CraftMinecart public class CraftPoweredMinecart extends CraftMinecart implements PoweredMinecart {
implements PoweredMinecart {
public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) { public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) {
super(server, entity); super(server, entity);
} }

Datei anzeigen

@ -22,19 +22,19 @@ public class CraftSheep extends CraftAnimals implements Sheep {
} }
public DyeColor getColor() { public DyeColor getColor() {
return DyeColor.getByData((byte) getHandle().o()); return DyeColor.getByData((byte) getHandle().getColor());
} }
public void setColor(DyeColor color) { public void setColor(DyeColor color) {
getHandle().a_(color.getData()); getHandle().setColor(color.getData());
} }
public boolean isSheared() { public boolean isSheared() {
return getHandle().j_(); return getHandle().isSheared();
} }
public void setSheared(boolean flag) { public void setSheared(boolean flag) {
getHandle().a(flag); getHandle().setSheared(flag);
} }
} }

Datei anzeigen

@ -25,6 +25,6 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
} }
public void setSize(int size) { public void setSize(int size) {
getHandle().e(size); getHandle().setSize(size);
} }
} }

Datei anzeigen

@ -46,14 +46,14 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class CraftEventFactory { public class CraftEventFactory {
private static boolean canBuild(CraftWorld world, Player player, int x, int z) { private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
WorldServer worldServer = world.getHandle(); WorldServer worldServer = world.getHandle();
int spawnSize = worldServer.x.spawnProtection; int spawnSize = worldServer.server.spawnProtection;
if (spawnSize <= 0) return true; if (spawnSize <= 0) return true;
if (player.isOp()) return true; if (player.isOp()) return true;
ChunkCoordinates chunkcoordinates = worldServer.m(); ChunkCoordinates chunkcoordinates = worldServer.getSpawn();
int distanceFromSpawn = (int) Math.max(Math.abs(x - chunkcoordinates.a), Math.abs(z - chunkcoordinates.c)); int distanceFromSpawn = (int) Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z));
return distanceFromSpawn > spawnSize; return distanceFromSpawn > spawnSize;
} }

Datei anzeigen

@ -19,23 +19,23 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
} }
public int getSize() { public int getSize() {
return getInventory().q_(); return getInventory().getSize();
} }
public String getName() { public String getName() {
return getInventory().c(); return getInventory().getName();
} }
public ItemStack getItem(int index) { public CraftItemStack getItem(int index) {
return new CraftItemStack(getInventory().c_(index)); return new CraftItemStack(getInventory().getItem(index));
} }
public ItemStack[] getContents() { public CraftItemStack[] getContents() {
ItemStack[] items = new ItemStack[getSize()]; CraftItemStack[] items = new CraftItemStack[getSize()];
net.minecraft.server.ItemStack[] mcItems = getInventory().getContents(); net.minecraft.server.ItemStack[] mcItems = getInventory().getContents();
for (int i = 0; i < mcItems.length; i++ ) { for (int i = 0; i < mcItems.length; i++ ) {
items[i] = mcItems[i] == null ? null : new CraftItemStack(mcItems[i]); items[i] = new CraftItemStack(mcItems[i]);
} }
return items; return items;
@ -59,12 +59,12 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
} }
public void setItem(int index, ItemStack item) { public void setItem(int index, ItemStack item) {
getInventory().a(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability()))); getInventory().setItem(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability())));
} }
public boolean contains(int materialId) { public boolean contains(int materialId) {
for (ItemStack item: getContents()) { for (ItemStack item: getContents()) {
if (item != null && item.getTypeId() == materialId) { if (item.getTypeId() == materialId) {
return true; return true;
} }
} }
@ -90,11 +90,11 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
public boolean contains(int materialId, int amount) { public boolean contains(int materialId, int amount) {
int amt = 0; int amt = 0;
for (ItemStack item: getContents()) { for (ItemStack item: getContents()) {
if (item != null && item.getTypeId() == materialId) { if (item.getTypeId() == materialId && item.getAmount() >= amount) {
amt += item.getAmount(); return true;
} }
} }
return amt >= amount; return false;
} }
public boolean contains(Material material, int amount) { public boolean contains(Material material, int amount) {
@ -107,11 +107,11 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
} }
int amt = 0; int amt = 0;
for (ItemStack i: getContents()) { for (ItemStack i: getContents()) {
if (item.equals(i)) { if (item.equals(i) && item.getAmount() >= amount) {
amt += item.getAmount(); return true;
} }
} }
return amt >= amount; return false;
} }
public HashMap<Integer, ItemStack> all(int materialId) { public HashMap<Integer, ItemStack> all(int materialId) {
@ -312,7 +312,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
} }
private int getMaxItemStack() { private int getMaxItemStack() {
return getInventory().r_(); return getInventory().getMaxStackSize();
} }
public void remove(int materialId) { public void remove(int materialId) {

Datei anzeigen

@ -19,7 +19,7 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
} }
public CraftItemStack getItemInHand() { public CraftItemStack getItemInHand() {
return new CraftItemStack( getInventory().b() ); return new CraftItemStack( getInventory().getItemInHand() );
} }
public void setItemInHand(ItemStack stack) { public void setItemInHand(ItemStack stack) {
@ -27,22 +27,22 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
} }
public int getHeldItemSlot() { public int getHeldItemSlot() {
return getInventory().c; return getInventory().itemInHandIndex;
} }
public ItemStack getHelmet() { public CraftItemStack getHelmet() {
return getItem( getSize() + 3 ); return getItem( getSize() + 3 );
} }
public ItemStack getChestplate() { public CraftItemStack getChestplate() {
return getItem( getSize() + 2 ); return getItem( getSize() + 2 );
} }
public ItemStack getLeggings() { public CraftItemStack getLeggings() {
return getItem( getSize() + 1 ); return getItem( getSize() + 1 );
} }
public ItemStack getBoots() { public CraftItemStack getBoots() {
return getItem( getSize() + 0 ); return getItem( getSize() + 0 );
} }

Datei anzeigen

@ -121,6 +121,6 @@ public class CraftItemStack extends ItemStack {
@Override @Override
public int getMaxStackSize() { public int getMaxStackSize() {
return item.a().b(); return item.getItem().getMaxStackSize();
} }
} }

Datei anzeigen

@ -12,14 +12,14 @@ public class CraftSlot implements org.bukkit.inventory.Slot {
} }
public Inventory getInventory() { public Inventory getInventory() {
return new CraftInventory( slot.e ); return new CraftInventory( slot.inventory );
} }
public int getIndex() { public int getIndex() {
return slot.d; return slot.index;
} }
public ItemStack getItem() { public ItemStack getItem() {
return new CraftItemStack( slot.a() ); return new CraftItemStack( slot.getItem() );
} }
} }

Datei anzeigen

@ -13,8 +13,8 @@ public class LongHashtable<V> extends LongHash {
put(toLong(msw, lsw), value); put(toLong(msw, lsw), value);
if (value instanceof Chunk) { if (value instanceof Chunk) {
Chunk c = (Chunk) value; Chunk c = (Chunk) value;
if (msw != c.j || lsw != c.k) { if (msw != c.x || lsw != c.z) {
MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")"); MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")");
Throwable x = new Throwable(); Throwable x = new Throwable();
x.fillInStackTrace(); x.fillInStackTrace();
x.printStackTrace(); x.printStackTrace();
@ -26,8 +26,8 @@ public class LongHashtable<V> extends LongHash {
V value = get(toLong(msw, lsw)); V value = get(toLong(msw, lsw));
if (value instanceof Chunk) { if (value instanceof Chunk) {
Chunk c = (Chunk) value; Chunk c = (Chunk) value;
if (msw != c.j || lsw != c.k) { if (msw != c.x || lsw != c.z) {
MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")"); MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")");
Throwable x = new Throwable(); Throwable x = new Throwable();
x.fillInStackTrace(); x.fillInStackTrace();
x.printStackTrace(); x.printStackTrace();

Datei anzeigen

@ -12,6 +12,6 @@ public class ServerShutdownThread extends Thread {
@Override @Override
public void run() { public void run() {
server.g(); server.stop();
} }
} }