geforkt von Mirrors/Paper
Code cleanup, fixed doors, chunk entity fetching
Dieser Commit ist enthalten in:
Ursprung
786fdfb9fe
Commit
078f48c0fb
@ -10,9 +10,9 @@ public class BlockBloodStone extends Block {
|
||||
super(i, j, Material.STONE);
|
||||
}
|
||||
|
||||
//Craftbukkit start
|
||||
// Craftbukkit start
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if(net.minecraft.server.Block.byId[l].c()) {
|
||||
if (net.minecraft.server.Block.byId[l].c()) {
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
||||
@ -21,5 +21,5 @@ public class BlockBloodStone extends Block {
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
}
|
||||
}
|
||||
//Craftbukkit end
|
||||
// Craftbukkit end
|
||||
}
|
||||
|
@ -171,15 +171,18 @@ public class BlockDoor extends Block {
|
||||
} else if (l > 0 && Block.byId[l].c()) {
|
||||
boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k);
|
||||
|
||||
//Craftbukkit start
|
||||
// Craftbukkit start
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block blockTop = craftWorld.getBlockAt(i, j + 1, k);
|
||||
int power = block.getBlockPower();
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15: 0, flag1 ? 15 : 0);
|
||||
int powerTop = blockTop.getBlockPower();
|
||||
if (powerTop > power) power = powerTop;
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15: 0, power);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
this.a(world, i, j, k, eventRedstone.getNewCurrent());
|
||||
//Craftbukkit end
|
||||
this.a(world, i, j, k, eventRedstone.getNewCurrent() > 0);
|
||||
// Craftbukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ public class BlockPumpkin extends Block {
|
||||
world.c(i, j, k, l);
|
||||
}
|
||||
|
||||
//Craftbukkit start
|
||||
// Craftbukkit start
|
||||
public void a(World world, int i, int j, int k, int l) {
|
||||
if(net.minecraft.server.Block.byId[l].c()) {
|
||||
if (net.minecraft.server.Block.byId[l].c()) {
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
||||
@ -62,5 +62,5 @@ public class BlockPumpkin extends Block {
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
}
|
||||
}
|
||||
//Craftbukkit end
|
||||
// Craftbukkit end
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public int g(World world, int i, int j, int k, int l) { //Craftbukkit made public
|
||||
public int g(World world, int i, int j, int k, int l) { // Craftbukkit made public
|
||||
if (world.getTypeId(i, j, k) != this.id) {
|
||||
return l;
|
||||
} else {
|
||||
@ -280,7 +280,9 @@ public class BlockRedstoneWire extends Block {
|
||||
if (!flag) {
|
||||
this.b_(world, i, j, k, i1);
|
||||
world.e(i, j, k, 0);
|
||||
} else if((Block.byId[l] != null && Block.byId[l].c()) || Block.DIODE_OFF.id == l && Block.DIODE_ON.id == l) { //condition added by Craftbukkit
|
||||
} else
|
||||
// Craftbukkit
|
||||
if ((Block.byId[l] != null && Block.byId[l].c()) || Block.DIODE_OFF.id == l && Block.DIODE_ON.id == l) {
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
|
||||
|
@ -105,8 +105,8 @@ public class BlockSign extends BlockContainer {
|
||||
|
||||
super.a(world, i, j, k, l);
|
||||
|
||||
//Craftbukkit start
|
||||
if(net.minecraft.server.Block.byId[l].c()) {
|
||||
// Craftbukkit start
|
||||
if (net.minecraft.server.Block.byId[l].c()) {
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Block block = craftWorld.getBlockAt(i, j, k);
|
||||
@ -114,6 +114,6 @@ public class BlockSign extends BlockContainer {
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
}
|
||||
//Craftbukkit end
|
||||
// Craftbukkit end
|
||||
}
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
Chunk chunk = (Chunk) this.e.get(i, j); // CraftBukkit
|
||||
|
||||
chunk = chunk == null ? (this.g.r ? this.d(i, j) : this.b) : chunk;
|
||||
if(chunk == this.b) return chunk;
|
||||
if(i != chunk.j || j != chunk.k) {
|
||||
if (chunk == this.b) return chunk;
|
||||
if (i != chunk.j || j != chunk.k) {
|
||||
MinecraftServer.a.info("Chunk (" + chunk.j + ", " + chunk.k +") stored at (" + i + ", " + j + ")");
|
||||
MinecraftServer.a.info(chunk.getClass().getName());
|
||||
Throwable x = new Throwable();
|
||||
|
@ -71,10 +71,10 @@ public class EntityTrackerEntry {
|
||||
boolean flag = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8;
|
||||
boolean flag1 = Math.abs(l - this.g) >= 8 || Math.abs(i1 - this.h) >= 8;
|
||||
|
||||
//CraftBukkit - Create relative movement packet only if distance is greater than zero.
|
||||
// CraftBukkit - Create relative movement packet only if distance is greater than zero.
|
||||
int distanceSquared = j1*j1+k1*k1+l1*l1;
|
||||
flag = (distanceSquared > 0) && flag;
|
||||
//CraftBukkit stop
|
||||
// CraftBukkit stop
|
||||
|
||||
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128) {
|
||||
if (flag && flag1) {
|
||||
|
@ -204,7 +204,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
server.loadPlugins(); // CraftBukkit
|
||||
}
|
||||
|
||||
void f() { //CraftBukkit - private -> default
|
||||
void f() { // CraftBukkit - private -> default
|
||||
a.info("Saving chunks");
|
||||
|
||||
// CraftBukkit start
|
||||
|
@ -73,7 +73,9 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
Entity[] entities = new Entity[count];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (net.minecraft.server.Entity entity : (net.minecraft.server.Entity[])chunk.m[i].toArray()) {
|
||||
for (Object obj : (net.minecraft.server.Entity[])chunk.m[i].toArray()) {
|
||||
if (!(obj instanceof net.minecraft.server.Entity)) continue;
|
||||
net.minecraft.server.Entity entity = (net.minecraft.server.Entity) obj;
|
||||
entities[index++] = entity.getBukkitEntity();
|
||||
}
|
||||
}
|
||||
@ -84,7 +86,9 @@ public class CraftChunk implements Chunk {
|
||||
int index = 0;
|
||||
net.minecraft.server.Chunk chunk = getHandle();
|
||||
BlockState[] entities = new BlockState[chunk.l.size()];
|
||||
for (ChunkPosition position : (ChunkPosition[])chunk.l.keySet().toArray()) {
|
||||
for (Object obj : chunk.l.keySet().toArray()) {
|
||||
if (!(obj instanceof ChunkPosition)) continue;
|
||||
ChunkPosition position = (ChunkPosition) obj;
|
||||
entities[index++] = worldServer.getWorld().getBlockAt(position.a, position.b, position.c).getState();
|
||||
}
|
||||
return entities;
|
||||
|
@ -118,7 +118,7 @@ public final class CraftServer implements Server {
|
||||
found = player;
|
||||
delta = curDelta;
|
||||
}
|
||||
if(curDelta == 0) break;
|
||||
if (curDelta == 0) break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
|
@ -155,7 +155,7 @@ public class CraftWorld implements World {
|
||||
|
||||
net.minecraft.server.Chunk chunk = null;
|
||||
|
||||
if(provider.c == null) {
|
||||
if (provider.c == null) {
|
||||
chunk = provider.b;
|
||||
} else {
|
||||
chunk = provider.c.b(x, z);
|
||||
@ -169,7 +169,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean refreshChunk(int x, int z) {
|
||||
if(!isChunkLoaded(x, z)) {
|
||||
if (!isChunkLoaded(x, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public void setData(final byte data, boolean applyPhysics) {
|
||||
if(applyPhysics) {
|
||||
if (applyPhysics) {
|
||||
chunk.getHandle().d.c(x, y, z, data);
|
||||
} else {
|
||||
chunk.getHandle().d.d(x, y, z, data);
|
||||
@ -128,7 +128,7 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public boolean setTypeId(final int type, final boolean applyPhysics) {
|
||||
if(applyPhysics) {
|
||||
if (applyPhysics) {
|
||||
return setTypeId(type);
|
||||
} else {
|
||||
return chunk.getHandle().d.setTypeId(x, y, z, type);
|
||||
@ -136,7 +136,7 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
|
||||
if(applyPhysics) {
|
||||
if (applyPhysics) {
|
||||
return chunk.getHandle().d.b(x, y, z, type, data);
|
||||
} else {
|
||||
return chunk.getHandle().d.setTypeIdAndData(x, y, z, type, data);
|
||||
@ -383,12 +383,12 @@ public class CraftBlock implements Block {
|
||||
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.g(world, x, y - 1, z, power);
|
||||
if((face == BlockFace.UP || face == BlockFace.SELF) && world.i(x, y + 1, z, 1)) power = wire.g(world, x, y + 1, z, power);
|
||||
if((face == BlockFace.EAST || face == BlockFace.SELF) && world.i(x, y, z - 1, 2)) power = wire.g(world, x, y, z - 1, power);
|
||||
if((face == BlockFace.WEST || face == BlockFace.SELF) && world.i(x, y, z + 1, 3)) power = wire.g(world, x, y, z + 1, power);
|
||||
if((face == BlockFace.NORTH || face == BlockFace.SELF) && world.i(x - 1, y, z, 4)) power = wire.g(world, x - 1, y, z, power);
|
||||
if((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.i(x + 1, y, z, 5)) power = wire.g(world, x + 1, y, z, power);
|
||||
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.i(x, y - 1, z, 0)) power = wire.g(world, x, y - 1, z, power);
|
||||
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.i(x, y + 1, z, 1)) power = wire.g(world, x, y + 1, z, power);
|
||||
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.i(x, y, z - 1, 2)) power = wire.g(world, x, y, z - 1, power);
|
||||
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.i(x, y, z + 1, 3)) power = wire.g(world, x, y, z + 1, power);
|
||||
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.i(x - 1, y, z, 4)) power = wire.g(world, x - 1, y, z, power);
|
||||
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.i(x + 1, y, z, 5)) power = wire.g(world, x + 1, y, z, power);
|
||||
return face == BlockFace.SELF ? power - 1 : power;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public double getEyeHeight(boolean ignoreSneaking) {
|
||||
if(ignoreSneaking) {
|
||||
if (ignoreSneaking) {
|
||||
return 1.62D;
|
||||
} else {
|
||||
if (isSneaking()) {
|
||||
|
@ -19,7 +19,7 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
||||
}
|
||||
|
||||
public boolean setPassenger(Entity passenger) {
|
||||
if(passenger instanceof CraftEntity){
|
||||
if (passenger instanceof CraftEntity){
|
||||
((CraftEntity)passenger).getHandle().setPassengerOf(getHandle());
|
||||
return true;
|
||||
} else {
|
||||
|
@ -25,7 +25,7 @@ public class CraftFuture<T> implements Runnable, Future<T> {
|
||||
|
||||
public void run() {
|
||||
synchronized(this) {
|
||||
if(cancelled) {
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
running = true;
|
||||
@ -51,7 +51,7 @@ public class CraftFuture<T> implements Runnable, Future<T> {
|
||||
|
||||
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
synchronized(this) {
|
||||
if(isDone()) {
|
||||
if (isDone()) {
|
||||
return getResult();
|
||||
}
|
||||
this.wait(TimeUnit.MILLISECONDS.convert(timeout, unit));
|
||||
@ -60,10 +60,10 @@ public class CraftFuture<T> implements Runnable, Future<T> {
|
||||
}
|
||||
|
||||
public T getResult() throws ExecutionException {
|
||||
if(cancelled) {
|
||||
if (cancelled) {
|
||||
throw new CancellationException();
|
||||
}
|
||||
if(e!=null) {
|
||||
if (e!=null) {
|
||||
throw new ExecutionException(e);
|
||||
}
|
||||
return returnStore.getObject();
|
||||
@ -83,14 +83,14 @@ public class CraftFuture<T> implements Runnable, Future<T> {
|
||||
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
synchronized(this) {
|
||||
if(cancelled) {
|
||||
if (cancelled) {
|
||||
return false;
|
||||
}
|
||||
cancelled = true;
|
||||
if(taskId!=-1) {
|
||||
if (taskId!=-1) {
|
||||
craftScheduler.cancelTask(taskId);
|
||||
}
|
||||
if(!running && !done) {
|
||||
if (!running && !done) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -13,9 +13,9 @@ public class LongHashtable<V> extends LongHash
|
||||
|
||||
public void put(int msw, int lsw, V value) {
|
||||
put(toLong(msw, lsw), value);
|
||||
if(value instanceof Chunk) {
|
||||
if (value instanceof Chunk) {
|
||||
Chunk c = (Chunk)value;
|
||||
if(msw != c.j || lsw != c.k) {
|
||||
if (msw != c.j || lsw != c.k) {
|
||||
MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")");
|
||||
Throwable x = new Throwable();
|
||||
x.fillInStackTrace();
|
||||
@ -26,9 +26,9 @@ public class LongHashtable<V> extends LongHash
|
||||
|
||||
public V get(int msw, int lsw) {
|
||||
V value = get(toLong(msw, lsw));
|
||||
if(value instanceof Chunk) {
|
||||
if (value instanceof Chunk) {
|
||||
Chunk c = (Chunk)value;
|
||||
if(msw != c.j || lsw != c.k) {
|
||||
if (msw != c.j || lsw != c.k) {
|
||||
MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")");
|
||||
Throwable x = new Throwable();
|
||||
x.fillInStackTrace();
|
||||
|
@ -100,13 +100,13 @@ public class SoftMap<K,V> {
|
||||
|
||||
private V fastGet(K key) {
|
||||
SoftMapReference<K,V> ref = map.get(key);
|
||||
if(ref==null) {
|
||||
if (ref==null) {
|
||||
return null;
|
||||
}
|
||||
V value = ref.get();
|
||||
if(value!=null) {
|
||||
if (value!=null) {
|
||||
strongReferenceQueue.addFirst(value);
|
||||
if(strongReferenceQueue.size() > strongReferenceSize) {
|
||||
if (strongReferenceQueue.size() > strongReferenceSize) {
|
||||
strongReferenceQueue.removeLast();
|
||||
}
|
||||
}
|
||||
@ -146,7 +146,7 @@ public class SoftMap<K,V> {
|
||||
private void fastPut(K key, V value) {
|
||||
map.put(key, new SoftMapReference<K,V>(key, value, queue));
|
||||
strongReferenceQueue.addFirst(value);
|
||||
if(strongReferenceQueue.size() > strongReferenceSize) {
|
||||
if (strongReferenceQueue.size() > strongReferenceSize) {
|
||||
strongReferenceQueue.removeLast();
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ public class SoftMap<K,V> {
|
||||
public V remove(K key) {
|
||||
emptyQueue();
|
||||
SoftMapReference<K,V> ref = map.remove(key);
|
||||
if(ref != null) {
|
||||
if (ref != null) {
|
||||
return ref.get();
|
||||
}
|
||||
return null;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren