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:
Ursprung
91e69e54b4
Commit
070c214267
@ -39,7 +39,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>1.4_00_01</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@ -47,36 +47,11 @@
|
||||
<groupId>net.sf.jopt-simple</groupId>
|
||||
<artifactId>jopt-simple</artifactId>
|
||||
<version>3.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jline</groupId>
|
||||
<artifactId>jline</artifactId>
|
||||
<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>
|
||||
</dependencies>
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
@ -149,13 +124,6 @@
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>junit:junit</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
@ -23,9 +23,9 @@ public class CraftChunk implements Chunk {
|
||||
|
||||
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()) {
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
@ -87,7 +87,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -141,18 +141,18 @@ public class CraftWorld implements World {
|
||||
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);
|
||||
provider.unloadQueue.remove(x, z);
|
||||
provider.chunks.remove(x, z);
|
||||
provider.chunkList.remove(chunk);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -160,14 +160,14 @@ public class CraftWorld implements World {
|
||||
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;
|
||||
}
|
||||
@ -204,7 +204,7 @@ public class CraftWorld implements World {
|
||||
|
||||
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,7 +521,7 @@ 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();
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data);
|
||||
if (success) {
|
||||
chunk.getHandle().d.g(x, y, z);
|
||||
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,23 +376,23 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class CraftChest extends CraftBlockState implements Chest {
|
||||
boolean result = super.update(force);
|
||||
|
||||
if (result) {
|
||||
chest.i();
|
||||
chest.update();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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,28 +190,28 @@ 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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,6 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
getHandle().e(size);
|
||||
getHandle().setSize(size);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
@ -90,11 +90,11 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||
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,11 +107,11 @@ 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) {
|
||||
@ -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) {
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -121,6 +121,6 @@ public class CraftItemStack extends ItemStack {
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
return item.a().b();
|
||||
return item.getItem().getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -12,6 +12,6 @@ public class ServerShutdownThread extends Thread {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
server.g();
|
||||
server.stop();
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren