diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-04-20 19:05:14 +0200 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-04-20 19:05:14 +0200 |
commit | 483a878b8bcf1feb789cb5fd9374d0a060cc4d8a (patch) | |
tree | fb56faee3872a85282e2fa88235580589c826e45 /src/main/java/org/bukkit | |
parent | ac9f297445a6116c5bb314b3be9f38520a58845e (diff) | |
download | craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.gz craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.lz craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.xz craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.zip |
Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.
Diffstat (limited to 'src/main/java/org/bukkit')
27 files changed, 254 insertions, 255 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index fb854054..06df2b14 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -20,12 +20,12 @@ public class CraftChunk implements Chunk { private WorldServer worldServer; private int x; private int z; - + public CraftChunk(net.minecraft.server.Chunk chunk) { this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk); - worldServer = (WorldServer) getHandle().d; - x = getHandle().j; - z = getHandle().k; + worldServer = (WorldServer) getHandle().world; + x = getHandle().x; + z = getHandle().z; } public World getWorld() { @@ -35,7 +35,7 @@ public class CraftChunk implements Chunk { public net.minecraft.server.Chunk getHandle() { net.minecraft.server.Chunk c = weakChunk.get(); if (c == null) { - c = worldServer.c(x,z); + c = worldServer.getChunkAt(x,z); weakChunk = new WeakReference<net.minecraft.server.Chunk>(c); } return c; @@ -77,12 +77,12 @@ public class CraftChunk implements Chunk { int count = 0, index = 0; net.minecraft.server.Chunk chunk = getHandle(); for (int i = 0; i < 8; i++) { - count += chunk.m[i].size(); + count += chunk.entitySlices[i].size(); } Entity[] entities = new Entity[count]; 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; entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity(); } @@ -93,11 +93,11 @@ public class CraftChunk implements Chunk { public BlockState[] getTileEntities() { int index = 0; net.minecraft.server.Chunk chunk = getHandle(); - BlockState[] entities = new BlockState[chunk.l.size()]; - for (Object obj : chunk.l.keySet().toArray()) { - if (!(obj instanceof ChunkPosition)) continue; + BlockState[] entities = new BlockState[chunk.tileEntities.size()]; + for (Object obj : chunk.tileEntities.keySet().toArray()) { + if (!(obj instanceof ChunkPosition)) continue; 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; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index e15a39c5..90fbb28c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -127,11 +127,11 @@ public final class CraftServer implements Server { } public Player[] getOnlinePlayers() { - List<EntityPlayer> online = server.b; + List<EntityPlayer> online = server.players; Player[] players = new Player[online.size()]; for (int i = 0; i < players.length; i++) { - players[i] = online.get(i).a.getPlayer(); + players[i] = online.get(i).netServerHandler.getPlayer(); } return players; @@ -167,7 +167,7 @@ public final class CraftServer implements Server { } public Player getPlayer(final EntityPlayer entity) { - return entity.a.getPlayer(); + return entity.netServerHandler.getPlayer(); } public List<Player> matchPlayer(String partialName) { @@ -192,7 +192,7 @@ public final class CraftServer implements Server { } public int getMaxPlayers() { - return server.e; + return server.maxPlayers; } // 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 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) { - return this.console.d.a(variable, defaultValue); + return this.console.propertyManager.getInt(variable, defaultValue); } // End Temporary calls @@ -243,10 +243,10 @@ public final class CraftServer implements Server { // NOTE: Should only be called from MinecraftServer.b() public boolean dispatchCommand(CommandSender sender, ServerCommand serverCommand) { - if ( commandMap.dispatch(sender, serverCommand.a) ) { + if ( commandMap.dispatch(sender, serverCommand.command) ) { return true; } - return console.o.a(serverCommand); + return console.consoleCommandHandler.handle(serverCommand); } 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 - return console.o.a(new ServerCommand(commandLine, new CommandListener(sender))); + return console.consoleCommandHandler.handle(new ServerCommand(commandLine, new CommandListener(sender))); } public void reload() { PropertyManager config = new PropertyManager(console.options); - console.d = config; + console.propertyManager = config; - boolean animals = config.a("spawn-monsters", console.m); - boolean monsters = config.a("spawn-monsters", console.worlds.get(0).j > 0); + boolean animals = config.getBoolean("spawn-monsters", console.spawnAnimals); + boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).spawnMonsters > 0); - console.l = config.a("online-mode", console.l); - console.m = config.a("spawn-animals", console.m); - console.n = config.a("pvp", console.n); + console.onlineMode = config.getBoolean("online-mode", console.onlineMode); + console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals); + console.pvpMode = config.getBoolean("pvp", console.pvpMode); for (WorldServer world : console.worlds) { - world.j = monsters ? 1 : 0; - world.a(monsters, animals); + world.spawnMonsters = monsters ? 1 : 0; + world.setSpawnFlags(monsters, animals); } pluginManager.clearPlugins(); @@ -307,17 +307,17 @@ public final class CraftServer implements Server { } Convertable converter = new WorldLoaderServer(folder); - if (converter.a(name)) { + if (converter.isConvertable(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); - internal.a(new WorldManager(console, internal)); - internal.j = 1; - internal.a(true, true); - console.f.a(internal); + internal.addIWorldAccess(new WorldManager(console, internal)); + internal.spawnMonsters = 1; + internal.setSpawnFlags(true, true); + console.serverConfigurationManager.setPlayerFileData(internal); console.worlds.add(internal); short short1 = 196; @@ -338,10 +338,10 @@ public final class CraftServer implements Server { i = l; } - ChunkCoordinates chunkcoordinates = internal.m(); - internal.u.c(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4); + ChunkCoordinates chunkcoordinates = internal.getSpawn(); + 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() { - return MinecraftServer.a; + return MinecraftServer.log; } public ConsoleReader getReader() { @@ -381,7 +381,7 @@ public final class CraftServer implements Server { } public void savePlayers() { - server.d(); + server.savePlayers(); } public void configureDbConfig(ServerConfig config) { @@ -410,11 +410,11 @@ public final class CraftServer implements Server { this.prefix = parts[parts.length-1]; } - public void b(String msg) { + public void sendMessage(String msg) { this.commandSender.sendMessage(msg); } - public String c() { + public String getName() { return this.prefix; } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index b487b6d5..162a2bfb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -34,9 +34,9 @@ public class CraftWorld implements World { public CraftWorld(WorldServer world) { this.world = world; 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; } else { environment = Environment.NORMAL; @@ -63,18 +63,18 @@ public class CraftWorld implements World { } public int getHighestBlockYAt(int x, int z) { - return world.d(x, z); + return world.getHighestBlockYAt(x, z); } public Location getSpawnLocation() { - ChunkCoordinates spawn = world.m(); - return new Location(this, spawn.a, spawn.b, spawn.c); + ChunkCoordinates spawn = world.getSpawn(); + return new Location(this, spawn.x, spawn.y, spawn.z); } - + public boolean setSpawnLocation(int x, int y, int z) { try { Location previousLocation = getSpawnLocation(); - world.q.a(x, y, z); + world.worldData.setSpawn(x, y, z); // Notify anyone who's listening. SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); @@ -85,9 +85,9 @@ public class CraftWorld implements World { return false; } } - + 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) { @@ -95,11 +95,11 @@ public class CraftWorld implements World { } public boolean isChunkLoaded(int x, int z) { - return provider.a( x, z ); + return provider.isChunkLoaded( x, z ); } public Chunk[] getLoadedChunks() { - Object[] chunks = provider.e.values().toArray(); + Object[] chunks = provider.chunks.values().toArray(); org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length]; for (int i = 0; i < chunks.length; i++) { @@ -131,7 +131,7 @@ public class CraftWorld implements World { return false; } - provider.d(x, z); + provider.queueUnload(x, z); return true; } @@ -140,34 +140,34 @@ public class CraftWorld implements World { if (safe && isChunkInUse(x, z)) { return false; } - - net.minecraft.server.Chunk chunk = provider.b(x, z); - + + net.minecraft.server.Chunk chunk = provider.getOrCreateChunk(x, z); + if (save) { - chunk.e(); - provider.b(chunk); - provider.a(chunk); + chunk.removeEntities(); + provider.saveChunk(chunk); + provider.saveChunkNOP(chunk); } - preserveChunk((CraftChunk)chunk.bukkitChunk); - provider.a.remove(x, z); - provider.e.remove(x, z); - provider.f.remove(chunk); - + preserveChunk((CraftChunk) chunk.bukkitChunk); + provider.unloadQueue.remove(x, z); + provider.chunks.remove(x, z); + provider.chunkList.remove(chunk); + return true; } public boolean regenerateChunk(int x, int z) { unloadChunk(x, z, false, false); - provider.a.remove(x, z); + provider.unloadQueue.remove(x, z); net.minecraft.server.Chunk chunk = null; - if (provider.c == null) { - chunk = provider.b; + if (provider.chunkProvider == null) { + chunk = provider.emptyChunk; } else { - chunk = provider.c.b(x, z); + chunk = provider.chunkProvider.getOrCreateChunk(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 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; } @@ -201,10 +201,10 @@ public class CraftWorld implements World { public boolean isChunkInUse(int x, int z) { Player[] players = server.getOnlinePlayers(); - + for (Player player : players) { Location loc = player.getLocation(); - if (loc.getWorld() != provider.g.getWorld()) { + if (loc.getWorld() != provider.world.getWorld()) { continue; } @@ -221,14 +221,14 @@ public class CraftWorld implements World { public boolean loadChunk(int x, int z, boolean generate) { if (generate) { // 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); - net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) provider.e.get(x, z); + provider.unloadQueue.remove(x, z); + net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) provider.chunks.get(x, z); if (chunk == null) { - chunk = provider.e(x, z); + chunk = provider.loadChunk(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) { if (chunk != null) { - provider.e.put(x, z, chunk); - provider.f.add(chunk); + provider.chunks.put(x, z, chunk); + provider.chunkList.add(chunk); - chunk.c(); - chunk.d(); + chunk.loadNOP(); + chunk.addEntities(); - if (!chunk.n && provider.a(x + 1, z + 1) && provider.a(x, z + 1) && provider.a(x + 1, z)) { - provider.a(provider, x, z); + if (!chunk.done && provider.isChunkLoaded(x + 1, z + 1) && provider.isChunkLoaded(x, z + 1) && provider.isChunkLoaded(x + 1, 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)) { - provider.a(provider, 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.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)) { - provider.a(provider, x, z - 1); + 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.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)) { - provider.a(provider, x - 1, z - 1); + 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.getChunkAt(provider, x - 1, z - 1); } } } @@ -281,17 +281,17 @@ public class CraftWorld implements World { item.getDurability() ); EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack); - entity.c = 10; - world.a(entity); + entity.pickupDelay = 10; + world.addEntity(entity); //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. return new CraftItem(world.getServer(), entity); } public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) { - double xs = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; - double ys = world.k.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D; - double zs = 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.random.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.setX(loc.getX() + xs); 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) { EntityArrow arrow = new EntityArrow(world); - arrow.c(loc.getX(), loc.getY(), loc.getZ(), 0, 0); - world.a(arrow); + arrow.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), 0, 0); + world.addEntity(arrow); arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread); return (Arrow) arrow.getBukkitEntity(); } @@ -315,7 +315,7 @@ public class CraftWorld implements World { loc.getZ(), CraftMinecart.Type.Minecart.getId() ); - world.a(minecart); + world.addEntity(minecart); return (Minecart) minecart.getBukkitEntity(); } @@ -327,7 +327,7 @@ public class CraftWorld implements World { loc.getZ(), CraftMinecart.Type.StorageMinecart.getId() ); - world.a(minecart); + world.addEntity(minecart); return (StorageMinecart) minecart.getBukkitEntity(); } @@ -339,13 +339,13 @@ public class CraftWorld implements World { loc.getZ(), CraftMinecart.Type.PoweredMinecart.getId() ); - world.a(minecart); + world.addEntity(minecart); return (PoweredMinecart) minecart.getBukkitEntity(); } public Boat spawnBoat(Location loc) { EntityBoat boat = new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ()); - world.a(boat); + world.addEntity(boat); return (Boat) boat.getBukkitEntity(); } @@ -353,9 +353,9 @@ public class CraftWorld implements World { LivingEntity creature; try { 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); - world.a(entityCreature); + world.addEntity(entityCreature); } catch (Exception e) { // if we fail, for any reason, return null. creature = null; @@ -388,11 +388,11 @@ public class CraftWorld implements World { } public String getName() { - return world.q.j; + return world.worldData.name; } public long getId() { - return world.q.b(); + return world.worldData.b(); } @Override @@ -413,16 +413,16 @@ public class CraftWorld implements World { } public long getFullTime() { - return world.l(); + return world.getTime(); } public void setFullTime(long time) { - world.a(time); + world.setTime(time); //Forces the client to update to the new time immediately for (Player p: getPlayers()) { 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() { List<Entity> list = new ArrayList<Entity>(); - for (Object o: world.b) { + for (Object o: world.entityList) { if (o instanceof net.minecraft.server.Entity) { net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; Entity bukkitEntity = mcEnt.getBukkitEntity(); @@ -503,7 +503,7 @@ public class CraftWorld implements World { public List<LivingEntity> getLivingEntities() { List<LivingEntity> list = new ArrayList<LivingEntity>(); - for (Object o: world.b) { + for (Object o: world.entityList) { if (o instanceof net.minecraft.server.Entity) { net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; Entity bukkitEntity = mcEnt.getBukkitEntity(); @@ -521,11 +521,11 @@ public class CraftWorld implements World { public List<Player> getPlayers() { List<Player> list = new ArrayList<Player>(); - for (Object o : world.b) { + for (Object o : world.entityList) { if (o instanceof net.minecraft.server.Entity) { net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; Entity bukkitEntity = mcEnt.getBukkitEntity(); - + if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) { list.add((Player)bukkitEntity); } @@ -537,9 +537,9 @@ public class CraftWorld implements World { public void save() { // Writes level.dat - world.t(); + world.saveLevel(); // Saves all chunks/regions - world.o.a(true, null); + world.chunkProvider.saveChunks(true, null); } } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index cde4dc93..6891aedd 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -88,14 +88,14 @@ public class CraftBlock implements Block { * @param data New block specific metadata */ 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) { if (applyPhysics) { - chunk.getHandle().d.c(x, y, z, data); + chunk.getHandle().world.setData(x, y, z, data); } 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 */ 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 */ 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) { if (applyPhysics) { return setTypeId(type); } 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) { if (applyPhysics) { - return chunk.getHandle().d.b(x, y, z, type, data); + return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data); } else { - boolean success = chunk.getHandle().d.setTypeIdAndData(x, y, z, type, data); - if(success) { - chunk.getHandle().d.g(x, y, z); + boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data); + if (success) { + chunk.getHandle().world.notify(x, y, z); } return success; } @@ -162,7 +162,7 @@ public class CraftBlock implements Block { * @return block type-id */ 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 */ 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() { - BiomeBase base = chunk.getHandle().d.a().a(x, z); + BiomeBase base = chunk.getHandle().world.getWorldChunkManager().getBiome(x, z); if (base == BiomeBase.RAINFOREST) { return Biome.RAINFOREST; @@ -363,11 +363,11 @@ public class CraftBlock implements Block { } public boolean isBlockPowered() { - return chunk.getHandle().d.o(x, y, z); + return chunk.getHandle().world.isBlockPowered(x, y, z); } public boolean isBlockIndirectlyPowered() { - return chunk.getHandle().d.p(x, y, z); + return chunk.getHandle().world.isBlockIndirectlyPowered(x, y, z); } @Override @@ -376,26 +376,26 @@ public class CraftBlock implements Block { } 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) { - 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) { int power = 0; BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE; - net.minecraft.server.World world = chunk.getHandle().d; - 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.UP || face == BlockFace.SELF) && world.i(x, y + 1, z, 1)) power = wire.f(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.WEST || face == BlockFace.SELF) && world.i(x, y, z + 1, 3)) power = wire.f(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.SOUTH || face == BlockFace.SELF) && world.i(x + 1, y, z, 5)) power = wire.f(world, x + 1, y, z, power); + net.minecraft.server.World world = chunk.getHandle().world; + 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.isBlockFacePowered(x, y + 1, z, 1)) power = wire.getPower(world, x, y + 1, z, 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.isBlockFacePowered(x, y, z + 1, 3)) power = wire.getPower(world, x, y, z + 1, 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.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; } - + public int getBlockPower() { return getBlockPower(BlockFace.SELF); } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java index c389d3a2..5d1c963e 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -32,7 +32,7 @@ public class CraftChest extends CraftBlockState implements Chest { boolean result = super.update(force); if (result) { - chest.i(); + chest.update(); } return result; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java index 2acab116..9af5f12f 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -18,15 +18,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa } public CreatureType getCreatureType() { - return CreatureType.fromName(spawner.h); + return CreatureType.fromName(spawner.mobName); } public void setCreatureType(CreatureType creatureType) { - spawner.h = creatureType.getName(); + spawner.mobName = creatureType.getName(); } public String getCreatureTypeId() { - return spawner.h; + return spawner.mobName; } public void setCreatureTypeId(String creatureType) { @@ -35,15 +35,15 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa if (type == null) { return; } - spawner.h = type.getName(); + spawner.mobName = type.getName(); } - + public int getDelay() { - return spawner.a; + return spawner.spawnDelay; } public void setDelay(int delay) { - spawner.a = delay; + spawner.spawnDelay = delay; } } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java index d2f432d8..4a6410a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java @@ -36,7 +36,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser { synchronized (block) { if (block.getType() == Material.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; } else { return false; @@ -49,7 +49,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser { boolean result = super.update(force); if (result) { - dispenser.i(); + dispenser.update(); } return result; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java index feb8a848..f266ece4 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -32,25 +32,25 @@ public class CraftFurnace extends CraftBlockState implements Furnace { boolean result = super.update(force); if (result) { - furnace.i(); + furnace.update(); } return result; } public short getBurnTime() { - return (short)furnace.a; + return (short)furnace.burnTime; } public void setBurnTime(short burnTime) { - furnace.a = burnTime; + furnace.burnTime = burnTime; } public short getCookTime() { - return (short)furnace.c; + return (short)furnace.cookTime; } public void setCookTime(short cookTime) { - furnace.c = cookTime; + furnace.cookTime = cookTime; } } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java index ec49c9f9..f2c1615a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java @@ -23,11 +23,11 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock { } public byte getNote() { - return note.a; + return note.note; } public void setNote(byte n) { - note.a = n; + note.note = n; } public boolean play() { @@ -35,7 +35,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock { synchronized (block) { if (block.getType() == Material.NOTE_BLOCK) { - note.a(world.getHandle(), getX(), getY(), getZ()); + note.play(world.getHandle(), getX(), getY(), getZ()); return true; } else { return false; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java index 5983c3dd..c3e9d238 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -17,15 +17,15 @@ public class CraftSign extends CraftBlockState implements Sign { } public String[] getLines() { - return sign.a; + return sign.lines; } public String getLine(int index) throws IndexOutOfBoundsException { - return sign.a[index]; + return sign.lines[index]; } public void setLine(int index, String line) throws IndexOutOfBoundsException { - sign.a[index] = line; + sign.lines[index] = line; } @Override @@ -33,7 +33,7 @@ public class CraftSign extends CraftBlockState implements Sign { boolean result = super.update(force); if (result) { - sign.i(); + sign.update(); } return result; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index 8749f131..7066de58 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -14,18 +14,18 @@ public class CraftCreature extends CraftLivingEntity implements Creature{ public void setTarget(LivingEntity target) { EntityCreature entity = getHandle(); if (target == null) { - entity.d = null; + entity.target = null; } else if (target instanceof CraftLivingEntity) { EntityLiving victim = ((CraftLivingEntity) target).getHandle(); - entity.d = victim; - entity.a = entity.world.a(entity, entity.d, 16.0F); + entity.target = victim; + entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F); } } 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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index af535ba2..c1e03dc8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -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 EntityMinecart) { EntityMinecart mc = (EntityMinecart) entity; - if (mc.d == CraftMinecart.Type.StorageMinecart.getId()) { + if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) { 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); } else { return new CraftMinecart(server, mc); @@ -103,7 +103,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { entity.motX = vel.getX(); entity.motY = vel.getY(); entity.motZ = vel.getZ(); - entity.aZ = true; + entity.velocityChanged = true; } public World getWorld() { @@ -112,8 +112,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public boolean teleport(Location location) { entity.world = ((CraftWorld)location.getWorld()).getHandle(); - entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - // entity.b() throws no event, and so cannot be cancelled + entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + // entity.setLocation() throws no event, and so cannot be cancelled return true; } @@ -153,7 +153,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public void setFireTicks(int ticks) { entity.fireTicks = ticks; } - + public void remove() { entity.dead = true; } @@ -238,11 +238,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { getHandle().passenger.setPassengerOf(null); return true; } - + public float getFallDistance() { return getHandle().fallDistance; } - + public void setFallDistance(float distance) { getHandle().fallDistance = distance; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index 86bcce0e..4bb98b0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -15,11 +15,11 @@ public class CraftItem extends CraftEntity implements Item { } public ItemStack getItemStack() { - return new CraftItemStack(item.a); + return new CraftItemStack(item.itemStack); } 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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 812e8297..bc1c293f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -59,14 +59,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public Egg throwEgg() { net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); EntityEgg egg = new EntityEgg(world, getHandle()); - world.a(egg); + world.addEntity(egg); return (Egg) egg.getBukkitEntity(); } public Snowball throwSnowball() { net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); EntitySnowball snowball = new EntitySnowball(world, getHandle()); - world.a(snowball); + world.addEntity(snowball); return (Snowball) snowball.getBukkitEntity(); } @@ -120,7 +120,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public Arrow shootArrow() { net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); EntityArrow arrow = new EntityArrow(world, getHandle()); - world.a(arrow); + world.addEntity(arrow); return (Arrow) arrow.getBukkitEntity(); } @@ -167,11 +167,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } 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) { - entity.a(((CraftEntity)source).getHandle(), amount); + entity.damageEntity(((CraftEntity) source).getHandle(), amount); } public Location getEyeLocation() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index cbaa5c90..98677b48 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -39,11 +39,11 @@ public class CraftMinecart extends CraftVehicle implements Minecart { } public void setDamage(int damage) { - minecart.a = damage; + minecart.damage = damage; } public int getDamage() { - return minecart.a; + return minecart.damage; } public double getMaxSpeed() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 225196e8..16495db3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -23,7 +23,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public boolean isOp() { - return server.getHandle().h(getName()); + return server.getHandle().isOp(getName()); } public boolean isPlayer() { @@ -31,7 +31,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public boolean isOnline() { - for (Object obj: server.getHandle().b) { + for (Object obj: server.getHandle().players) { EntityPlayer player = (EntityPlayer) obj; if (player.name.equalsIgnoreCase(getName())) { return true; @@ -41,7 +41,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public InetSocketAddress getAddress() { - SocketAddress addr = getHandle().a.b.b(); + SocketAddress addr = getHandle().netServerHandler.networkManager.getSocketAddress(); if (addr instanceof InetSocketAddress) { return (InetSocketAddress) addr; } else { @@ -76,12 +76,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void sendRawMessage(String message) { - getHandle().a.b(new Packet3Chat(message)); + getHandle().netServerHandler.sendPacket(new Packet3Chat(message)); } public void sendMessage(String 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) { - getHandle().a.a(message == null ? "" : message); + getHandle().netServerHandler.disconnect(message == null ? "" : message); } public void setCompassTarget(Location loc) { // 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() { @@ -134,7 +134,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void chat(String msg) { - getHandle().a.chat(msg); + getHandle().netServerHandler.chat(msg); } public boolean performCommand(String command) { @@ -151,10 +151,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { 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.a = entity.a; + newEntity.netServerHandler = entity.netServerHandler; newEntity.health = entity.health; newEntity.fireTicks = entity.fireTicks; newEntity.inventory = entity.inventory; @@ -167,22 +167,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player { newEntity.displayName = entity.displayName; newEntity.compassTarget = entity.compassTarget; 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) { - manager.c.k.a(entity); - manager.c.k.b(entity); - oldWorld.manager.b(entity); - manager.b.remove(entity); - oldWorld.e(entity); + manager.server.tracker.trackPlayer(entity); + manager.server.tracker.untrackEntity(entity); + oldWorld.manager.removePlayer(entity); + manager.players.remove(entity); + oldWorld.removeEntity(entity); - newWorld.manager.a(newEntity); - newWorld.a(newEntity); - manager.b.add(newEntity); + newWorld.manager.addPlayer(newEntity); + newWorld.addEntity(newEntity); + manager.players.add(newEntity); - entity.a.e = newEntity; + entity.netServerHandler.player = newEntity; this.entity = newEntity; setCompassTarget(getCompassTarget()); @@ -190,33 +190,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return teleportSuccess; } else { - return entity.a.teleport(location); + return entity.netServerHandler.teleport(location); } } public void setSneaking(boolean sneak) { - getHandle().e(sneak); + getHandle().setSneak(sneak); } public boolean isSneaking() { - return getHandle().Z(); + return getHandle().isSneaking(); } public void loadData() { - server.getHandle().n.b(getHandle()); + server.getHandle().playerFileData.b(getHandle()); } public void saveData() { - server.getHandle().n.a(getHandle()); + server.getHandle().playerFileData.a(getHandle()); } public void updateInventory() { - getHandle().m(); + getHandle().syncInventory(); } public void setSleepingIgnored(boolean isSleeping) { getHandle().fauxSleeping = isSleeping; - ((CraftWorld)getWorld()).getHandle().checkSleepStatus(); + ((CraftWorld) getWorld()).getHandle().checkSleepStatus(); } public boolean isSleepingIgnored() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java index bedfe06d..0ec31c1c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java @@ -10,8 +10,7 @@ import org.bukkit.entity.PoweredMinecart; * * @author sk89q */ -public class CraftPoweredMinecart extends CraftMinecart - implements PoweredMinecart { +public class CraftPoweredMinecart extends CraftMinecart implements PoweredMinecart { public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java index 5a0e5fa0..2fe42935 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java @@ -22,19 +22,19 @@ public class CraftSheep extends CraftAnimals implements Sheep { } public DyeColor getColor() { - return DyeColor.getByData((byte) getHandle().o()); + return DyeColor.getByData((byte) getHandle().getColor()); } public void setColor(DyeColor color) { - getHandle().a_(color.getData()); + getHandle().setColor(color.getData()); } public boolean isSheared() { - return getHandle().j_(); + return getHandle().isSheared(); } public void setSheared(boolean flag) { - getHandle().a(flag); + getHandle().setSheared(flag); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java index 3d3cca16..104683c8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -25,6 +25,6 @@ public class CraftSlime extends CraftLivingEntity implements Slime { } public void setSize(int size) { - getHandle().e(size); + getHandle().setSize(size); } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 2983221b..736896f6 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -46,14 +46,14 @@ import org.bukkit.event.player.PlayerInteractEvent; public class CraftEventFactory { private static boolean canBuild(CraftWorld world, Player player, int x, int z) { WorldServer worldServer = world.getHandle(); - int spawnSize = worldServer.x.spawnProtection; + int spawnSize = worldServer.server.spawnProtection; if (spawnSize <= 0) 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; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 1f5f9a09..eee59f98 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -19,23 +19,23 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } public int getSize() { - return getInventory().q_(); + return getInventory().getSize(); } public String getName() { - return getInventory().c(); + return getInventory().getName(); } - public ItemStack getItem(int index) { - return new CraftItemStack(getInventory().c_(index)); + public CraftItemStack getItem(int index) { + return new CraftItemStack(getInventory().getItem(index)); } - public ItemStack[] getContents() { - ItemStack[] items = new ItemStack[getSize()]; + public CraftItemStack[] getContents() { + CraftItemStack[] items = new CraftItemStack[getSize()]; net.minecraft.server.ItemStack[] mcItems = getInventory().getContents(); 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; @@ -59,12 +59,12 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } 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) { for (ItemStack item: getContents()) { - if (item != null && item.getTypeId() == materialId) { + if (item.getTypeId() == materialId) { return true; } } @@ -86,15 +86,15 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } return false; } - + public boolean contains(int materialId, int amount) { int amt = 0; for (ItemStack item: getContents()) { - if (item != null && item.getTypeId() == materialId) { - amt += item.getAmount(); + if (item.getTypeId() == materialId && item.getAmount() >= amount) { + return true; } } - return amt >= amount; + return false; } public boolean contains(Material material, int amount) { @@ -107,13 +107,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } int amt = 0; for (ItemStack i: getContents()) { - if (item.equals(i)) { - amt += item.getAmount(); + if (item.equals(i) && item.getAmount() >= amount) { + return true; } } - return amt >= amount; + return false; } - + public HashMap<Integer, ItemStack> all(int materialId) { HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>(); @@ -312,7 +312,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } private int getMaxItemStack() { - return getInventory().r_(); + return getInventory().getMaxStackSize(); } public void remove(int materialId) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java index 88933b4b..d721686f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -19,7 +19,7 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent } public CraftItemStack getItemInHand() { - return new CraftItemStack( getInventory().b() ); + return new CraftItemStack( getInventory().getItemInHand() ); } public void setItemInHand(ItemStack stack) { @@ -27,22 +27,22 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent } public int getHeldItemSlot() { - return getInventory().c; + return getInventory().itemInHandIndex; } - public ItemStack getHelmet() { + public CraftItemStack getHelmet() { return getItem( getSize() + 3 ); } - public ItemStack getChestplate() { + public CraftItemStack getChestplate() { return getItem( getSize() + 2 ); } - public ItemStack getLeggings() { + public CraftItemStack getLeggings() { return getItem( getSize() + 1 ); } - public ItemStack getBoots() { + public CraftItemStack getBoots() { return getItem( getSize() + 0 ); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 2f242af4..078c0b04 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -121,6 +121,6 @@ public class CraftItemStack extends ItemStack { @Override public int getMaxStackSize() { - return item.a().b(); + return item.getItem().getMaxStackSize(); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java index 39d748b4..a44c1b90 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSlot.java @@ -12,14 +12,14 @@ public class CraftSlot implements org.bukkit.inventory.Slot { } public Inventory getInventory() { - return new CraftInventory( slot.e ); + return new CraftInventory( slot.inventory ); } public int getIndex() { - return slot.d; + return slot.index; } public ItemStack getItem() { - return new CraftItemStack( slot.a() ); + return new CraftItemStack( slot.getItem() ); } } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index ad07883a..9caef416 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -20,7 +20,7 @@ import org.bukkit.craftbukkit.scheduler.CraftTask; public class CraftScheduler implements BukkitScheduler, Runnable { private static final Logger logger = Logger.getLogger("Minecraft"); - + private final CraftServer server; private final CraftThreadManager craftThreadManager = new CraftThreadManager(); diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java index 79e7d439..fc59df77 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java @@ -13,8 +13,8 @@ public class LongHashtable<V> extends LongHash { put(toLong(msw, lsw), value); if (value instanceof Chunk) { Chunk c = (Chunk) value; - if (msw != c.j || lsw != c.k) { - MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")"); + if (msw != c.x || lsw != c.z) { + MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")"); Throwable x = new Throwable(); x.fillInStackTrace(); x.printStackTrace(); @@ -26,8 +26,8 @@ public class LongHashtable<V> extends LongHash { V value = get(toLong(msw, lsw)); if (value instanceof Chunk) { Chunk c = (Chunk) value; - if (msw != c.j || lsw != c.k) { - MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")"); + if (msw != c.x || lsw != c.z) { + MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")"); Throwable x = new Throwable(); x.fillInStackTrace(); x.printStackTrace(); diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java index d15bb782..5e555d64 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java +++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java @@ -12,6 +12,6 @@ public class ServerShutdownThread extends Thread { @Override public void run() { - server.g(); + server.stop(); } } |