Upstream Paper

This commit is contained in:
Sotr
2018-07-06 15:28:10 +08:00
parent 452dd1f3b5
commit 9e06a9fe5c
8 changed files with 123 additions and 643 deletions

View File

@@ -413,7 +413,7 @@ public abstract class PandaRedstoneWire extends Block {
*/ */
private void addAllSurroundingBlocks(BlockPosition pos, Set<BlockPosition> set) { private void addAllSurroundingBlocks(BlockPosition pos, Set<BlockPosition> set) {
for (BaseBlockPosition vect : surroundingBlocksOffset) { for (BaseBlockPosition vect : surroundingBlocksOffset) {
set.add(pos.add(vect)); set.add(pos.a(vect)); // PAIL: add
} }
} }
@@ -446,7 +446,7 @@ public abstract class PandaRedstoneWire extends Block {
public void onPlace(World world, BlockPosition pos, IBlockData state) { public void onPlace(World world, BlockPosition pos, IBlockData state) {
this.updateSurroundingRedstone(world, pos); this.updateSurroundingRedstone(world, pos);
for (BaseBlockPosition vec : surroundingBlocksOffset) { for (BaseBlockPosition vec : surroundingBlocksOffset) {
world.applyPhysics(pos.add(vec), this, false); world.applyPhysics(pos.a(vec), this, false); // PAIL: add
} }
} }
@@ -463,7 +463,7 @@ public abstract class PandaRedstoneWire extends Block {
super.remove(world, pos, state); super.remove(world, pos, state);
this.updateSurroundingRedstone(world, pos); this.updateSurroundingRedstone(world, pos);
for (BaseBlockPosition vec : surroundingBlocksOffset) { for (BaseBlockPosition vec : surroundingBlocksOffset) {
world.applyPhysics(pos.add(vec), this, false); world.applyPhysics(pos.a(vec), this, false); // PAIL: add
} }
} }

View File

@@ -1,471 +0,0 @@
package net.minecraft.server;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Lists;
import java.util.Iterator;
import java.util.List;
import javax.annotation.concurrent.Immutable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* <b>Akarin Changes Note</b><br>
* <br>
* 1) Add OBFHELPER<br>
* @author cakoyo
*/
@Immutable
public class BlockPosition extends BaseBlockPosition {
private static final Logger b = LogManager.getLogger();
public static final BlockPosition ZERO = new BlockPosition(0, 0, 0);
private static final int c = 1 + MathHelper.e(MathHelper.c(30000000));
private static final int d = BlockPosition.c;
private static final int f = 64 - BlockPosition.c - BlockPosition.d;
private static final int g = 0 + BlockPosition.d;
private static final int h = BlockPosition.g + BlockPosition.f;
private static final long i = (1L << BlockPosition.c) - 1L;
private static final long j = (1L << BlockPosition.f) - 1L;
private static final long k = (1L << BlockPosition.d) - 1L;
public BlockPosition(int i, int j, int k) {
super(i, j, k);
}
public BlockPosition(double d0, double d1, double d2) {
super(d0, d1, d2);
}
public BlockPosition(Entity entity) {
this(entity.locX, entity.locY, entity.locZ);
}
public BlockPosition(Vec3D vec3d) {
this(vec3d.x, vec3d.y, vec3d.z);
}
public BlockPosition(BaseBlockPosition baseblockposition) {
this(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
}
public BlockPosition add(double x, double y, double z) { return this.a(x, y, z); } // Paper - OBFHELPER
public BlockPosition a(double d0, double d1, double d2) {
return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition(this.getX() + d0, this.getY() + d1, this.getZ() + d2);
}
public BlockPosition a(int i, int j, int k) {
return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k);
}
public BlockPosition add(BaseBlockPosition baseblockposition) { return this.a(baseblockposition); } // Akarin - OBFHELPER
public BlockPosition a(BaseBlockPosition baseblockposition) {
return this.a(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
}
public BlockPosition b(BaseBlockPosition baseblockposition) {
return this.a(-baseblockposition.getX(), -baseblockposition.getY(), -baseblockposition.getZ());
}
public BlockPosition up() {
return this.up(1);
}
public BlockPosition up(int i) {
return this.shift(EnumDirection.UP, i);
}
public BlockPosition down() {
return this.down(1);
}
public BlockPosition down(int i) {
return this.shift(EnumDirection.DOWN, i);
}
public BlockPosition north() {
return this.north(1);
}
public BlockPosition north(int i) {
return this.shift(EnumDirection.NORTH, i);
}
public BlockPosition south() {
return this.south(1);
}
public BlockPosition south(int i) {
return this.shift(EnumDirection.SOUTH, i);
}
public BlockPosition west() {
return this.west(1);
}
public BlockPosition west(int i) {
return this.shift(EnumDirection.WEST, i);
}
public BlockPosition east() {
return this.east(1);
}
public BlockPosition east(int i) {
return this.shift(EnumDirection.EAST, i);
}
public BlockPosition shift(EnumDirection enumdirection) {
return this.shift(enumdirection, 1);
}
public BlockPosition shift(EnumDirection enumdirection, int i) {
return i == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i);
}
public BlockPosition a(EnumBlockRotation enumblockrotation) {
switch (enumblockrotation) {
case NONE:
default:
return this;
case CLOCKWISE_90:
return new BlockPosition(-this.getZ(), this.getY(), this.getX());
case CLOCKWISE_180:
return new BlockPosition(-this.getX(), this.getY(), -this.getZ());
case COUNTERCLOCKWISE_90:
return new BlockPosition(this.getZ(), this.getY(), -this.getX());
}
}
public BlockPosition c(BaseBlockPosition baseblockposition) {
return new BlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
}
public long asLong() {
return (this.getX() & BlockPosition.i) << BlockPosition.h | (this.getY() & BlockPosition.j) << BlockPosition.g | (this.getZ() & BlockPosition.k) << 0;
}
public static BlockPosition fromLong(long i) {
int j = (int) (i << 64 - BlockPosition.h - BlockPosition.c >> 64 - BlockPosition.c);
int k = (int) (i << 64 - BlockPosition.g - BlockPosition.f >> 64 - BlockPosition.f);
int l = (int) (i << 64 - BlockPosition.d >> 64 - BlockPosition.d);
return new BlockPosition(j, k, l);
}
public static Iterable<BlockPosition> a(BlockPosition blockposition, BlockPosition blockposition1) {
return a(Math.min(blockposition.getX(), blockposition1.getX()), Math.min(blockposition.getY(), blockposition1.getY()), Math.min(blockposition.getZ(), blockposition1.getZ()), Math.max(blockposition.getX(), blockposition1.getX()), Math.max(blockposition.getY(), blockposition1.getY()), Math.max(blockposition.getZ(), blockposition1.getZ()));
}
public static Iterable<BlockPosition> a(final int i, final int j, final int k, final int l, final int i1, final int j1) {
return new Iterable() {
@Override
public Iterator<BlockPosition> iterator() {
return new AbstractIterator() {
private boolean b = true;
private int c;
private int d;
private int e;
protected BlockPosition a() {
if (this.b) {
this.b = false;
this.c = i;
this.d = j;
this.e = k;
return new BlockPosition(i, j, k);
} else if (this.c == l && this.d == i1 && this.e == j1) {
return (BlockPosition) this.endOfData();
} else {
if (this.c < l) {
++this.c;
} else if (this.d < i1) {
this.c = i;
++this.d;
} else if (this.e < j1) {
this.c = i;
this.d = j;
++this.e;
}
return new BlockPosition(this.c, this.d, this.e);
}
}
@Override
protected Object computeNext() {
return this.a();
}
};
}
};
}
public BlockPosition h() {
return this;
}
public static Iterable<BlockPosition.MutableBlockPosition> b(BlockPosition blockposition, BlockPosition blockposition1) {
return b(Math.min(blockposition.getX(), blockposition1.getX()), Math.min(blockposition.getY(), blockposition1.getY()), Math.min(blockposition.getZ(), blockposition1.getZ()), Math.max(blockposition.getX(), blockposition1.getX()), Math.max(blockposition.getY(), blockposition1.getY()), Math.max(blockposition.getZ(), blockposition1.getZ()));
}
public static Iterable<BlockPosition.MutableBlockPosition> b(final int i, final int j, final int k, final int l, final int i1, final int j1) {
return new Iterable() {
@Override
public Iterator<BlockPosition.MutableBlockPosition> iterator() {
return new AbstractIterator() {
private BlockPosition.MutableBlockPosition b;
protected BlockPosition.MutableBlockPosition a() {
if (this.b == null) {
this.b = new BlockPosition.MutableBlockPosition(i, j, k);
return this.b;
// Paper start - b, c, d, refer to x, y, z, and as such, a, b, c of BaseBlockPosition
} else if (((BaseBlockPosition)this.b).a == l && ((BaseBlockPosition)this.b).b == i1 && ((BaseBlockPosition)this.b).c == j1) {
return (BlockPosition.MutableBlockPosition) this.endOfData();
} else {
if (((BaseBlockPosition) this.b).a < l) {
++((BaseBlockPosition) this.b).a;
} else if (((BaseBlockPosition) this.b).b < i1) {
((BaseBlockPosition) this.b).a = i;
++((BaseBlockPosition) this.b).b;
} else if (((BaseBlockPosition) this.b).c < j1) {
((BaseBlockPosition) this.b).a = i;
((BaseBlockPosition) this.b).b = j;
++((BaseBlockPosition) this.b).c;
}
// Paper end
return this.b;
}
}
@Override
protected Object computeNext() {
return this.a();
}
};
}
};
}
@Override
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
return this.c(baseblockposition);
}
public static final class PooledBlockPosition extends BlockPosition.MutableBlockPosition {
private boolean f;
private static final List<BlockPosition.PooledBlockPosition> g = Lists.newArrayList();
private PooledBlockPosition(int i, int j, int k) {
super(i, j, k);
}
public static BlockPosition.PooledBlockPosition aquire() { return s(); } // Paper - OBFHELPER
public static BlockPosition.PooledBlockPosition s() {
return e(0, 0, 0);
}
public static BlockPosition.PooledBlockPosition d(double d0, double d1, double d2) {
return e(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
public static BlockPosition.PooledBlockPosition e(int i, int j, int k) {
List list = BlockPosition.PooledBlockPosition.g;
synchronized (BlockPosition.PooledBlockPosition.g) {
if (!BlockPosition.PooledBlockPosition.g.isEmpty()) {
BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.g.remove(BlockPosition.PooledBlockPosition.g.size() - 1);
if (blockposition_pooledblockposition != null && blockposition_pooledblockposition.f) {
blockposition_pooledblockposition.f = false;
blockposition_pooledblockposition.f(i, j, k);
return blockposition_pooledblockposition;
}
}
}
return new BlockPosition.PooledBlockPosition(i, j, k);
}
public void free() { t(); } // Paper - OBFHELPER
public void t() {
List list = BlockPosition.PooledBlockPosition.g;
synchronized (BlockPosition.PooledBlockPosition.g) {
if (BlockPosition.PooledBlockPosition.g.size() < 100) {
BlockPosition.PooledBlockPosition.g.add(this);
}
this.f = true;
}
}
public BlockPosition.PooledBlockPosition f(int i, int j, int k) {
if (this.f) {
BlockPosition.b.error("PooledMutableBlockPosition modified after it was released.", new Throwable());
this.f = false;
}
return (BlockPosition.PooledBlockPosition) super.c(i, j, k);
}
public BlockPosition.PooledBlockPosition e(double d0, double d1, double d2) {
return (BlockPosition.PooledBlockPosition) super.c(d0, d1, d2);
}
public BlockPosition.PooledBlockPosition j(BaseBlockPosition baseblockposition) {
return (BlockPosition.PooledBlockPosition) super.g(baseblockposition);
}
public BlockPosition.PooledBlockPosition d(EnumDirection enumdirection) {
return (BlockPosition.PooledBlockPosition) super.c(enumdirection);
}
public BlockPosition.PooledBlockPosition d(EnumDirection enumdirection, int i) {
return (BlockPosition.PooledBlockPosition) super.c(enumdirection, i);
}
@Override
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
return this.d(enumdirection, i);
}
@Override
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection) {
return this.d(enumdirection);
}
@Override
public BlockPosition.MutableBlockPosition g(BaseBlockPosition baseblockposition) {
return this.j(baseblockposition);
}
@Override
public BlockPosition.MutableBlockPosition c(double d0, double d1, double d2) {
return this.e(d0, d1, d2);
}
@Override
public BlockPosition.MutableBlockPosition c(int i, int j, int k) {
return this.f(i, j, k);
}
}
public static class MutableBlockPosition extends BlockPosition {
// Paper start - Remove variables
/*
protected int b;
protected int c;
protected int d;
// Paper start
@Override
public boolean isValidLocation() {
return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256;
}
@Override
public boolean isInvalidYLocation() {
return c < 0 || c >= 256;
}
*/
// Paper end
public MutableBlockPosition() {
this(0, 0, 0);
}
public MutableBlockPosition(BlockPosition blockposition) {
this(blockposition.getX(), blockposition.getY(), blockposition.getZ());
}
public MutableBlockPosition(int i, int j, int k) {
super(0, 0, 0);
// Paper start - Modify base position variables
((BaseBlockPosition) this).a = i;
((BaseBlockPosition) this).b = j;
((BaseBlockPosition) this).c = k;
// Paper end
}
@Override
public BlockPosition a(double d0, double d1, double d2) {
return super.a(d0, d1, d2).h();
}
@Override
public BlockPosition a(int i, int j, int k) {
return super.a(i, j, k).h();
}
@Override
public BlockPosition shift(EnumDirection enumdirection, int i) {
return super.shift(enumdirection, i).h();
}
@Override
public BlockPosition a(EnumBlockRotation enumblockrotation) {
return super.a(enumblockrotation).h();
}
// Paper start - Use superclass methods
/*
public int getX() {
return this.b;
}
public int getY() {
return this.c;
}
public int getZ() {
return this.d;
}
*/
// Paper end
public void setValues(int x, int y, int z) { c(x, y, z); } // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition c(int i, int j, int k) {
// Paper start - Modify base position variables
((BaseBlockPosition) this).a = i;
((BaseBlockPosition) this).b = j;
((BaseBlockPosition) this).c = k;
// Paper end
return this;
}
public BlockPosition.MutableBlockPosition c(double d0, double d1, double d2) {
return this.c(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
public BlockPosition.MutableBlockPosition g(BaseBlockPosition baseblockposition) {
return this.c(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
}
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection) {
return this.c(enumdirection, 1);
}
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
return this.c(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); // Paper - USE THE BLEEPING GETTERS
}
public void p(int i) {
((BaseBlockPosition) this).b = i; // Paper - Modify base variable
}
@Override
public BlockPosition h() {
return new BlockPosition(this);
}
@Override
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
return super.c(baseblockposition);
}
}
}

View File

@@ -5,6 +5,7 @@ import com.google.common.base.Predicate;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Queues; import com.google.common.collect.Queues;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -33,7 +34,7 @@ public class Chunk {
private final byte[] g; private final byte[] g;
private final int[] h; private final int[] h;
private final boolean[] i; private final boolean[] i;
private boolean j; private boolean j; public boolean isLoaded() { return j; } // Paper - OBFHELPER
public final World world; public final World world;
public final int[] heightMap; public final int[] heightMap;
public Long scheduledForUnload; // Paper - delay chunk unloads public Long scheduledForUnload; // Paper - delay chunk unloads
@@ -42,7 +43,36 @@ public class Chunk {
private boolean m; private boolean m;
public final Map<BlockPosition, TileEntity> tileEntities; public final Map<BlockPosition, TileEntity> tileEntities;
public final List<Entity>[] entitySlices; // Spigot public final List<Entity>[] entitySlices; // Spigot
final PaperLightingQueue.LightingQueue lightingQueue = new PaperLightingQueue.LightingQueue(this); // Paper // Paper start
public final co.aikar.util.Counter<String> entityCounts = new co.aikar.util.Counter<>();
public final co.aikar.util.Counter<String> tileEntityCounts = new co.aikar.util.Counter<>();
private class TileEntityHashMap extends java.util.HashMap<BlockPosition, TileEntity> {
@Override
public TileEntity put(BlockPosition key, TileEntity value) {
TileEntity replaced = super.put(key, value);
if (replaced != null) {
replaced.setCurrentChunk(null);
tileEntityCounts.decrement(replaced.tileEntityKeyString);
}
if (value != null) {
value.setCurrentChunk(Chunk.this);
tileEntityCounts.increment(value.tileEntityKeyString);
}
return replaced;
}
@Override
public TileEntity remove(Object key) {
TileEntity removed = super.remove(key);
if (removed != null) {
removed.setCurrentChunk(null);
tileEntityCounts.decrement(removed.tileEntityKeyString);
}
return removed;
}
}
final PaperLightingQueue.LightingQueue lightingQueue = new PaperLightingQueue.LightingQueue(this);
// Paper end
private volatile boolean done; // Akarin - volatile private volatile boolean done; // Akarin - volatile
private volatile boolean lit; // Akarin - volatile private volatile boolean lit; // Akarin - volatile
private volatile boolean r; private boolean isTicked() { return r; }; // Paper - OBFHELPER // Akarin - volatile private volatile boolean r; private boolean isTicked() { return r; }; // Paper - OBFHELPER // Akarin - volatile
@@ -97,10 +127,10 @@ public class Chunk {
this.g = new byte[256]; this.g = new byte[256];
this.h = new int[256]; this.h = new int[256];
this.i = new boolean[256]; this.i = new boolean[256];
this.tileEntities = Maps.newHashMap(); this.tileEntities = new TileEntityHashMap(); // Paper
this.x = 4096; this.x = 4096;
this.y = Queues.newConcurrentLinkedQueue(); this.y = Queues.newConcurrentLinkedQueue();
this.entitySlices = (new List[16]); // Spigot this.entitySlices = (List[]) (new List[16]); // Spigot
this.world = world; this.world = world;
this.locX = i; this.locX = i;
this.locZ = j; this.locZ = j;
@@ -466,7 +496,6 @@ public class Chunk {
return CrashReportSystemDetails.a(i, j, k); return CrashReportSystemDetails.a(i, j, k);
} }
@Override
public Object call() throws Exception { public Object call() throws Exception {
return this.a(); return this.a();
} }
@@ -675,9 +704,14 @@ public class Chunk {
this.entityCount.adjustOrPutValue( creatureType.a(), 1, 1 ); this.entityCount.adjustOrPutValue( creatureType.a(), 1, 1 );
} }
} }
// Paper start
entity.setCurrentChunk(this);
entityCounts.increment(entity.entityKeyString);
// Paper end
// Spigot end // Spigot end
} }
public void removeEntity(Entity entity) { b(entity); } // Paper - OBFHELPER
public void b(Entity entity) { public void b(Entity entity) {
this.a(entity, entity.ac); this.a(entity, entity.ac);
} }
@@ -714,6 +748,10 @@ public class Chunk {
this.entityCount.adjustValue( creatureType.a(), -1 ); this.entityCount.adjustValue( creatureType.a(), -1 );
} }
} }
// Paper start
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
// Paper end
// Spigot end // Spigot end
} }
@@ -742,7 +780,7 @@ public class Chunk {
tileentity = world.capturedTileEntities.get(blockposition); tileentity = world.capturedTileEntities.get(blockposition);
} }
if (tileentity == null) { if (tileentity == null) {
tileentity = this.tileEntities.get(blockposition); tileentity = (TileEntity) this.tileEntities.get(blockposition);
} }
// CraftBukkit end // CraftBukkit end
@@ -774,7 +812,7 @@ public class Chunk {
tileentity.setPosition(blockposition); tileentity.setPosition(blockposition);
if (this.getBlockData(blockposition).getBlock() instanceof ITileEntity) { if (this.getBlockData(blockposition).getBlock() instanceof ITileEntity) {
if (this.tileEntities.containsKey(blockposition)) { if (this.tileEntities.containsKey(blockposition)) {
this.tileEntities.get(blockposition).z(); ((TileEntity) this.tileEntities.get(blockposition)).z();
} }
tileentity.A(); tileentity.A();
@@ -796,6 +834,7 @@ public class Chunk {
if (this.world.paperConfig.removeCorruptTEs) { if (this.world.paperConfig.removeCorruptTEs) {
this.removeTileEntity(tileentity.getPosition()); this.removeTileEntity(tileentity.getPosition());
this.markDirty();
org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity"); org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity");
} }
// Paper end // Paper end
@@ -806,7 +845,7 @@ public class Chunk {
public void removeTileEntity(BlockPosition blockposition) { this.d(blockposition); } // Paper - OBFHELPER public void removeTileEntity(BlockPosition blockposition) { this.d(blockposition); } // Paper - OBFHELPER
public void d(BlockPosition blockposition) { public void d(BlockPosition blockposition) {
if (this.j) { if (this.j) {
TileEntity tileentity = this.tileEntities.remove(blockposition); TileEntity tileentity = (TileEntity) this.tileEntities.remove(blockposition);
if (tileentity != null) { if (tileentity != null) {
tileentity.z(); tileentity.z();
@@ -824,7 +863,7 @@ public class Chunk {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
List entityslice = aentityslice[j]; // Spigot List entityslice = aentityslice[j]; // Spigot
this.world.a(entityslice); this.world.a((Collection) entityslice);
} }
} }
@@ -838,11 +877,11 @@ public class Chunk {
// Spigot Start // Spigot Start
if ( tileentity instanceof IInventory ) if ( tileentity instanceof IInventory )
{ {
for ( org.bukkit.entity.HumanEntity h : Lists.<org.bukkit.entity.HumanEntity>newArrayList(( (IInventory) tileentity ).getViewers() ) ) for ( org.bukkit.entity.HumanEntity h : Lists.<org.bukkit.entity.HumanEntity>newArrayList((List<org.bukkit.entity.HumanEntity>) ( (IInventory) tileentity ).getViewers() ) )
{ {
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
{ {
( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(); ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
} }
} }
} }
@@ -863,11 +902,11 @@ public class Chunk {
// Spigot Start // Spigot Start
if ( entity instanceof IInventory ) if ( entity instanceof IInventory )
{ {
for ( org.bukkit.entity.HumanEntity h : Lists.<org.bukkit.entity.HumanEntity>newArrayList( ( (IInventory) entity ).getViewers() ) ) for ( org.bukkit.entity.HumanEntity h : Lists.<org.bukkit.entity.HumanEntity>newArrayList( (List<org.bukkit.entity.HumanEntity>) ( (IInventory) entity ).getViewers() ) )
{ {
if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity )
{ {
( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(); ( (org.bukkit.craftbukkit.entity.CraftHumanEntity) h).getHandle().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
} }
} }
} }
@@ -982,7 +1021,7 @@ public class Chunk {
} }
public Random a(long i) { public Random a(long i) {
return new Random(this.world.getSeed() + this.locX * this.locX * 4987142 + this.locX * 5947611 + this.locZ * this.locZ * 4392871L + this.locZ * 389711 ^ i); return new Random(this.world.getSeed() + (long) (this.locX * this.locX * 4987142) + (long) (this.locX * 5947611) + (long) (this.locZ * this.locZ) * 4392871L + (long) (this.locZ * 389711) ^ i);
} }
public boolean isEmpty() { public boolean isEmpty() {
@@ -1062,7 +1101,7 @@ public class Chunk {
random.setSeed(world.getSeed()); random.setSeed(world.getSeed());
long xRand = random.nextLong() / 2L * 2L + 1L; long xRand = random.nextLong() / 2L * 2L + 1L;
long zRand = random.nextLong() / 2L * 2L + 1L; long zRand = random.nextLong() / 2L * 2L + 1L;
random.setSeed(locX * xRand + locZ * zRand ^ world.getSeed()); random.setSeed((long) locX * xRand + (long) locZ * zRand ^ world.getSeed());
org.bukkit.World world = this.world.getWorld(); org.bukkit.World world = this.world.getWorld();
if (world != null) { if (world != null) {
@@ -1123,7 +1162,7 @@ public class Chunk {
} }
while (!this.y.isEmpty()) { while (!this.y.isEmpty()) {
BlockPosition blockposition = this.y.poll(); BlockPosition blockposition = (BlockPosition) this.y.poll();
if (this.a(blockposition, Chunk.EnumTileEntityState.CHECK) == null && this.getBlockData(blockposition).getBlock().isTileEntity()) { if (this.a(blockposition, Chunk.EnumTileEntityState.CHECK) == null && this.getBlockData(blockposition).getBlock().isTileEntity()) {
TileEntity tileentity = this.g(blockposition); TileEntity tileentity = this.g(blockposition);
@@ -1341,7 +1380,7 @@ public class Chunk {
for (l = k + 16 - 1; l > this.world.getSeaLevel() || l > 0 && !flag1; --l) { for (l = k + 16 - 1; l > this.world.getSeaLevel() || l > 0 && !flag1; --l) {
blockposition_mutableblockposition.c(blockposition_mutableblockposition.getX(), l, blockposition_mutableblockposition.getZ()); blockposition_mutableblockposition.c(blockposition_mutableblockposition.getX(), l, blockposition_mutableblockposition.getZ());
int i1 = this.b(blockposition_mutableblockposition); int i1 = this.b((BlockPosition) blockposition_mutableblockposition);
if (i1 == 255 && blockposition_mutableblockposition.getY() < this.world.getSeaLevel()) { if (i1 == 255 && blockposition_mutableblockposition.getY() < this.world.getSeaLevel()) {
flag1 = true; flag1 = true;

View File

@@ -129,7 +129,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (worldserver.worldProvider.m() && worldserver.getWorldData().getGameType() != EnumGamemode.ADVENTURE) { if (worldserver.worldProvider.m() && worldserver.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
int i = Math.max(0, minecraftserver.a(worldserver)); int i = Math.max(0, minecraftserver.a(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().b(blockposition.getX(), blockposition.getZ())); int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ()));
if (j < i) { if (j < i) {
i = j; i = j;
@@ -146,7 +146,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// CraftBukkit end // CraftBukkit end
@Override
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
if (this.locY > 300) this.locY = 257; // Paper - bring down to a saner Y level if out of world if (this.locY > 300) this.locY = 257; // Paper - bring down to a saner Y level if out of world
@@ -174,7 +173,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public static void a(DataConverterManager dataconvertermanager) { public static void a(DataConverterManager dataconvertermanager) {
dataconvertermanager.a(DataConverterTypes.PLAYER, new DataInspector() { dataconvertermanager.a(DataConverterTypes.PLAYER, new DataInspector() {
@Override
public NBTTagCompound a(DataConverter dataconverter, NBTTagCompound nbttagcompound, int i) { public NBTTagCompound a(DataConverter dataconverter, NBTTagCompound nbttagcompound, int i) {
if (nbttagcompound.hasKeyOfType("RootVehicle", 10)) { if (nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
@@ -189,7 +187,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}); });
} }
@Override
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.setInt("playerGameType", this.playerInteractManager.getGameMode().getId()); nbttagcompound.setInt("playerGameType", this.playerInteractManager.getGameMode().getId());
@@ -221,7 +218,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// CraftBukkit start - World fallback code, either respawn location or global spawn // CraftBukkit start - World fallback code, either respawn location or global spawn
@Override
public void spawnIn(World world) { public void spawnIn(World world) {
super.spawnIn(world); super.spawnIn(world);
if (world == null) { if (world == null) {
@@ -246,13 +242,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// CraftBukkit end // CraftBukkit end
@Override
public void levelDown(int i) { public void levelDown(int i) {
super.levelDown(i); super.levelDown(i);
this.lastSentExp = -1; this.lastSentExp = -1;
} }
@Override
public void enchantDone(ItemStack itemstack, int i) { public void enchantDone(ItemStack itemstack, int i) {
super.enchantDone(itemstack, i); super.enchantDone(itemstack, i);
this.lastSentExp = -1; this.lastSentExp = -1;
@@ -262,29 +256,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.addSlotListener(this); this.activeContainer.addSlotListener(this);
} }
@Override
public void enterCombat() { public void enterCombat() {
super.enterCombat(); super.enterCombat();
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTER_COMBAT)); this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTER_COMBAT));
} }
@Override
public void exitCombat() { public void exitCombat() {
super.exitCombat(); super.exitCombat();
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.END_COMBAT)); this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.END_COMBAT));
} }
@Override
protected void a(IBlockData iblockdata) { protected void a(IBlockData iblockdata) {
CriterionTriggers.d.a(this, iblockdata); CriterionTriggers.d.a(this, iblockdata);
} }
@Override
protected ItemCooldown l() { protected ItemCooldown l() {
return new ItemCooldownPlayer(this); return new ItemCooldownPlayer(this);
} }
@Override
public void B_() { public void B_() {
// CraftBukkit start // CraftBukkit start
if (this.joining) { if (this.joining) {
@@ -304,7 +293,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// Paper end // Paper end
if (!this.world.isClientSide && !this.activeContainer.canUse(this)) { if (!this.world.isClientSide && !this.activeContainer.canUse(this)) {
this.closeInventory(); this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
} }
@@ -359,7 +348,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
ItemStack itemstack = this.inventory.getItem(i); ItemStack itemstack = this.inventory.getItem(i);
if (!itemstack.isEmpty() && itemstack.getItem().f()) { if (!itemstack.isEmpty() && itemstack.getItem().f()) {
Packet packet = ((ItemWorldMapBase) itemstack.getItem()).a(itemstack, this.world, this); Packet packet = ((ItemWorldMapBase) itemstack.getItem()).a(itemstack, this.world, (EntityHuman) this);
if (packet != null) { if (packet != null) {
this.playerConnection.sendPacket(packet); this.playerConnection.sendPacket(packet);
@@ -425,7 +414,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
if (this.oldLevel != this.expLevel) { if (this.oldLevel != this.expLevel) {
CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer(this), this.oldLevel, this.expLevel); CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.expLevel);
this.oldLevel = this.expLevel; this.oldLevel = this.expLevel;
} }
// CraftBukkit end // CraftBukkit end
@@ -450,7 +439,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages"); boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
@@ -483,9 +471,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) { if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) {
if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) { if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) {
this.server.getPlayerList().a(this, chatmessage); this.server.getPlayerList().a((EntityHuman) this, chatmessage);
} else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) { } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) {
this.server.getPlayerList().b(this, chatmessage); this.server.getPlayerList().b((EntityHuman) this, chatmessage);
} }
} else { } else {
this.server.getPlayerList().sendMessage(chatmessage); this.server.getPlayerList().sendMessage(chatmessage);
@@ -501,7 +489,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.inventory.clear(); this.inventory.clear();
} }
this.closeInventory(); this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DEATH); // Paper
this.setSpectatorTarget(this); // Remove spectated target this.setSpectatorTarget(this); // Remove spectated target
// CraftBukkit end // CraftBukkit end
@@ -518,7 +506,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
EntityLiving entityliving = this.ci(); EntityLiving entityliving = this.ci();
if (entityliving != null) { if (entityliving != null) {
EntityTypes.MonsterEggInfo entitytypes_monsteregginfo = EntityTypes.eggInfo.get(EntityTypes.a(entityliving)); EntityTypes.MonsterEggInfo entitytypes_monsteregginfo = (EntityTypes.MonsterEggInfo) EntityTypes.eggInfo.get(EntityTypes.a((Entity) entityliving));
if (entitytypes_monsteregginfo != null) { if (entitytypes_monsteregginfo != null) {
this.b(entitytypes_monsteregginfo.killedByEntityStatistic); this.b(entitytypes_monsteregginfo.killedByEntityStatistic);
@@ -534,7 +522,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.getCombatTracker().g(); this.getCombatTracker().g();
} }
@Override
public void a(Entity entity, int i, DamageSource damagesource) { public void a(Entity entity, int i, DamageSource damagesource) {
if (entity != this) { if (entity != this) {
super.a(entity, i, damagesource); super.a(entity, i, damagesource);
@@ -603,7 +590,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return Lists.newArrayList(); return Lists.newArrayList();
} }
@Override
public boolean damageEntity(DamageSource damagesource, float f) { public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) { if (this.isInvulnerable(damagesource)) {
return false; return false;
@@ -634,7 +620,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
@Override
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return !this.canPvP() ? false : super.a(entityhuman); return !this.canPvP() ? false : super.a(entityhuman);
} }
@@ -644,7 +629,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return this.world.pvpMode; return this.world.pvpMode;
} }
@Override
@Nullable @Nullable
public Entity b(int i) { public Entity b(int i) {
if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154 if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
@@ -683,7 +667,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
@Override
public boolean a(EntityPlayer entityplayer) { public boolean a(EntityPlayer entityplayer) {
return entityplayer.isSpectator() ? this.getSpecatorTarget() == this : (this.isSpectator() ? false : super.a(entityplayer)); return entityplayer.isSpectator() ? this.getSpecatorTarget() == this : (this.isSpectator() ? false : super.a(entityplayer));
} }
@@ -699,13 +682,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public void receive(Entity entity, int i) { public void receive(Entity entity, int i) {
super.receive(entity, i); super.receive(entity, i);
this.activeContainer.b(); this.activeContainer.b();
} }
@Override
public EntityHuman.EnumBedResult a(BlockPosition blockposition) { public EntityHuman.EnumBedResult a(BlockPosition blockposition) {
EntityHuman.EnumBedResult entityhuman_enumbedresult = super.a(blockposition); EntityHuman.EnumBedResult entityhuman_enumbedresult = super.a(blockposition);
@@ -713,7 +694,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.b(StatisticList.ab); this.b(StatisticList.ab);
PacketPlayOutBed packetplayoutbed = new PacketPlayOutBed(this, blockposition); PacketPlayOutBed packetplayoutbed = new PacketPlayOutBed(this, blockposition);
this.x().getTracker().a(this, packetplayoutbed); this.x().getTracker().a((Entity) this, (Packet) packetplayoutbed);
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.playerConnection.sendPacket(packetplayoutbed); this.playerConnection.sendPacket(packetplayoutbed);
CriterionTriggers.p.a(this); CriterionTriggers.p.a(this);
@@ -722,7 +703,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return entityhuman_enumbedresult; return entityhuman_enumbedresult;
} }
@Override
public void a(boolean flag, boolean flag1, boolean flag2) { public void a(boolean flag, boolean flag1, boolean flag2) {
if (!this.sleeping) return; // CraftBukkit - Can't leave bed if not in one! if (!this.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
if (this.isSleeping()) { if (this.isSleeping()) {
@@ -736,7 +716,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public boolean a(Entity entity, boolean flag) { public boolean a(Entity entity, boolean flag) {
Entity entity1 = this.bJ(); Entity entity1 = this.bJ();
@@ -753,7 +732,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
@Override
public void stopRiding() { public void stopRiding() {
Entity entity = this.bJ(); Entity entity = this.bJ();
@@ -773,15 +751,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public boolean isInvulnerable(DamageSource damagesource) { public boolean isInvulnerable(DamageSource damagesource) {
return super.isInvulnerable(damagesource) || this.L(); return super.isInvulnerable(damagesource) || this.L();
} }
@Override
protected void a(double d0, boolean flag, IBlockData iblockdata, BlockPosition blockposition) {} protected void a(double d0, boolean flag, IBlockData iblockdata, BlockPosition blockposition) {}
@Override
protected void b(BlockPosition blockposition) { protected void b(BlockPosition blockposition) {
if (!this.isSpectator()) { if (!this.isSpectator()) {
super.b(blockposition); super.b(blockposition);
@@ -810,9 +785,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.a(d0, flag, iblockdata, blockposition); super.a(d0, flag, iblockdata, blockposition);
} }
@Override
public void openSign(TileEntitySign tileentitysign) { public void openSign(TileEntitySign tileentitysign) {
tileentitysign.a(this); tileentitysign.a((EntityHuman) this);
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
} }
@@ -821,7 +795,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return containerCounter; // CraftBukkit return containerCounter; // CraftBukkit
} }
@Override
public void openTileEntity(ITileEntityContainer itileentitycontainer) { public void openTileEntity(ITileEntityContainer itileentitycontainer) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
if (false && itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).b() != null && this.isSpectator()) { if (false && itileentitycontainer instanceof ILootable && ((ILootable) itileentitycontainer).b() != null && this.isSpectator()) {
@@ -841,7 +814,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
@Override
public void openContainer(IInventory iinventory) { public void openContainer(IInventory iinventory) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
// Copied from below // Copied from below
@@ -871,7 +843,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)), true); this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)), true);
} else { } else {
if (this.activeContainer != this.defaultContainer) { if (this.activeContainer != this.defaultContainer) {
this.closeInventory(); this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper
} }
if (iinventory instanceof ITileInventory) { if (iinventory instanceof ITileInventory) {
@@ -901,7 +873,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
@Override
public void openTrade(IMerchant imerchant) { public void openTrade(IMerchant imerchant) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
@@ -929,7 +900,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorseabstract, this)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorseabstract, this));
@@ -939,7 +909,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// CraftBukkit end // CraftBukkit end
if (this.activeContainer != this.defaultContainer) { if (this.activeContainer != this.defaultContainer) {
this.closeInventory(); this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper
} }
this.nextContainerCounter(); this.nextContainerCounter();
@@ -949,26 +919,23 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.addSlotListener(this); this.activeContainer.addSlotListener(this);
} }
@Override
public void a(ItemStack itemstack, EnumHand enumhand) { public void a(ItemStack itemstack, EnumHand enumhand) {
Item item = itemstack.getItem(); Item item = itemstack.getItem();
if (item == Items.WRITTEN_BOOK) { if (item == Items.WRITTEN_BOOK) {
PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer()); PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer());
packetdataserializer.a(enumhand); packetdataserializer.a((Enum) enumhand);
this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|BOpen", packetdataserializer)); this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|BOpen", packetdataserializer));
} }
} }
@Override
public void a(TileEntityCommand tileentitycommand) { public void a(TileEntityCommand tileentitycommand) {
tileentitycommand.c(true); tileentitycommand.c(true);
this.a((TileEntity) tileentitycommand); this.a((TileEntity) tileentitycommand);
} }
@Override
public void a(Container container, int i, ItemStack itemstack) { public void a(Container container, int i, ItemStack itemstack) {
if (!(container.getSlot(i) instanceof SlotResult)) { if (!(container.getSlot(i) instanceof SlotResult)) {
if (container == this.defaultContainer) { if (container == this.defaultContainer) {
@@ -985,7 +952,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.a(container, container.a()); this.a(container, container.a());
} }
@Override
public void a(Container container, NonNullList<ItemStack> nonnulllist) { public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist)); this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@@ -996,12 +962,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end // CraftBukkit end
} }
@Override
public void setContainerData(Container container, int i, int j) { public void setContainerData(Container container, int i, int j) {
this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, i, j)); this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, i, j));
} }
@Override
public void setContainerData(Container container, IInventory iinventory) { public void setContainerData(Container container, IInventory iinventory) {
for (int i = 0; i < iinventory.h(); ++i) { for (int i = 0; i < iinventory.h(); ++i) {
this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, i, iinventory.getProperty(i))); this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, i, iinventory.getProperty(i)));
@@ -1009,9 +973,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public void closeInventory() { public void closeInventory() {
CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit // Paper start
closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNKNOWN);
}
public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit
// Paper end
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.r(); this.r();
} }
@@ -1023,7 +991,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void r() { public void r() {
this.activeContainer.b(this); this.activeContainer.b((EntityHuman) this);
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
} }
@@ -1043,7 +1011,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public void a(Statistic statistic, int i) { public void a(Statistic statistic, int i) {
if (statistic != null) { if (statistic != null) {
this.bZ.b(this, statistic, i); this.bZ.b(this, statistic, i);
@@ -1058,7 +1025,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
@Override
public void a(Statistic statistic) { public void a(Statistic statistic) {
if (statistic != null) { if (statistic != null) {
this.bZ.setStatistic(this, statistic, 0); this.bZ.setStatistic(this, statistic, 0);
@@ -1073,12 +1039,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
@Override
public void a(List<IRecipe> list) { public void a(List<IRecipe> list) {
this.cr.a(list, this); this.cr.a(list, this);
} }
@Override
public void a(MinecraftKey[] aminecraftkey) { public void a(MinecraftKey[] aminecraftkey) {
ArrayList arraylist = Lists.newArrayList(); ArrayList arraylist = Lists.newArrayList();
MinecraftKey[] aminecraftkey1 = aminecraftkey; MinecraftKey[] aminecraftkey1 = aminecraftkey;
@@ -1099,7 +1063,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.a((List<IRecipe>) arraylist); // CraftBukkit - decompile error this.a((List<IRecipe>) arraylist); // CraftBukkit - decompile error
} }
@Override
public void b(List<IRecipe> list) { public void b(List<IRecipe> list) {
this.cr.b(list, this); this.cr.b(list, this);
} }
@@ -1130,12 +1093,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// CraftBukkit end // CraftBukkit end
@Override
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) { public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT)); this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT));
} }
@Override
protected void v() { protected void v() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) { if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.playerConnection.sendPacket(new PacketPlayOutEntityStatus(this, (byte) 9)); this.playerConnection.sendPacket(new PacketPlayOutEntityStatus(this, (byte) 9));
@@ -1182,7 +1143,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.setShoulderEntityRight(entityplayer.getShoulderEntityRight()); this.setShoulderEntityRight(entityplayer.getShoulderEntityRight());
} }
@Override
protected void a(MobEffect mobeffect) { protected void a(MobEffect mobeffect) {
super.a(mobeffect); super.a(mobeffect);
this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect)); this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
@@ -1194,14 +1154,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
CriterionTriggers.z.a(this); CriterionTriggers.z.a(this);
} }
@Override
protected void a(MobEffect mobeffect, boolean flag) { protected void a(MobEffect mobeffect, boolean flag) {
super.a(mobeffect, flag); super.a(mobeffect, flag);
this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect)); this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
CriterionTriggers.z.a(this); CriterionTriggers.z.a(this);
} }
@Override
protected void b(MobEffect mobeffect) { protected void b(MobEffect mobeffect) {
super.b(mobeffect); super.b(mobeffect);
this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect.getMobEffect())); this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect.getMobEffect()));
@@ -1212,22 +1170,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
CriterionTriggers.z.a(this); CriterionTriggers.z.a(this);
} }
@Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
this.playerConnection.a(d0, d1, d2, this.yaw, this.pitch); this.playerConnection.a(d0, d1, d2, this.yaw, this.pitch);
} }
@Override
public void a(Entity entity) { public void a(Entity entity) {
this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 4)); this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 4));
} }
@Override
public void b(Entity entity) { public void b(Entity entity) {
this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 5)); this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 5));
} }
@Override
public void updateAbilities() { public void updateAbilities() {
if (this.playerConnection != null) { if (this.playerConnection != null) {
this.playerConnection.sendPacket(new PacketPlayOutAbilities(this.abilities)); this.playerConnection.sendPacket(new PacketPlayOutAbilities(this.abilities));
@@ -1239,7 +1193,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return (WorldServer) this.world; return (WorldServer) this.world;
} }
@Override
public void a(EnumGamemode enumgamemode) { public void a(EnumGamemode enumgamemode) {
// CraftBukkit start // CraftBukkit start
if (enumgamemode == this.playerInteractManager.getGameMode()) { if (enumgamemode == this.playerInteractManager.getGameMode()) {
@@ -1254,7 +1207,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end // CraftBukkit end
this.playerInteractManager.setGameMode(enumgamemode); this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, enumgamemode.getId())); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) { if (enumgamemode == EnumGamemode.SPECTATOR) {
this.releaseShoulderEntities(); this.releaseShoulderEntities();
this.stopRiding(); this.stopRiding();
@@ -1266,22 +1219,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.cE(); this.cE();
} }
@Override
public boolean isSpectator() { public boolean isSpectator() {
return this.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR; return this.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR;
} }
@Override
public boolean z() { public boolean z() {
return this.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE; return this.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE;
} }
@Override
public void sendMessage(IChatBaseComponent ichatbasecomponent) { public void sendMessage(IChatBaseComponent ichatbasecomponent) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent)); this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent));
} }
@Override
public boolean a(int i, String s) { public boolean a(int i, String s) {
/* CraftBukkit start /* CraftBukkit start
if ("seed".equals(s) && !this.server.aa()) { if ("seed".equals(s) && !this.server.aa()) {
@@ -1354,7 +1303,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.playerConnection.sendPacket(new PacketPlayOutResourcePackSend(s, s1)); this.playerConnection.sendPacket(new PacketPlayOutResourcePackSend(s, s1));
} }
@Override
public BlockPosition getChunkCoordinates() { public BlockPosition getChunkCoordinates() {
return new BlockPosition(this.locX, this.locY + 0.5D, this.locZ); return new BlockPosition(this.locX, this.locY + 0.5D, this.locZ);
} }
@@ -1384,7 +1332,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.removeQueue.remove(Integer.valueOf(entity.getId())); this.removeQueue.remove(Integer.valueOf(entity.getId()));
} }
@Override
protected void G() { protected void G() {
if (this.isSpectator()) { if (this.isSpectator()) {
this.bY(); this.bY();
@@ -1397,13 +1344,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public Entity getSpecatorTarget() { public Entity getSpecatorTarget() {
return this.co == null ? this : this.co; return (Entity) (this.co == null ? this : this.co);
} }
public void setSpectatorTarget(Entity entity) { public void setSpectatorTarget(Entity entity) {
Entity entity1 = this.getSpecatorTarget(); Entity entity1 = this.getSpecatorTarget();
this.co = entity == null ? this : entity; this.co = (Entity) (entity == null ? this : entity);
if (entity1 != this.co) { if (entity1 != this.co) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.co)); this.playerConnection.sendPacket(new PacketPlayOutCamera(this.co));
this.playerConnection.a(this.co.locX, this.co.locY, this.co.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit this.playerConnection.a(this.co.locX, this.co.locY, this.co.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
@@ -1411,7 +1358,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
protected void I() { protected void I() {
if (this.portalCooldown > 0 && !this.worldChangeInvuln) { if (this.portalCooldown > 0 && !this.worldChangeInvuln) {
--this.portalCooldown; --this.portalCooldown;
@@ -1419,7 +1365,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
@Override
public void attack(Entity entity) { public void attack(Entity entity) {
if (this.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR) { if (this.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR) {
this.setSpectatorTarget(entity); this.setSpectatorTarget(entity);
@@ -1438,7 +1383,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return listName; // CraftBukkit return listName; // CraftBukkit
} }
@Override
public void a(EnumHand enumhand) { public void a(EnumHand enumhand) {
super.a(enumhand); super.a(enumhand);
this.ds(); this.ds();

View File

@@ -146,7 +146,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
private final static HashSet<Integer> invalidItems = new HashSet<Integer>(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 55, 59, 62, 63, 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, 119, 125, 127, 132, 140, 141, 142, 144)); // TODO: Check after every update. private final static HashSet<Integer> invalidItems = new HashSet<Integer>(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 55, 59, 62, 63, 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, 119, 125, 127, 132, 140, 141, 142, 144)); // TODO: Check after every update.
// CraftBukkit end // CraftBukkit end
@Override
public void e() { public void e() {
this.syncPosition(); this.syncPosition();
this.player.playerTick(); this.player.playerTick();
@@ -189,7 +188,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
this.minecraftServer.methodProfiler.a("keepAlive"); this.minecraftServer.methodProfiler.a("keepAlive");
/* // Akarin start /* // Akarin
// Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2 // This should effectively place the keepalive handling back to "as it was" before 1.12.2
long currentTime = this.getCurrentMillis(); long currentTime = this.getCurrentMillis();
@@ -209,7 +208,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
} }
// Paper end // Paper end
*/ // Akarin end */ // Akarin
this.minecraftServer.methodProfiler.b(); this.minecraftServer.methodProfiler.b();
// CraftBukkit start // CraftBukkit start
@@ -225,7 +224,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
--this.j; --this.j;
} }
if (this.player.J() > 0L && this.minecraftServer.getIdleTimeout() > 0 && MinecraftServer.aw() - this.player.J() > this.minecraftServer.getIdleTimeout() * 1000 * 60) { if (this.player.J() > 0L && this.minecraftServer.getIdleTimeout() > 0 && MinecraftServer.aw() - this.player.J() > (long) (this.minecraftServer.getIdleTimeout() * 1000 * 60)) {
this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854
this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0]));
} }
@@ -275,7 +274,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
final ChatComponentText chatcomponenttext = new ChatComponentText(s); final ChatComponentText chatcomponenttext = new ChatComponentText(s);
this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() { this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() {
@Override
public void operationComplete(Future future) throws Exception { // CraftBukkit - decompile error public void operationComplete(Future future) throws Exception { // CraftBukkit - decompile error
PlayerConnection.this.networkManager.close(chatcomponenttext); PlayerConnection.this.networkManager.close(chatcomponenttext);
} }
@@ -284,14 +282,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.networkManager.stopReading(); this.networkManager.stopReading();
// CraftBukkit - Don't wait // CraftBukkit - Don't wait
this.minecraftServer.postToMainThread(new Runnable() { this.minecraftServer.postToMainThread(new Runnable() {
@Override
public void run() { public void run() {
PlayerConnection.this.networkManager.handleDisconnection(); PlayerConnection.this.networkManager.handleDisconnection();
} }
}); });
} }
@Override
public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) {
PlayerConnectionUtils.ensureMainThread(packetplayinsteervehicle, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinsteervehicle, this, this.player.x());
this.player.a(packetplayinsteervehicle.a(), packetplayinsteervehicle.b(), packetplayinsteervehicle.c(), packetplayinsteervehicle.d()); this.player.a(packetplayinsteervehicle.a(), packetplayinsteervehicle.b(), packetplayinsteervehicle.c(), packetplayinsteervehicle.d());
@@ -305,7 +301,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
return !Doubles.isFinite(packetplayinvehiclemove.getX()) || !Doubles.isFinite(packetplayinvehiclemove.getY()) || !Doubles.isFinite(packetplayinvehiclemove.getZ()) || !Floats.isFinite(packetplayinvehiclemove.getPitch()) || !Floats.isFinite(packetplayinvehiclemove.getYaw()); return !Doubles.isFinite(packetplayinvehiclemove.getX()) || !Doubles.isFinite(packetplayinvehiclemove.getY()) || !Doubles.isFinite(packetplayinvehiclemove.getZ()) || !Floats.isFinite(packetplayinvehiclemove.getPitch()) || !Floats.isFinite(packetplayinvehiclemove.getYaw());
} }
@Override
public void a(PacketPlayInVehicleMove packetplayinvehiclemove) { public void a(PacketPlayInVehicleMove packetplayinvehiclemove) {
PlayerConnectionUtils.ensureMainThread(packetplayinvehiclemove, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinvehiclemove, this, this.player.x());
if (b(packetplayinvehiclemove)) { if (b(packetplayinvehiclemove)) {
@@ -355,7 +350,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
if (d10 - d9 > Math.max(100.0D, Math.pow(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * i * speed, 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(entity.getName()))) { // Spigot if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(entity.getName()))) { // Spigot
// CraftBukkit end // CraftBukkit end
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)); PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8));
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
@@ -473,7 +468,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
} }
@Override
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.x());
if (packetplayinteleportaccept.a() == this.teleportAwait && this.teleportPos != null) { // CraftBukkit if (packetplayinteleportaccept.a() == this.teleportAwait && this.teleportPos != null) { // CraftBukkit
@@ -490,7 +484,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) { public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.x());
if (packetplayinrecipedisplayed.a() == PacketPlayInRecipeDisplayed.Status.SHOWN) { if (packetplayinrecipedisplayed.a() == PacketPlayInRecipeDisplayed.Status.SHOWN) {
@@ -502,7 +495,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInAdvancements packetplayinadvancements) { public void a(PacketPlayInAdvancements packetplayinadvancements) {
PlayerConnectionUtils.ensureMainThread(packetplayinadvancements, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinadvancements, this, this.player.x());
if (packetplayinadvancements.b() == PacketPlayInAdvancements.Status.OPENED_TAB) { if (packetplayinadvancements.b() == PacketPlayInAdvancements.Status.OPENED_TAB) {
@@ -516,7 +508,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInFlying packetplayinflying) { public void a(PacketPlayInFlying packetplayinflying) {
PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.x());
if (b(packetplayinflying)) { if (b(packetplayinflying)) {
@@ -598,7 +589,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (!this.player.L() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cP())) { if (!this.player.L() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cP())) {
float f2 = this.player.cP() ? 300.0F : 100.0F; float f2 = this.player.cP() ? 300.0F : 100.0F;
if (d11 - d10 > Math.max(f2, Math.pow(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * i * speed, 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(this.player.getName()))) { // Spigot if (d11 - d10 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(this.player.getName()))) { // Spigot
// CraftBukkit end // CraftBukkit end
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9));
this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch);
@@ -855,7 +846,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0, d1, d2, f, f1, set, this.teleportAwait)); this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0, d1, d2, f, f1, set, this.teleportAwait));
} }
@Override
public void a(PacketPlayInBlockDig packetplayinblockdig) { public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -918,9 +908,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
case START_DESTROY_BLOCK: case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK: case STOP_DESTROY_BLOCK:
double d0 = this.player.locX - (blockposition.getX() + 0.5D); double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D);
double d1 = this.player.locY - (blockposition.getY() + 0.5D) + 1.5D; double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D;
double d2 = this.player.locZ - (blockposition.getZ() + 0.5D); double d2 = this.player.locZ - ((double) blockposition.getZ() + 0.5D);
double d3 = d0 * d0 + d1 * d1 + d2 * d2; double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 36.0D) { if (d3 > 36.0D) {
@@ -984,7 +974,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
// Spigot end // Spigot end
@Override
public void a(PacketPlayInUseItem packetplayinuseitem) { public void a(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -1001,7 +990,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
chatmessage.getChatModifier().setColor(EnumChatFormat.RED); chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage, ChatMessageType.GAME_INFO)); this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage, ChatMessageType.GAME_INFO));
} else if (this.teleportPos == null && this.player.d(blockposition.getX() + 0.5D, blockposition.getY() + 0.5D, blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { } else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
// CraftBukkit start - Check if we can actually do something over this large a distance // CraftBukkit start - Check if we can actually do something over this large a distance
Location eyeLoc = this.getPlayer().getEyeLocation(); Location eyeLoc = this.getPlayer().getEyeLocation();
double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ()); double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
@@ -1016,7 +1005,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(worldserver, blockposition.shift(enumdirection))); this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(worldserver, blockposition.shift(enumdirection)));
} }
@Override
public void a(PacketPlayInBlockPlace packetplayinblockplace) { public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -1032,7 +1020,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
float f1 = this.player.pitch; float f1 = this.player.pitch;
float f2 = this.player.yaw; float f2 = this.player.yaw;
double d0 = this.player.locX; double d0 = this.player.locX;
double d1 = this.player.locY + this.player.getHeadHeight(); double d1 = this.player.locY + (double) this.player.getHeadHeight();
double d2 = this.player.locZ; double d2 = this.player.locZ;
Vec3D vec3d = new Vec3D(d0, d1, d2); Vec3D vec3d = new Vec3D(d0, d1, d2);
@@ -1043,7 +1031,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
float f7 = f4 * f5; float f7 = f4 * f5;
float f8 = f3 * f5; float f8 = f3 * f5;
double d3 = player.playerInteractManager.getGameMode()== EnumGamemode.CREATIVE ? 5.0D : 4.5D; double d3 = player.playerInteractManager.getGameMode()== EnumGamemode.CREATIVE ? 5.0D : 4.5D;
Vec3D vec3d1 = vec3d.add(f7 * d3, f6 * d3, f8 * d3); Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false);
boolean cancelled; boolean cancelled;
@@ -1069,7 +1057,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
} }
@Override
public void a(PacketPlayInSpectate packetplayinspectate) { public void a(PacketPlayInSpectate packetplayinspectate) {
PlayerConnectionUtils.ensureMainThread(packetplayinspectate, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinspectate, this, this.player.x());
if (this.player.isSpectator()) { if (this.player.isSpectator()) {
@@ -1127,7 +1114,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
// CraftBukkit start // CraftBukkit start
@Override
public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {
PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.x());
// Paper start // Paper start
@@ -1139,7 +1125,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
// CraftBukkit end // CraftBukkit end
@Override
public void a(PacketPlayInBoatMove packetplayinboatmove) { public void a(PacketPlayInBoatMove packetplayinboatmove) {
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x());
Entity entity = this.player.bJ(); Entity entity = this.player.bJ();
@@ -1150,7 +1135,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(IChatBaseComponent ichatbasecomponent) { public void a(IChatBaseComponent ichatbasecomponent) {
// CraftBukkit start - Rarely it would send a disconnect line twice // CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) { if (this.processedDisconnect) {
@@ -1216,7 +1200,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
return packet.getClass().getCanonicalName(); return packet.getClass().getCanonicalName();
} }
@Override
public Object call() throws Exception { public Object call() throws Exception {
return this.a(); return this.a();
} }
@@ -1225,7 +1208,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
} }
@Override
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -1246,7 +1228,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
} }
@Override
public void a(PacketPlayInChat packetplayinchat) { public void a(PacketPlayInChat packetplayinchat) {
// CraftBukkit start - async chat // CraftBukkit start - async chat
// SPIGOT-3638 // SPIGOT-3638
@@ -1387,6 +1368,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// Paper Start // Paper Start
if (!org.spigotmc.AsyncCatcher.shuttingDown && !Akari.isPrimaryThread()) { // Akarin if (!org.spigotmc.AsyncCatcher.shuttingDown && !Akari.isPrimaryThread()) { // Akarin
final String fCommandLine = s; final String fCommandLine = s;
Akari.callbackQueue.add(() -> chat(fCommandLine, false)); // Akarin
/* // Akarin
MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Command Dispatched Async: " + fCommandLine); MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Command Dispatched Async: " + fCommandLine);
MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Please notify author of plugin causing this execution to fix this bug! see: http://bit.ly/1oSiM6C", new Throwable()); MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Please notify author of plugin causing this execution to fix this bug! see: http://bit.ly/1oSiM6C", new Throwable());
Waitable wait = new Waitable() { Waitable wait = new Waitable() {
@@ -1405,6 +1388,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Exception processing chat command", e.getCause()); throw new RuntimeException("Exception processing chat command", e.getCause());
} }
*/ // Akarin
} }
// Paper End // Paper End
this.handleCommand(s); this.handleCommand(s);
@@ -1513,7 +1497,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end // CraftBukkit end
} }
@Override
public void a(PacketPlayInArmAnimation packetplayinarmanimation) { public void a(PacketPlayInArmAnimation packetplayinarmanimation) {
PlayerConnectionUtils.ensureMainThread(packetplayinarmanimation, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinarmanimation, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -1522,7 +1505,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
float f1 = this.player.pitch; float f1 = this.player.pitch;
float f2 = this.player.yaw; float f2 = this.player.yaw;
double d0 = this.player.locX; double d0 = this.player.locX;
double d1 = this.player.locY + this.player.getHeadHeight(); double d1 = this.player.locY + (double) this.player.getHeadHeight();
double d2 = this.player.locZ; double d2 = this.player.locZ;
Vec3D vec3d = new Vec3D(d0, d1, d2); Vec3D vec3d = new Vec3D(d0, d1, d2);
@@ -1533,7 +1516,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
float f7 = f4 * f5; float f7 = f4 * f5;
float f8 = f3 * f5; float f8 = f3 * f5;
double d3 = player.playerInteractManager.getGameMode()== EnumGamemode.CREATIVE ? 5.0D : 4.5D; double d3 = player.playerInteractManager.getGameMode()== EnumGamemode.CREATIVE ? 5.0D : 4.5D;
Vec3D vec3d1 = vec3d.add(f7 * d3, f6 * d3, f8 * d3); Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false);
if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) { if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
@@ -1549,7 +1532,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.a(packetplayinarmanimation.a()); this.player.a(packetplayinarmanimation.a());
} }
@Override
public void a(PacketPlayInEntityAction packetplayinentityaction) { public void a(PacketPlayInEntityAction packetplayinentityaction) {
PlayerConnectionUtils.ensureMainThread(packetplayinentityaction, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinentityaction, this, this.player.x());
// CraftBukkit start // CraftBukkit start
@@ -1651,12 +1633,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInUseEntity packetplayinuseentity) { public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = packetplayinuseentity.a(worldserver); Entity entity = packetplayinuseentity.a((World) worldserver);
// Spigot Start // Spigot Start
if ( entity == player && !player.isSpectator() ) if ( entity == player && !player.isSpectator() )
{ {
@@ -1686,10 +1667,10 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
Item origItem = this.player.inventory.getItemInHand() == null ? null : this.player.inventory.getItemInHand().getItem(); Item origItem = this.player.inventory.getItemInHand() == null ? null : this.player.inventory.getItemInHand().getItem();
PlayerInteractEntityEvent event; PlayerInteractEntityEvent event;
if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT) { if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT) {
event = new PlayerInteractEntityEvent(this.getPlayer(), entity.getBukkitEntity(), (packetplayinuseentity.b() == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity(), (packetplayinuseentity.b() == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND);
} else { } else {
Vec3D target = packetplayinuseentity.c(); Vec3D target = packetplayinuseentity.c();
event = new PlayerInteractAtEntityEvent(this.getPlayer(), entity.getBukkitEntity(), new org.bukkit.util.Vector(target.x, target.y, target.z), (packetplayinuseentity.b() == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); event = new PlayerInteractAtEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity(), new org.bukkit.util.Vector(target.x, target.y, target.z), (packetplayinuseentity.b() == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND);
} }
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
@@ -1755,7 +1736,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInClientCommand packetplayinclientcommand) { public void a(PacketPlayInClientCommand packetplayinclientcommand) {
PlayerConnectionUtils.ensureMainThread(packetplayinclientcommand, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinclientcommand, this, this.player.x());
this.player.resetIdleTimer(); this.player.resetIdleTimer();
@@ -1787,17 +1767,15 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInCloseWindow packetplayinclosewindow) { public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit CraftEventFactory.handleInventoryCloseEvent(this.player, org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLAYER); // CraftBukkit // Paper
this.player.r(); this.player.r();
} }
@Override
public void a(PacketPlayInWindowClick packetplayinwindowclick) { public void a(PacketPlayInWindowClick packetplayinwindowclick) {
PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -1808,7 +1786,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
NonNullList nonnulllist = NonNullList.a(); NonNullList nonnulllist = NonNullList.a();
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
nonnulllist.add(this.player.activeContainer.slots.get(i).getItem()); nonnulllist.add(((Slot) this.player.activeContainer.slots.get(i)).getItem());
} }
this.player.a(this.player.activeContainer, nonnulllist); this.player.a(this.player.activeContainer, nonnulllist);
@@ -2094,7 +2072,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
NonNullList nonnulllist1 = NonNullList.a(); NonNullList nonnulllist1 = NonNullList.a();
for (int j = 0; j < this.player.activeContainer.slots.size(); ++j) { for (int j = 0; j < this.player.activeContainer.slots.size(); ++j) {
ItemStack itemstack1 = this.player.activeContainer.slots.get(j).getItem(); ItemStack itemstack1 = ((Slot) this.player.activeContainer.slots.get(j)).getItem();
ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.a : itemstack1; ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.a : itemstack1;
nonnulllist1.add(itemstack2); nonnulllist1.add(itemstack2);
@@ -2107,7 +2085,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInAutoRecipe packetplayinautorecipe) { public void a(PacketPlayInAutoRecipe packetplayinautorecipe) {
PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.x());
this.player.resetIdleTimer(); this.player.resetIdleTimer();
@@ -2116,7 +2093,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
} }
@Override
public void a(PacketPlayInEnchantItem packetplayinenchantitem) { public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -2128,7 +2104,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInSetCreativeSlot packetplayinsetcreativeslot) { public void a(PacketPlayInSetCreativeSlot packetplayinsetcreativeslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinsetcreativeslot, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinsetcreativeslot, this, this.player.x());
if (this.player.playerInteractManager.isCreative()) { if (this.player.playerInteractManager.isCreative()) {
@@ -2148,7 +2123,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
nbttagcompound1.remove("x"); nbttagcompound1.remove("x");
nbttagcompound1.remove("y"); nbttagcompound1.remove("y");
nbttagcompound1.remove("z"); nbttagcompound1.remove("z");
itemstack.a("BlockEntityTag", nbttagcompound1); itemstack.a("BlockEntityTag", (NBTBase) nbttagcompound1);
} }
} }
} }
@@ -2214,11 +2189,10 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInTransaction packetplayintransaction) { public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
Short oshort = this.k.get(this.player.activeContainer.windowId); Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
this.player.activeContainer.a(this.player, true); this.player.activeContainer.a(this.player, true);
@@ -2226,7 +2200,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInUpdateSign packetplayinupdatesign) { public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit if (this.player.isFrozen()) return; // CraftBukkit
@@ -2262,7 +2235,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
for (int i = 0; i < astring.length; ++i) { for (int i = 0; i < astring.length; ++i) {
lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
} }
SignChangeEvent event = new SignChangeEvent(player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
@@ -2277,7 +2250,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
@Override
public void a(PacketPlayInKeepAlive packetplayinkeepalive) { public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
//PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit // Paper - This shouldn't be on the main thread //PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.g && packetplayinkeepalive.a() == this.h) { if (this.g && packetplayinkeepalive.a() == this.h) {
@@ -2302,7 +2274,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
return System.nanoTime() / 1000000L; return System.nanoTime() / 1000000L;
} }
@Override
public void a(PacketPlayInAbilities packetplayinabilities) { public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x());
// CraftBukkit start // CraftBukkit start
@@ -2319,7 +2290,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
// Paper start - async tab completion // Paper start - async tab completion
@Override
public void a(PacketPlayInTabComplete packet) { public void a(PacketPlayInTabComplete packet) {
// CraftBukkit start // CraftBukkit start
if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) {
@@ -2366,13 +2336,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// Paper end // Paper end
} }
@Override
public void a(PacketPlayInSettings packetplayinsettings) { public void a(PacketPlayInSettings packetplayinsettings) {
PlayerConnectionUtils.ensureMainThread(packetplayinsettings, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayinsettings, this, this.player.x());
this.player.a(packetplayinsettings); this.player.a(packetplayinsettings);
} }
@Override
public void a(PacketPlayInCustomPayload packetplayincustompayload) { public void a(PacketPlayInCustomPayload packetplayincustompayload) {
PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x());
String s = packetplayincustompayload.a(); String s = packetplayincustompayload.a();
@@ -2407,7 +2375,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
itemstack1 = new ItemStack(Items.WRITABLE_BOOK); // CraftBukkit itemstack1 = new ItemStack(Items.WRITABLE_BOOK); // CraftBukkit
itemstack1.a("pages", itemstack.getTag().getList("pages", 8)); itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
} }
} catch (Exception exception) { } catch (Exception exception) {
@@ -2444,19 +2412,19 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK); ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK);
itemstack2.a("author", (new NBTTagString(this.player.getName()))); itemstack2.a("author", (NBTBase) (new NBTTagString(this.player.getName())));
itemstack2.a("title", (new NBTTagString(itemstack.getTag().getString("title")))); itemstack2.a("title", (NBTBase) (new NBTTagString(itemstack.getTag().getString("title"))));
NBTTagList nbttaglist = itemstack.getTag().getList("pages", 8); NBTTagList nbttaglist = itemstack.getTag().getList("pages", 8);
for (int i = 0; i < nbttaglist.size(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
s1 = nbttaglist.getString(i); s1 = nbttaglist.getString(i);
ChatComponentText chatcomponenttext = new ChatComponentText(s1); ChatComponentText chatcomponenttext = new ChatComponentText(s1);
s1 = IChatBaseComponent.ChatSerializer.a(chatcomponenttext); s1 = IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) chatcomponenttext);
nbttaglist.a(i, new NBTTagString(s1)); nbttaglist.a(i, new NBTTagString(s1));
} }
itemstack2.a("pages", nbttaglist); itemstack2.a("pages", (NBTBase) nbttaglist);
CraftEventFactory.handleEditBookEvent(player, itemstack2); // CraftBukkit CraftEventFactory.handleEditBookEvent(player, itemstack2); // CraftBukkit
} }
} catch (Exception exception1) { } catch (Exception exception1) {
@@ -2554,7 +2522,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
boolean flag3 = packetdataserializer.readBoolean(); boolean flag3 = packetdataserializer.readBoolean();
if (commandblocklistenerabstract1 != null) { if (commandblocklistenerabstract1 != null) {
EnumDirection enumdirection = this.player.world.getType(blockposition).get(BlockCommand.a); EnumDirection enumdirection = (EnumDirection) this.player.world.getType(blockposition).get(BlockCommand.a);
IBlockData iblockdata; IBlockData iblockdata;
switch (tileentitycommand_type) { switch (tileentitycommand_type) {
@@ -2674,23 +2642,23 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (b1 == 2) { if (b1 == 2) {
if (tileentitystructure.q()) { if (tileentitystructure.q()) {
this.player.a((new ChatMessage("structure_block.save_success", new Object[] { s7})), false); this.player.a((IChatBaseComponent) (new ChatMessage("structure_block.save_success", new Object[] { s7})), false);
} else { } else {
this.player.a((new ChatMessage("structure_block.save_failure", new Object[] { s7})), false); this.player.a((IChatBaseComponent) (new ChatMessage("structure_block.save_failure", new Object[] { s7})), false);
} }
} else if (b1 == 3) { } else if (b1 == 3) {
if (!tileentitystructure.E()) { if (!tileentitystructure.E()) {
this.player.a((new ChatMessage("structure_block.load_not_found", new Object[] { s7})), false); this.player.a((IChatBaseComponent) (new ChatMessage("structure_block.load_not_found", new Object[] { s7})), false);
} else if (tileentitystructure.r()) { } else if (tileentitystructure.r()) {
this.player.a((new ChatMessage("structure_block.load_success", new Object[] { s7})), false); this.player.a((IChatBaseComponent) (new ChatMessage("structure_block.load_success", new Object[] { s7})), false);
} else { } else {
this.player.a((new ChatMessage("structure_block.load_prepare", new Object[] { s7})), false); this.player.a((IChatBaseComponent) (new ChatMessage("structure_block.load_prepare", new Object[] { s7})), false);
} }
} else if (b1 == 4) { } else if (b1 == 4) {
if (tileentitystructure.p()) { if (tileentitystructure.p()) {
this.player.a((new ChatMessage("structure_block.size_success", new Object[] { s7})), false); this.player.a((IChatBaseComponent) (new ChatMessage("structure_block.size_success", new Object[] { s7})), false);
} else { } else {
this.player.a((new ChatMessage("structure_block.size_failure", new Object[0])), false); this.player.a((IChatBaseComponent) (new ChatMessage("structure_block.size_failure", new Object[0])), false);
} }
} }

View File

@@ -439,7 +439,7 @@ public abstract class PlayerList {
entityplayer.b(StatisticList.f); entityplayer.b(StatisticList.f);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
org.bukkit.craftbukkit.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer); org.bukkit.craftbukkit.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer, org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), LocaleI18n.a(AkarinGlobalConfig.messagePlayerQuit, entityplayer.getName())); // Akarin - use I18n to replace name PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), LocaleI18n.a(AkarinGlobalConfig.messagePlayerQuit, entityplayer.getName())); // Akarin - use I18n to replace name
cserver.getPluginManager().callEvent(playerQuitEvent); cserver.getPluginManager().callEvent(playerQuitEvent);

View File

@@ -646,7 +646,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory // Close any foreign inventory
if (getHandle().activeContainer != getHandle().defaultContainer) { if (getHandle().activeContainer != getHandle().defaultContainer) {
getHandle().closeInventory(); getHandle().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.TELEPORT); // Paper
} }
// Check if the fromWorld and toWorld are the same. // Check if the fromWorld and toWorld are the same.