NOT FINISHED! 1.13-pre7 - even more patches!

Patches, patches everywhere!
This commit is contained in:
Shane Freeder 2018-07-18 01:08:13 +01:00
parent c8d8659ad3
commit 3cb169aa7c
50 changed files with 273 additions and 1171 deletions

View File

@ -13,7 +13,7 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
If Tile Entity was null, correct Sign to return empty lines instead of null If Tile Entity was null, correct Sign to return empty lines instead of null
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 358c99227..5b5f102e2 100644 index 2cfe2202e..909432d51 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java --- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { @@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
@ -38,28 +38,13 @@ index 358c99227..5b5f102e2 100644
if (state instanceof InventoryHolder) return (InventoryHolder) state; if (state instanceof InventoryHolder) return (InventoryHolder) state;
return null; return null;
} }
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 54b719d91..3f2c5b2d5 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity {
}
public MinecraftServer C_() {
- return TileEntitySign.this.world.getMinecraftServer();
+ return MinecraftServer.getServer(); // Paper - world may be null
}
};
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 46670c346..a9d3f12bc 100644 index bfed2d988..d1eea2133 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -0,0 +0,0 @@ public class CraftBlock implements Block { @@ -0,0 +0,0 @@ public class CraftBlock implements Block {
}
} }
+
public BlockState getState() { public BlockState getState() {
+ // Paper start - allow disabling the use of snapshots + // Paper start - allow disabling the use of snapshots
+ return getState(true); + return getState(true);
@ -79,7 +64,7 @@ index 46670c346..a9d3f12bc 100644
switch (material) { switch (material) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 266f87d7f..fe112812d 100644 index 0558cafe3..d4d9c5fc5 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState @@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
@ -91,10 +76,10 @@ index 266f87d7f..fe112812d 100644
+ if (DISABLE_SNAPSHOT) { + if (DISABLE_SNAPSHOT) {
+ this.snapshot = this.tileEntity; + this.snapshot = this.tileEntity;
+ } else { + } else {
+ this.snapshot = this.createSnapshot(this.tileEntity); + this.snapshot = this.createSnapshot(this.tileEntity, world.getHandle());
+ } + }
// copy tile entity data: // copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity); - this.snapshot = this.createSnapshot(tileEntity, world.getHandle());
- this.load(snapshot); - this.load(snapshot);
+ if(this.snapshot != null) { + if(this.snapshot != null) {
+ this.load(this.snapshot); + this.load(this.snapshot);
@ -116,10 +101,10 @@ index 266f87d7f..fe112812d 100644
+ if (DISABLE_SNAPSHOT) { + if (DISABLE_SNAPSHOT) {
+ this.snapshot = this.tileEntity; + this.snapshot = this.tileEntity;
+ } else { + } else {
+ this.snapshot = this.createSnapshot(this.tileEntity); + this.snapshot = this.createSnapshot(this.tileEntity, null);
+ } + }
// copy tile entity data: // copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity); - this.snapshot = this.createSnapshot(tileEntity, null);
- this.load(snapshot); - this.load(snapshot);
+ if(this.snapshot != null) { + if(this.snapshot != null) {
+ this.load(this.snapshot); + this.load(this.snapshot);
@ -127,7 +112,7 @@ index 266f87d7f..fe112812d 100644
+ // Paper end + // Paper end
} }
private T createSnapshot(T tileEntity) { private T createSnapshot(T tileEntity, World world) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 7a8d44529..97b4e6910 100644 index 7a8d44529..97b4e6910 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 44335fd2d..9adcabd4f 100644 index f4a766800..401410b87 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@

View File

@ -5,25 +5,26 @@ Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index deb0f4a9c..579996d1e 100644 index 85e617979..8cf082d2e 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
return 0;
}
public void b(List<IRecipe> list) {} + public void jump() { this.cG(); } // Paper - OBFHELPER
public void cG() {
+ public void jump() { this.cu(); } // Paper - OBFHELPER super.cG();
public void cu() { this.a(StatisticList.JUMP);
super.cu();
this.b(StatisticList.w);
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3104fc0ea..aa57ff8ed 100644 index 128b2beb5..2255b8ccb 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ import org.bukkit.inventory.EquipmentSlot; @@ -0,0 +0,0 @@ import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
import org.bukkit.util.NumberConversions; import org.bukkit.util.NumberConversions;
import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper +import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper
+import com.destroystokyo.paper.event.player.PlayerJumpEvent; // Paper +import com.destroystokyo.paper.event.player.PlayerJumpEvent; // Paper
import co.aikar.timings.MinecraftTimings; // Paper import co.aikar.timings.MinecraftTimings; // Paper
// CraftBukkit end // CraftBukkit end
@ -31,8 +32,8 @@ index 3104fc0ea..aa57ff8ed 100644
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
d8 = d5 - this.p; d8 = d5 - this.p;
d9 = d6 - this.q; d9 = d6 - this.q;
if (this.player.onGround && !packetplayinflying.a() && d8 > 0.0D) { if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) {
- this.player.cu(); - this.player.cG();
+ // Paper start - Add player jump event + // Paper start - Add player jump event
+ Player player = this.getPlayer(); + Player player = this.getPlayer();
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add UnknownCommandEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 539f492e0..77c16fe2c 100644 index 3b10c5e61..46f86359c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.Versioning; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.Versioning;
@ -19,7 +19,7 @@ index 539f492e0..77c16fe2c 100644
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
// Spigot start // Spigot start
if (StringUtils.isNotEmpty(org.spigotmc.SpigotConfig.unknownCommandMessage)) { if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
- sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage); - sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage);
+ // Paper start + // Paper start
+ UnknownCommandEvent event = new UnknownCommandEvent(sender, commandLine, org.spigotmc.SpigotConfig.unknownCommandMessage); + UnknownCommandEvent event = new UnknownCommandEvent(sender, commandLine, org.spigotmc.SpigotConfig.unknownCommandMessage);

View File

@ -20,7 +20,7 @@ index ea6fcb39f..dbafef023 100644
+ } + }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 41357cb0e..27c6caddc 100644 index f3dfd65d6..6c611c0df 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add missing coverages for getTileEntity in order to attempt
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 737ade74d..c06158e02 100644 index e766e2536..c5da2cde3 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {

View File

@ -11,7 +11,7 @@ I suspect Mojang may switch to this behavior before full release.
To be converted into a Paper-API event at some point in the future? To be converted into a Paper-API event at some point in the future?
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 29b4bdb47..31aad03c2 100644 index 0b748d402..99fe720e8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -0,0 +0,0 @@ public class PaperWorldConfig {
@ -26,7 +26,7 @@ index 29b4bdb47..31aad03c2 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 0f1d99636..9cda8a177 100644 index 36a961cb7..0da76b268 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
@ -39,11 +39,11 @@ index 0f1d99636..9cda8a177 100644
} }
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 802008b4e..6d733e153 100644 index 25e3d6423..128b2beb5 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
switch (packetplayinentityaction.b()) { switch (packetplayinentityaction.c()) {
case START_SNEAKING: case START_SNEAKING:
this.player.setSneaking(true); this.player.setSneaking(true);
+ +

View File

@ -11,7 +11,7 @@ to make books with as much data as they want. Do not use this without
limiting incoming data from packets in some other way. limiting incoming data from packets in some other way.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
index a7e51d9f1..ffdb7ec82 100644 index 6ff1a2dcd..64a939952 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { @@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {

View File

@ -27,7 +27,7 @@ index dbafef023..ec89ecfca 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index c5434e6ba..75df92836 100644 index bab13a4fd..d0e719f44 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java --- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Anti-Xray
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 646620d0c..4d30cdbc8 100644 index c80d84b9b..6344537ec 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
@ -1007,92 +1007,21 @@ index 000000000..8ea2beb59
+ chunkPacketBlockControllerAntiXray.obfuscate(this); + chunkPacketBlockControllerAntiXray.obfuscate(this);
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 27a36b2b0..cb33cf902 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk {
int j1 = i1 >> 4;
if (this.sections[j1] == Chunk.a) {
- this.sections[j1] = new ChunkSection(j1 << 4, flag1);
+ this.sections[j1] = new ChunkSection(j1 << 4, flag1, world.chunkPacketBlockController.getPredefinedBlockData(this, j1)); // Paper - Anti-Xray - Add predefined block data
}
this.sections[j1].setType(k, i1 & 15, l, iblockdata);
@@ -0,0 +0,0 @@ public class Chunk {
return null;
}
- chunksection = new ChunkSection(j >> 4 << 4, this.world.worldProvider.m());
+ chunksection = new ChunkSection(j >> 4 << 4, this.world.worldProvider.m(), this.world.chunkPacketBlockController.getPredefinedBlockData(this, j >> 4)); // Paper - Anti-Xray - Add predefined block data
this.sections[j >> 4] = chunksection;
flag = j >= i1;
}
@@ -0,0 +0,0 @@ public class Chunk {
ChunkSection chunksection = this.sections[k >> 4];
if (chunksection == Chunk.a) {
- chunksection = new ChunkSection(k >> 4 << 4, this.world.worldProvider.m());
+ chunksection = new ChunkSection(k >> 4 << 4, this.world.worldProvider.m(), this.world.chunkPacketBlockController.getPredefinedBlockData(this, k >> 4)); // Paper - Anti-Xray - Add predefined block data
this.sections[k >> 4] = chunksection;
this.initLighting();
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 14f88e91d..bcce5e8b7 100644 index fedc38dc1..a96a2a28d 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
for (int k = 0; k < nbttaglist.size(); ++k) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = nbttaglist.get(k); NBTTagCompound nbttagcompound = nbttaglist.getCompound(i);
byte b0 = nbttagcompound1.getByte("Y"); byte b0 = nbttagcompound.getByte("Y");
- ChunkSection chunksection = new ChunkSection(b0 << 4, flag1); - ChunkSection chunksection = new ChunkSection(b0 << 4, flag1);
+ ChunkSection chunksection = new ChunkSection(b0 << 4, flag1, world.chunkPacketBlockController.getPredefinedBlockData(chunk, b0)); // Paper - Anti-Xray - Add predefined block data + ChunkSection chunksection = new ChunkSection(b0 << 4, flag1, world.chunkPacketBlockController.getPredefinedBlockData(chunk, b0)); // Paper - Anti-Xray - Add predefined block data
byte[] abyte = nbttagcompound1.getByteArray("Blocks");
NibbleArray nibblearray = new NibbleArray(nbttagcompound1.getByteArray("Data"));
NibbleArray nibblearray1 = nbttagcompound1.hasKeyOfType("Add", 7) ? new NibbleArray(nbttagcompound1.getByteArray("Add")) : null;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index afdc4a779..aae227fdb 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -0,0 +0,0 @@ public class ChunkSection {
private NibbleArray emittedLight;
private NibbleArray skyLight;
+ // Paper start - Anti-Xray - Support default constructor chunksection.getBlocks().a(nbttagcompound, "Palette", "BlockStates");
public ChunkSection(int i, boolean flag) { chunksection.a(new NibbleArray(nbttagcompound.getByteArray("BlockLight")));
+ this(i, flag, (IBlockData[]) null);
+ }
+ // Paper end
+
+ public ChunkSection(int i, boolean flag, IBlockData[] predefinedBlockData) { // Paper - Anti-Xray - Add predefined block data
this.yPos = i;
- this.blockIds = new DataPaletteBlock();
+ this.blockIds = new DataPaletteBlock(predefinedBlockData); // Paper - Anti-Xray - Add predefined block data
this.emittedLight = new NibbleArray();
if (flag) {
this.skyLight = new NibbleArray();
@@ -0,0 +0,0 @@ public class ChunkSection {
}
- // CraftBukkit start
+ // Paper start - Anti-Xray - Support default constructor
public ChunkSection(int y, boolean flag, char[] blockIds) {
+ this(y, flag, blockIds, null);
+ }
+ // Paper end
+
+ // CraftBukkit start
+ public ChunkSection(int y, boolean flag, char[] blockIds, IBlockData[] predefinedBlockData) { // Paper - Anti-Xray - Add predefined block data
this.yPos = y;
- this.blockIds = new DataPaletteBlock();
+ this.blockIds = new DataPaletteBlock(predefinedBlockData); // Paper - Anti-Xray - Add predefined block data
for (int i = 0; i < blockIds.length; i++) {
int xx = i & 15;
int yy = (i >> 8) & 15;
diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java
index fa0fd8a9c..401dc7cdc 100644 index 0fb3162e6..54df71404 100644
--- a/src/main/java/net/minecraft/server/DataBits.java --- a/src/main/java/net/minecraft/server/DataBits.java
+++ b/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java
@@ -0,0 +0,0 @@ public class DataBits { @@ -0,0 +0,0 @@ public class DataBits {
@ -1103,136 +1032,13 @@ index fa0fd8a9c..401dc7cdc 100644
public long[] a() { public long[] a() {
return this.a; return this.a;
} }
diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java
index 5765b2588..d522611ec 100644
--- a/src/main/java/net/minecraft/server/DataPalette.java
+++ b/src/main/java/net/minecraft/server/DataPalette.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
public interface DataPalette {
+ default int getDataBits(IBlockData blockData) { return this.a(blockData); } // Paper - Anti-Xray - OBFHELPER
int a(IBlockData iblockdata);
+ @Nullable default IBlockData getBlockData(int dataBits) { return this.a(dataBits); } // Paper - Anti-Xray - OBFHELPER
@Nullable
IBlockData a(int i);
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
index 2cb462b8e..67784b4a6 100644
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -0,0 +0,0 @@ package net.minecraft.server;
import javax.annotation.Nullable;
+// Paper start
+import com.destroystokyo.paper.antixray.PacketPlayOutMapChunkInfo; // Anti-Xray
+// Paper end
+
public class DataPaletteBlock implements DataPaletteExpandable {
private static final DataPalette d = new DataPaletteGlobal();
protected static final IBlockData a = Blocks.AIR.getBlockData(); public static final IBlockData DEFAULT_BLOCK_DATA = DataPaletteBlock.a; // Paper - OBFHELPER
- protected DataBits b;
- protected DataPalette c;
- private int e;
+ protected DataBits b; protected DataBits getDataBits() { return this.b; } // Paper - Anti-Xray - OBFHELPER
+ protected DataPalette c; protected DataPalette getDataPalette() { return this.c; } // Paper - Anti-Xray - OBFHELPER
+ private int e; private int getBitsPerValue() { return this.e; } // Paper - Anti-Xray - OBFHELPER
+ private final IBlockData[] predefinedBlockData; // Paper - Anti-Xray - Add predefined block data
+ // Paper start - Anti-Xray - Support default constructor
public DataPaletteBlock() {
- this.b(4);
+ this(null);
}
+ // Paper end
+
+ // Paper start - Anti-Xray - Add predefined block data
+ public DataPaletteBlock(IBlockData[] predefinedBlockData) {
+ this.predefinedBlockData = predefinedBlockData;
+
+ if (predefinedBlockData == null) {
+ // Default constructor
+ this.setBitsPerValue(4);
+ } else {
+ // Count the bits of the maximum array index to initialize a data palette with enough space from the beginning
+ // The length of the array is used because air is also added to the data palette from the beginning
+ // Start with at least 4
+ int maxIndex = predefinedBlockData.length >> 4;
+ int bitCount = 4;
+
+ while (maxIndex != 0) {
+ maxIndex >>= 1;
+ bitCount++;
+ }
+
+ // Initialize with at least 15 free indixes
+ this.setBitsPerValue((1 << bitCount) - predefinedBlockData.length < 16 ? bitCount + 1 : bitCount);
+ }
+ }
+ // Paper end
private static int b(int i, int j, int k) {
return j << 8 | k << 4 | i;
}
+ private void setBitsPerValue(int bitsPerValue) { this.b(bitsPerValue); } // Paper - Anti-Xray - OBFHELPER
private void b(int i) {
if (i != this.e) {
this.e = i;
@@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable {
}
this.c.a(DataPaletteBlock.a);
+
+ // Paper start - Anti-Xray - Add predefined block data
+ if (this.predefinedBlockData != null) {
+ for (int j = 0; j < this.predefinedBlockData.length; j++) {
+ this.getDataPalette().getDataBits(this.predefinedBlockData[j]);
+ }
+ }
+ // Paper end
+
this.b = new DataBits(this.e, 4096);
}
}
@@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable {
return iblockdata == null ? DataPaletteBlock.a : iblockdata;
}
+ // Paper start - Anti-Xray - Support default method
+ public void writeBlocks(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // OBFHELPER
public void b(PacketDataSerializer packetdataserializer) {
+ this.b(packetdataserializer, null, 0);
+ }
+ // Paper end
+
+ public void writeBlocks(PacketDataSerializer packetDataSerializer, PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo, int chunkSectionIndex) { this.b(packetDataSerializer, packetPlayOutMapChunkInfo, chunkSectionIndex); } // Paper - Anti-Xray - OBFHELPER
+ public void b(PacketDataSerializer packetdataserializer, PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo, int chunkSectionIndex) { // Paper - Anti-Xray - Add chunk packet info
packetdataserializer.writeByte(this.e);
this.c.b(packetdataserializer);
+
+ // Paper start - Anti-Xray - Add chunk packet info
+ if (packetPlayOutMapChunkInfo != null) {
+ packetPlayOutMapChunkInfo.setBitsPerValue(chunkSectionIndex, this.getBitsPerValue());
+ packetPlayOutMapChunkInfo.setDataPalette(chunkSectionIndex, this.getDataPalette());
+ packetPlayOutMapChunkInfo.setDataBitsIndex(chunkSectionIndex, packetdataserializer.writerIndex() + PacketDataSerializer.countBytes(this.getDataBits().getDataBits().length));
+ packetPlayOutMapChunkInfo.setPredefinedBlockData(chunkSectionIndex, this.predefinedBlockData);
+ }
+ // Paper end
+
packetdataserializer.a(this.b.a());
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index d0b67d8fd..eeaa625d2 100644 index c4a25bd87..b92432d50 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
blockposition = new BlockPosition(this); blockposition = new BlockPosition(this);
if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR, 0).isCancelled()) { if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
this.world.setAir(blockposition); this.world.setAir(blockposition);
+ this.world.chunkPacketBlockController.updateNearbyBlocks(this.world, blockposition); // Paper - Anti-Xray + this.world.chunkPacketBlockController.updateNearbyBlocks(this.world, blockposition); // Paper - Anti-Xray
} else if (!this.world.isClientSide) { } else if (!this.world.isClientSide) {
@ -1247,7 +1053,7 @@ index d0b67d8fd..eeaa625d2 100644
if (block instanceof BlockFalling) { if (block instanceof BlockFalling) {
((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata); ((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index e148901e5..61fbdeb6a 100644 index 2652b1575..09f90450a 100644
--- a/src/main/java/net/minecraft/server/Explosion.java --- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion { @@ -0,0 +0,0 @@ public class Explosion {
@ -1258,107 +1064,8 @@ index e148901e5..61fbdeb6a 100644
if (flag) { if (flag) {
double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat()); double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat());
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index d583cced6..2eddb68d7 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
};
private final EnumProtocolDirection h;
- private final Queue<NetworkManager.QueuedPacket> i = Queues.newConcurrentLinkedQueue();
+ private final Queue<NetworkManager.QueuedPacket> i = Queues.newConcurrentLinkedQueue(); private final Queue<NetworkManager.QueuedPacket> getPacketQueue() { return this.i; } // Paper - Anti-Xray - OBFHELPER
private final ReentrantReadWriteLock j = new ReentrantReadWriteLock();
public Channel channel;
// Spigot Start // PAIL
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
public void sendPacket(Packet<?> packet) {
- if (this.isConnected()) {
- this.m();
+ if (this.isConnected() && this.trySendQueue() && !(packet instanceof PacketPlayOutMapChunk && !((PacketPlayOutMapChunk) packet).isReady())) { // Paper - Async-Anti-Xray - Add chunk packets which are not ready or all packets if the queue contains chunk packets which are not ready to the queue and send the packets later in the right order
+ //this.m(); // Paper - Async-Anti-Xray - Move to if statement (this.trySendQueue())
this.a(packet, (GenericFutureListener[]) null);
} else {
this.j.writeLock().lock();
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
public void sendPacket(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, GenericFutureListener<? extends Future<? super Void>>... agenericfuturelistener) {
- if (this.isConnected()) {
- this.m();
+ if (this.isConnected() && this.trySendQueue() && !(packet instanceof PacketPlayOutMapChunk && !((PacketPlayOutMapChunk) packet).isReady())) { // Paper - Async-Anti-Xray - Add chunk packets which are not ready or all packets if the queue contains chunk packets which are not ready to the queue and send the packets later in the right order
+ //this.m(); // Paper - Async-Anti-Xray - Move to if statement (this.trySendQueue())
this.a(packet, (GenericFutureListener[]) ArrayUtils.add(agenericfuturelistener, 0, genericfuturelistener));
} else {
this.j.writeLock().lock();
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
+ private void dispatchPacket(final Packet<?> packet, @Nullable final GenericFutureListener<? extends Future<? super Void>>[] genericFutureListeners) { this.a(packet, genericFutureListeners); } // Paper - Anti-Xray - OBFHELPER
private void a(final Packet<?> packet, @Nullable final GenericFutureListener<? extends Future<? super Void>>[] agenericfuturelistener) {
final EnumProtocol enumprotocol = EnumProtocol.a(packet);
final EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get();
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
- private void m() {
+ // Paper start - Async-Anti-Xray - Stop dispatching further packets and return false if the peeked packet is a chunk packet which is not ready
+ private boolean trySendQueue() { return this.m(); } // OBFHELPER
+ private boolean m() { // void -> boolean
if (this.channel != null && this.channel.isOpen()) {
- this.j.readLock().lock();
+ if (this.i.isEmpty()) { // return if the packet queue is empty so that the write lock by Anti-Xray doesn't affect the vanilla performance at all
+ return true;
+ }
+
+ this.j.writeLock().lock(); // readLock -> writeLock (because of race condition between peek and poll)
try {
while (!this.i.isEmpty()) {
- NetworkManager.QueuedPacket networkmanager_queuedpacket = (NetworkManager.QueuedPacket) this.i.poll();
-
- this.a(networkmanager_queuedpacket.a, networkmanager_queuedpacket.b);
+ NetworkManager.QueuedPacket networkmanager_queuedpacket = (NetworkManager.QueuedPacket) this.getPacketQueue().peek(); // poll -> peek
+
+ if (networkmanager_queuedpacket != null) { // Fix NPE (Spigot bug caused by handleDisconnection())
+ if (networkmanager_queuedpacket.getPacket() instanceof PacketPlayOutMapChunk && !((PacketPlayOutMapChunk) networkmanager_queuedpacket.getPacket()).isReady()) { // Check if the peeked packet is a chunk packet which is not ready
+ return false; // Return false if the peeked packet is a chunk packet which is not ready
+ } else {
+ this.getPacketQueue().poll(); // poll here
+ this.dispatchPacket(networkmanager_queuedpacket.getPacket(), networkmanager_queuedpacket.getGenericFutureListeners()); // dispatch the packet
+ }
+ }
}
} finally {
- this.j.readLock().unlock();
+ this.j.writeLock().unlock(); // readLock -> writeLock (because of race condition between peek and poll)
}
}
+
+ return true; // Return true if all packets were dispatched
}
+ // Paper end
public void a() {
this.m();
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
static class QueuedPacket {
- private final Packet<?> a;
- private final GenericFutureListener<? extends Future<? super Void>>[] b;
+ private final Packet<?> a; private final Packet<?> getPacket() { return this.a; } // Paper - Anti-Xray - OBFHELPER
+ private final GenericFutureListener<? extends Future<? super Void>>[] b; private final GenericFutureListener<? extends Future<? super Void>>[] getGenericFutureListeners() { return this.b; } // Paper - Anti-Xray - OBFHELPER
public QueuedPacket(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>>... agenericfuturelistener) {
this.a = packet;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index c1273e988..d71734df8 100644 index d04afceb7..02ab42a64 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf {
@ -1369,101 +1076,8 @@ index c1273e988..d71734df8 100644
public static int a(int i) { public static int a(int i) {
for (int j = 1; j < 5; ++j) { for (int j = 1; j < 5; ++j) {
if ((i & -1 << j * 7) == 0) { if ((i & -1 << j * 7) == 0) {
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index d16669bcc..306a6b7cd 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -0,0 +0,0 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
+// Paper start
+import com.destroystokyo.paper.antixray.PacketPlayOutMapChunkInfo; // Anti-Xray
+// Paper end
+
public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
private int a;
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
private byte[] d;
private List<NBTTagCompound> e;
private boolean f;
+ private volatile boolean ready = false; // Paper - Async-Anti-Xray - Ready flag for the network manager
- public PacketPlayOutMapChunk() {}
+ // Paper start - Async-Anti-Xray - Set the ready flag to true
+ public PacketPlayOutMapChunk() {
+ this.ready = true;
+ }
+ // Paper end
public PacketPlayOutMapChunk(Chunk chunk, int i) {
+ PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo = chunk.world.chunkPacketBlockController.getPacketPlayOutMapChunkInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info
this.a = chunk.locX;
this.b = chunk.locZ;
this.f = i == '\uffff';
boolean flag = chunk.getWorld().worldProvider.m();
this.d = new byte[this.a(chunk, flag, i)];
- this.c = this.a(new PacketDataSerializer(this.g()), chunk, flag, i);
+
+ // Paper start - Anti-Xray - Add chunk packet info
+ if (packetPlayOutMapChunkInfo != null) {
+ packetPlayOutMapChunkInfo.setData(this.d);
+ }
+ // Paper end
+
+ this.c = this.writeChunk(new PacketDataSerializer(this.g()), chunk, flag, i, packetPlayOutMapChunkInfo); // Paper - Anti-Xray - Add chunk packet info
this.e = Lists.newArrayList();
Iterator iterator = chunk.getTileEntities().entrySet().iterator();
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
}
}
+ chunk.world.chunkPacketBlockController.modifyBlocks(this, packetPlayOutMapChunkInfo); // Paper - Anti-Xray - Modify blocks
}
+ // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag
+ public boolean isReady() {
+ return this.ready;
+ }
+
+ public void setReady(boolean ready) {
+ this.ready = ready;
+ }
+ // Paper end
+
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readInt();
this.b = packetdataserializer.readInt();
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
return bytebuf;
}
+ // Paper start - Anti-Xray - Support default method
+ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, boolean writeSkyLightArray, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, writeSkyLightArray, chunkSectionSelector); } // OBFHELPER
public int a(PacketDataSerializer packetdataserializer, Chunk chunk, boolean flag, int i) {
+ return this.a(packetdataserializer, chunk, flag, i, null);
+ }
+ // Paper end
+
+ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, boolean writeSkyLightArray, int chunkSectionSelector, PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo) { return this.a(packetDataSerializer, chunk, writeSkyLightArray, chunkSectionSelector, packetPlayOutMapChunkInfo); } // Paper - Anti-Xray - OBFHELPER
+ public int a(PacketDataSerializer packetdataserializer, Chunk chunk, boolean flag, int i, PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo) { // Paper - Anti-Xray - Add chunk packet info
int j = 0;
ChunkSection[] achunksection = chunk.getSections();
int k = 0;
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
if (chunksection != Chunk.a && (!this.e() || !chunksection.a()) && (i & 1 << k) != 0) {
j |= 1 << k;
- chunksection.getBlocks().b(packetdataserializer);
+ chunksection.getBlocks().writeBlocks(packetdataserializer, packetPlayOutMapChunkInfo, k); // Paper - Anti-Xray - Add chunk packet info
packetdataserializer.writeBytes(chunksection.getEmittedLightArray().asBytes());
if (flag) {
packetdataserializer.writeBytes(chunksection.getSkyLightArray().asBytes());
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 48a008e0a..395386f29 100644 index 344b95233..32b790397 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java --- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -0,0 +0,0 @@ public class PlayerChunk { @@ -0,0 +0,0 @@ public class PlayerChunk {
@ -1493,7 +1107,7 @@ index 48a008e0a..395386f29 100644
} else { } else {
this.a((Packet) (new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, this.chunk))); this.a((Packet) (new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, this.chunk)));
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index a49b5c81a..5ec7f5819 100644 index e34198e40..ce8f76871 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -0,0 +0,0 @@ public class PlayerInteractManager { @@ -0,0 +0,0 @@ public class PlayerInteractManager {
@ -1506,31 +1120,31 @@ index a49b5c81a..5ec7f5819 100644
public void a(BlockPosition blockposition) { public void a(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java
index 8860a0129..fa0d66d63 100644 index ef332d651..35c3edca4 100644
--- a/src/main/java/net/minecraft/server/RegistryBlockID.java --- a/src/main/java/net/minecraft/server/RegistryBlockID.java
+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java
@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry { // Paper - Fix decompile e @@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> {
return Iterators.filter(this.b.iterator(), Predicates.notNull()); return Iterators.filter(this.c.iterator(), Predicates.notNull());
} }
+ public int size() { return this.a(); } // Paper - Anti-Xray - OBFHELPER + public int size() { return this.a(); } // Paper - Anti-Xray - OBFHELPER
public int a() { public int a() {
return this.a.size(); return this.b.size();
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 90f946e57..ea67b61b2 100644 index 49e7c1589..62fd2e503 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator; @@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator;
// CraftBukkit end
// Paper start // Paper start
import java.util.Set; import java.util.Set;
+import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Anti-Xray +import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Anti-Xray
+import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Anti-Xray +import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Anti-Xray
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
// Paper end // Paper end
public abstract class World implements GeneratorAccess, IIBlockAccess, AutoCloseable {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
@ -1538,7 +1152,7 @@ index 90f946e57..ea67b61b2 100644
public final co.aikar.timings.WorldTimingsHandler timings; // Paper public final co.aikar.timings.WorldTimingsHandler timings; // Paper
private boolean guardEntityList; // Spigot private boolean guardEntityList; // Spigot
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
@ -1546,52 +1160,12 @@ index 90f946e57..ea67b61b2 100644
this.generator = gen; this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env); this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.c(blockposition, block); ((IWorldAccess) this.v.get(j)).a(this, blockposition, iblockdata, iblockdata1, i);
} }
+ this.chunkPacketBlockController.updateNearbyBlocks(this, blockposition); // Paper - Anti-Xray + this.chunkPacketBlockController.updateNearbyBlocks(this, blockposition); // Paper - Anti-Xray
} }
public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) { public void update(BlockPosition blockposition, Block block) {
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index 9942f0c75..2da6edc63 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -0,0 +0,0 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
}
// Build chunk section
if (emptyTest != 0) {
- csect[sec] = new ChunkSection(sec << 4, true, section);
+ csect[sec] = new ChunkSection(sec << 4, true, section, this.world.chunkPacketBlockController.getPredefinedBlockData(chunk, sec)); // Paper - Anti-Xray - Add predefined block data
}
}
}
@@ -0,0 +0,0 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
secBlkID[i] = (char) Block.REGISTRY_ID.getId(b.getBlockData());
}
// Build chunk section
- csect[sec] = new ChunkSection(sec << 4, true, secBlkID);
+ csect[sec] = new ChunkSection(sec << 4, true, secBlkID, this.world.chunkPacketBlockController.getPredefinedBlockData(chunk, sec)); // Paper - Anti-Xray - Add predefined block data
}
}
else { // Else check for byte-per-block section data
@@ -0,0 +0,0 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
Block b = Block.getById(btypes[sec][i] & 0xFF);
secBlkID[i] = (char) Block.REGISTRY_ID.getId(b.getBlockData());
}
- csect[sec] = new ChunkSection(sec << 4, true, secBlkID);
+ csect[sec] = new ChunkSection(sec << 4, true, secBlkID, this.world.chunkPacketBlockController.getPredefinedBlockData(chunk, sec)); // Paper - Anti-Xray - Add predefined block data
}
}
else { // Else, fall back to pre 1.2 method
@@ -0,0 +0,0 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
}
// If section built, finish prepping its state
if (csbytes != null) {
- ChunkSection cs = csect[sec] = new ChunkSection(sec << 4, true, csbytes);
+ ChunkSection cs = csect[sec] = new ChunkSection(sec << 4, true, csbytes, this.world.chunkPacketBlockController.getPredefinedBlockData(chunk, sec)); // Paper - Anti-Xray - Add predefined block data
cs.recalcBlockCounts();
}
}
-- --

View File

@ -1,141 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:19:58 -0500
Subject: [PATCH] AsyncTabCompleteEvent
Let plugins be able to control tab completion of commands and chat async.
This will be useful for frameworks like ACF so we can define async safe completion handlers,
and avoid going to main for tab completions.
Especially useful if you need to query a database in order to obtain the results for tab
completion, such as offline players.
Also adds isCommand and getLocation to the sync TabCompleteEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e01013efd..74a665142 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end
}
- public void a(PacketPlayInTabComplete packetplayintabcomplete) {
- PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.x());
+ // Paper start - async tab completion
+ public void a(PacketPlayInTabComplete packet) {
// CraftBukkit start
if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) {
- this.disconnect(new ChatMessage("disconnect.spam", new Object[0]));
+ minecraftServer.postToMainThread(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0])));
return;
}
// CraftBukkit end
- ArrayList arraylist = Lists.newArrayList();
- Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator();
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
+ com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event;
+ java.util.List<String> completions = new ArrayList<>();
+ BlockPosition blockpos = packet.b();
+ String buffer = packet.a();
+ boolean isCommand = buffer.startsWith("/") || packet.c();
+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getPlayer(), completions,
+ buffer, isCommand, blockpos != null ? MCUtil.toLocation(player.world, blockpos) : null);
+ event.callEvent();
+ completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions();
+ if (event.isCancelled() || event.isHandled()) {
+ // Still fire sync event with the provided completions, if someone is listening
+ if (!event.isCancelled() && org.bukkit.event.server.TabCompleteEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ java.util.List<String> finalCompletions = completions;
+ Waitable<java.util.List<String>> syncCompletions = new Waitable<java.util.List<String>>() {
+ @Override
+ protected java.util.List<String> evaluate() {
+ org.bukkit.event.server.TabCompleteEvent syncEvent = new org.bukkit.event.server.TabCompleteEvent(PlayerConnection.this.getPlayer(), buffer, finalCompletions, isCommand, blockpos != null ? MCUtil.toLocation(player.world, blockpos) : null);
+ return syncEvent.callEvent() ? syncEvent.getCompletions() : com.google.common.collect.ImmutableList.of();
+ }
+ };
+ server.getServer().processQueue.add(syncCompletions);
+ try {
+ completions = syncCompletions.get();
+ } catch (InterruptedException | ExecutionException e1) {
+ e1.printStackTrace();
+ }
+ }
- arraylist.add(s);
+ this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete(completions.toArray(new String[completions.size()])));
+ return;
}
-
- this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete((String[]) arraylist.toArray(new String[arraylist.size()])));
+ minecraftServer.postToMainThread(() -> {
+ java.util.List<String> syncCompletions = this.minecraftServer.tabCompleteCommand(this.player, buffer, blockpos, isCommand);
+ this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete(syncCompletions.toArray(new String[syncCompletions.size()])));
+ });
+ // Paper end
}
public void a(PacketPlayInSettings packetplayinsettings) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2dd7ed96a..e86c16755 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
} else {
offers = tabCompleteChat(player, message);
}
-
- TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers);
+
+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), pos) : null); // Paper
getPluginManager().callEvent(tabEvent);
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index 1e3aae3b8..95d13c146 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@@ -0,0 +0,0 @@ public class ConsoleCommandCompleter implements Completer {
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) {
final CraftServer server = this.server.server;
final String buffer = line.line();
+ // Async Tab Complete
+ com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event;
+ java.util.List<String> completions = new java.util.ArrayList<>();
+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(server.getConsoleSender(), completions,
+ buffer, true, null);
+ event.callEvent();
+ completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions();
+
+ if (event.isCancelled() || event.isHandled()) {
+ // Still fire sync event with the provided completions, if someone is listening
+ if (!event.isCancelled() && TabCompleteEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ List<String> finalCompletions = completions;
+ Waitable<List<String>> syncCompletions = new Waitable<List<String>>() {
+ @Override
+ protected List<String> evaluate() {
+ org.bukkit.event.server.TabCompleteEvent syncEvent = new org.bukkit.event.server.TabCompleteEvent(server.getConsoleSender(), buffer, finalCompletions);
+ return syncEvent.callEvent() ? syncEvent.getCompletions() : com.google.common.collect.ImmutableList.of();
+ }
+ };
+ server.getServer().processQueue.add(syncCompletions);
+ try {
+ completions = syncCompletions.get();
+ } catch (InterruptedException | ExecutionException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ if (!completions.isEmpty()) {
+ candidates.addAll(completions.stream().map(Candidate::new).collect(java.util.stream.Collectors.toList()));
+ }
+ return;
+ }
+
// Paper end
Waitable<List<String>> waitable = new Waitable<List<String>>() {
@Override
--

View File

@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 29 Nov 2017 22:18:54 -0500
Subject: [PATCH] Avoid NPE in PathfinderGoalTempt
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
index 188825d19..8004f3a3f 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
@@ -0,0 +0,0 @@ public class PathfinderGoalTempt extends PathfinderGoal {
}
this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle();
}
- return tempt;
+ return tempt && this.target != null; // Paper - must have target - plugin might of cancelled
// CraftBukkit end
}
}
--

View File

@ -429,10 +429,10 @@ index 02940d697..4539b5601 100644
* Calculates distance between 2 entities * Calculates distance between 2 entities
* @param e1 * @param e1
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e8bddc171..fcf6bac08 100644 index 39a8b1d69..4654e22c8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
*/ // CraftBukkit end */ // CraftBukkit end
String s1 = "."; // PAIL? String s1 = "."; // PAIL?
@ -441,16 +441,16 @@ index e8bddc171..fcf6bac08 100644
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName())); UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName()));
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.H = i; this.G = i;
} }
+ public MinecraftSessionService getSessionService() { return az(); } // Paper - OBFHELPER + public MinecraftSessionService getSessionService() { return ar(); } // Paper - OBFHELPER
public MinecraftSessionService az() { public MinecraftSessionService ar() {
return this.W; return this.V;
} }
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 7ce08eb8b..6a750c25e 100644 index a47a51a41..4c476f757 100644
--- a/src/main/java/net/minecraft/server/UserCache.java --- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -0,0 +0,0 @@ public class UserCache { @@ -0,0 +0,0 @@ public class UserCache {
@ -463,7 +463,7 @@ index 7ce08eb8b..6a750c25e 100644
private final Deque<GameProfile> f = new java.util.concurrent.LinkedBlockingDeque<GameProfile>(); // CraftBukkit private final Deque<GameProfile> f = new java.util.concurrent.LinkedBlockingDeque<GameProfile>(); // CraftBukkit
private final GameProfileRepository g; private final GameProfileRepository g;
@@ -0,0 +0,0 @@ public class UserCache { @@ -0,0 +0,0 @@ public class UserCache {
return (String[]) arraylist.toArray(new String[arraylist.size()]); return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
} }
+ // Paper start + // Paper start
@ -486,7 +486,7 @@ index 7ce08eb8b..6a750c25e 100644
private UserCacheEntry(GameProfile gameprofile, Date date) { private UserCacheEntry(GameProfile gameprofile, Date date) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 77c16fe2c..2dd7ed96a 100644 index 46f86359c..26bbb0265 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@ -498,7 +498,7 @@ index 77c16fe2c..2dd7ed96a 100644
+ +
+ +
public final class CraftServer implements Server { public final class CraftServer implements Server {
private final String serverName = "Paper"; private final String serverName = "Paper"; // Paper
private final String serverVersion; private final String serverVersion;
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() { public boolean suggestPlayerNamesWhenNullTabCompletions() {

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Block player logins during server shutdown
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 2158fcd32..c5434e6ba 100644 index 89a11a496..bab13a4fd 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java --- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {
} }
public void e() { public void X_() {
+ // Paper start - Do not allow logins while the server is shutting down + // Paper start - Do not allow logins while the server is shutting down
+ if (!MinecraftServer.getServer().isRunning()) { + if (!MinecraftServer.getServer().isRunning()) {
+ this.disconnect(new ChatMessage(org.spigotmc.SpigotConfig.restartMessage)); + this.disconnect(new ChatMessage(org.spigotmc.SpigotConfig.restartMessage));

View File

@ -12,12 +12,12 @@ just as it does in Vanilla, but entity pushing logic will be capped.
You can set this to 0 to disable collisions. You can set this to 0 to disable collisions.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5f06d4e5e..29b4bdb47 100644 index 5df8b1143..0b748d402 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void armorStandEntityLookups() { log("Treasure Maps will return already discovered locations");
armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); }
} }
+ +
+ public int maxCollisionsPerEntity; + public int maxCollisionsPerEntity;
@ -27,10 +27,10 @@ index 5f06d4e5e..29b4bdb47 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 20324deeb..b4233df5f 100644 index b47bf9738..db7e37aee 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final boolean defaultActivationState; public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE; public long activatedTick = Integer.MIN_VALUE;
public boolean fromMobSpawner; public boolean fromMobSpawner;
@ -39,7 +39,7 @@ index 20324deeb..b4233df5f 100644
// Spigot end // Spigot end
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 38c043375..c97ee68a5 100644 index 3a38f384e..8e45b557e 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {

View File

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Mon, 23 Jan 2017 15:10:25 -0600
Subject: [PATCH] Do not allow a zero max height in BiomeJungle
diff --git a/src/main/java/net/minecraft/server/BiomeJungle.java b/src/main/java/net/minecraft/server/BiomeJungle.java
index 8f67cb36c..8dc0b6238 100644
--- a/src/main/java/net/minecraft/server/BiomeJungle.java
+++ b/src/main/java/net/minecraft/server/BiomeJungle.java
@@ -0,0 +0,0 @@ public class BiomeJungle extends BiomeBase {
super.a(world, random, blockposition);
int i = random.nextInt(16) + 8;
int j = random.nextInt(16) + 8;
- int k = random.nextInt(world.getHighestBlockYAt(blockposition.a(i, 0, j)).getY() * 2);
+ // Paper start - Don't allow a 0 height
+ int height = world.getHighestBlockYAt(blockposition.add(i, 0, j)).getY() * 2;
+ if (height < 1) height = 1;
+ int k = random.nextInt(height);
+ // Paper end
(new WorldGenMelon()).generate(world, random, blockposition.a(i, k, j));
WorldGenVines worldgenvines = new WorldGenVines();
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 6a0b3a62d..38a7af58c 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -0,0 +0,0 @@ public class BlockPosition extends 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((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2);
}
--

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Do not let armorstands drown
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index ee3d37a71..df0d66ad0 100644 index 52a1036fd..26171b343 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java --- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
@ -20,24 +20,24 @@ index ee3d37a71..df0d66ad0 100644
// Paper end // Paper end
} }
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index c97ee68a5..44335fd2d 100644 index 8e45b557e..f4a766800 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition); super.a(d0, flag, iblockdata, blockposition);
} }
+ public boolean canBreatheUnderwater() { return this.bN(); } // Paper - OBFHELPER + public boolean canBreatheUnderwater() { return this.bZ(); } // Paper - OBFHELPER
public boolean bN() { public boolean bZ() {
return false; return this.getMonsterType() == EnumMonsterType.UNDEAD;
} }
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) { if (this.isAlive()) {
if (this.a(Material.WATER)) { if (this.a(TagsFluid.a) && this.world.getType(new BlockPosition(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ)).getBlock() != Blocks.BUBBLE_COLUMN) {
- if (!this.bN() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) { - if (!this.bZ() && !MobEffectUtil.c(this) && !flag1) {
+ if (!this.canBreatheUnderwater() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) { + if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER
this.setAirTicks(this.d(this.getAirTicks())); this.setAirTicks(this.l(this.getAirTicks()));
if (this.getAirTicks() == -20) { if (this.getAirTicks() == -20) {
this.setAirTicks(0); this.setAirTicks(0);
-- --

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index b4233df5f..00791faf2 100644 index db7e37aee..cd1639e26 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final boolean defaultActivationState; public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE; public long activatedTick = Integer.MIN_VALUE;
public boolean fromMobSpawner; public boolean fromMobSpawner;
@ -16,7 +16,7 @@ index b4233df5f..00791faf2 100644
protected int numCollisions = 0; // Paper protected int numCollisions = 0; // Paper
public void inactiveTick() { } public void inactiveTick() { }
// Spigot end // Spigot end
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (origin != null) { if (origin != null) {
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
} }
@ -27,7 +27,7 @@ index b4233df5f..00791faf2 100644
// Paper end // Paper end
return nbttagcompound; return nbttagcompound;
} catch (Throwable throwable) { } catch (Throwable throwable) {
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (!originTag.isEmpty()) { if (!originTag.isEmpty()) {
origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
} }
@ -37,19 +37,19 @@ index b4233df5f..00791faf2 100644
} catch (Throwable throwable) { } catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index a5261d70b..1ed0def1e 100644 index 61472a0eb..2b6b062c6 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) { if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) {
((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null); ((EntityInsentient) entity).prepare(world.getDamageScaler(new BlockPosition(entity)), (GroupDataEntity) null, (NBTTagCompound) null);
} }
+ entity.spawnedViaMobSpawner = true; // Paper + entity.spawnedViaMobSpawner = true; // Paper
// Spigot Start // Spigot Start
if ( entity.world.spigotConfig.nerfSpawnerMobs ) if ( entity.world.spigotConfig.nerfSpawnerMobs )
{ {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 3b25b8b73..bf7e6ed3f 100644 index 03a3328b0..6d4dc539c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -61,7 +61,7 @@ index 000000000..5caca6439
+ +
+} +}
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 309ab18df..c583ab7d9 100644 index 088ec198e..bc34cd687 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java --- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
@ -73,7 +73,7 @@ index 309ab18df..c583ab7d9 100644
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.a = minecraftserver; this.a = minecraftserver;
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.a()); throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b());
} }
+ // Paper start - NetworkClient implementation + // Paper start - NetworkClient implementation
@ -84,13 +84,13 @@ index 309ab18df..c583ab7d9 100644
public void a(IChatBaseComponent ichatbasecomponent) {} public void a(IChatBaseComponent ichatbasecomponent) {}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 2eddb68d7..b93a26e8f 100644 index 5b0d83a1d..424464d09 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java --- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
private IChatBaseComponent n; private float t;
private boolean o; private int u;
private boolean p; private boolean v;
+ // Paper start - NetworkClient implementation + // Paper start - NetworkClient implementation
+ public int protocolVersion; + public int protocolVersion;
+ public java.net.InetSocketAddress virtualHost; + public java.net.InetSocketAddress virtualHost;
@ -99,19 +99,19 @@ index 2eddb68d7..b93a26e8f 100644
public NetworkManager(EnumProtocolDirection enumprotocoldirection) { public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
this.h = enumprotocoldirection; this.h = enumprotocoldirection;
diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
index aececa39d..1d4ba3b3d 100644 index 7acdac55e..f1a3be69d 100644
--- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java --- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet<PacketHandshakingI @@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet<PacketHandshakingI
return this.d; return this.d;
} }
+ public int getProtocolVersion() { return b(); } // Paper - OBFHELPER + public int getProtocolVersion() { return c(); } // Paper - OBFHELPER
public int b() { public int c() {
return this.a; return this.a;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1269a02aa..428b208ae 100644 index d7eb4af83..9f9002dd8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -10,7 +10,7 @@ Was done incorrectly and is now causing level desyncs to client.
Always send current level to the client, and instead make setWindowProperty set the level. Always send current level to the client, and instead make setWindowProperty set the level.
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index 175753c5a..16ec67569 100644 index 845ec2250..c252ff6d5 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java --- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -0,0 +0,0 @@ public class ContainerAnvil extends Container { @@ -0,0 +0,0 @@ public class ContainerAnvil extends Container {
@ -26,7 +26,7 @@ index 175753c5a..16ec67569 100644
this.lastLevelCost = this.levelCost; this.lastLevelCost = this.levelCost;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7ee17b254..f83b16bcd 100644 index 3c1f02c18..d7eb4af83 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b85c55168..90f946e57 100644 index 0ba99bcbc..49e7c1589 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.methodProfiler.c("blockEntities"); this.methodProfiler.c("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) { if (!this.tileEntityListUnload.isEmpty()) {

View File

@ -1,21 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
Date: Sun, 9 Apr 2017 23:50:15 -0700
Subject: [PATCH] Fix NFE when attempting to read EMPTY ItemStack
Thanks @gabizou
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 736686bed..d666088f2 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack {
// CraftBukkit - break into own method
public void load(NBTTagCompound nbttagcompound) {
- this.item = Item.b(nbttagcompound.getString("id"));
+ this.item = nbttagcompound.hasKeyOfType("id", 8) ? Item.b(nbttagcompound.getString("id")) : Item.getItemOf(Blocks.AIR); // Paper - fix NumberFormatException caused by attempting to read an EMPTY ItemStack
this.count = nbttagcompound.getByte("Count");
// CraftBukkit start - Route through setData for filtering
// this.damage = Math.max(0, nbttagcompound.getShort("Damage"));
--

View File

@ -9,12 +9,12 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa
and to provide some level of hint without being disruptive. and to provide some level of hint without being disruptive.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c9e8a8737..ae2c51f5d 100644 index ac38028d7..ad0635925 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main { @@ -0,0 +0,0 @@ public class Main {
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -14); deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
- System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Error, this build is outdated ***");
+ // Paper start - This is some stupid bullshit + // Paper start - This is some stupid bullshit

View File

@ -9,15 +9,15 @@ This behavior causes a save to occur even though saving was supposed to be turne
It's triggered when Hell/End worlds are empty of players. It's triggered when Hell/End worlds are empty of players.
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 0b10f1684..4af557321 100644 index cf5c76a78..bfe2d03a5 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap { @@ -0,0 +0,0 @@ public class PlayerChunkMap {
try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper
WorldProvider worldprovider = this.world.worldProvider; WorldProvider worldprovider = this.world.worldProvider;
- if (!worldprovider.e()) { - if (!worldprovider.p()) {
+ if (!worldprovider.e() && !this.world.savingDisabled) { // Paper - respect saving disabled setting + if (!worldprovider.p() && !this.world.savingDisabled) { // Paper - respect saving disabled setting
this.world.getChunkProviderServer().b(); this.world.getChunkProviderServer().b();
} }
} // Paper timing } // Paper timing

View File

@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing
the plugin logger. the plugin logger.
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index adf79de70..1639621d7 100644 index 1b4877868..a98abca8e 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
@ -28,7 +28,7 @@ index adf79de70..1639621d7 100644
<!-- Paper - Add additional Log4J dependencies --> <!-- Paper - Add additional Log4J dependencies -->
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 9ce3e1365..cc1f3ac96 100644 index 9a1ffed07..b39096f04 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -0,0 +0,0 @@ public class SpigotConfig @@ -0,0 +0,0 @@ public class SpigotConfig

View File

@ -7,14 +7,13 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations. to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 49ebad22e..eb6987338 100644 index e305d663a..503dd5827 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {
public Color getDefaultLeatherColor() { public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException {
return DEFAULT_LEATHER_COLOR; return ((CraftMetaItem) meta).updateMaterial(material);
} }
+
+ // Paper start + // Paper start
+ @Override + @Override
+ public ItemStack ensureServerConversions(ItemStack item) { + public ItemStack ensureServerConversions(ItemStack item) {

View File

@ -8,7 +8,7 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar. You must replace the language file embedded in the server jar.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index eb6987338..c2f26577c 100644 index 503dd5827..73785830f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {

View File

@ -1,197 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 11 Nov 2017 17:57:39 -0500
Subject: [PATCH] Improve Structures Checking
Improves performance by keying every chunk thats part of a structure to a hashmap
instead of only the first one.
This allows us to avoid iterating the entire structures value set to see
if a block position is inside of a structure.
This should have pretty decent performance improvement to any standard world
that has been around for a whilewith lots of structures due to ineffeciencies
in how MC stores structures (even unloaded chunks has structured data loaded)
diff --git a/src/main/java/net/minecraft/server/StructureBoundingBox.java b/src/main/java/net/minecraft/server/StructureBoundingBox.java
index db419cd99..d9329bd42 100644
--- a/src/main/java/net/minecraft/server/StructureBoundingBox.java
+++ b/src/main/java/net/minecraft/server/StructureBoundingBox.java
@@ -0,0 +0,0 @@ import com.google.common.base.MoreObjects;
public class StructureBoundingBox {
- public int a;
- public int b;
- public int c;
- public int d;
- public int e;
- public int f;
+ public int a; // Paper - If changes, verify low/high getters
+ public int b; // Paper - If changes, verify low/high getters
+ public int c; // Paper - If changes, verify low/high getters
+ public int d; // Paper - If changes, verify low/high getters
+ public int e; // Paper - If changes, verify low/high getters
+ public int f; // Paper - If changes, verify low/high getters
+ public BaseBlockPosition getLowPosition() { return new BaseBlockPosition(a, b, c); } // Paper
+ public BaseBlockPosition getHighPosition() { return new BaseBlockPosition(d, e, f); } // Paper
public StructureBoundingBox() {}
@@ -0,0 +0,0 @@ public class StructureBoundingBox {
this.f += k;
}
+ public boolean contains(BaseBlockPosition baseblockposition) { return b(baseblockposition); } // Paper - OBFHELPER
public boolean b(BaseBlockPosition baseblockposition) {
return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e;
}
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index e8263baa4..f4dfba8f3 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.util.Iterator;
+import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
private final Timing timing = MinecraftTimings.getStructureTiming(this); // Paper
private PersistentStructure a;
protected Long2ObjectMap<StructureStart> c = new Long2ObjectOpenHashMap(1024);
+ protected Long2ObjectMap<StructureStart> allStructures = new Long2ObjectOpenHashMap(1024); // Paper - Holds ref to structures for every chunk its part of, where as the one above this only holds the vanilla oriented ones.
public StructureGenerator() {}
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
if (this.a(i, j)) {
StructureStart structurestart = this.b(i, j);
+ populateStructure(structurestart); // Paper
this.c.put(ChunkCoordIntPair.a(i, j), structurestart);
if (structurestart.a()) {
this.a(i, j, structurestart);
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
@Nullable
protected StructureStart c(BlockPosition blockposition) {
+ // Paper start - replace method
+ StructureStart structureStart = allStructures.get(ChunkCoordIntPair.asLong(blockposition));
+ if (structureStart != null && structureStart.isSizeable() && structureStart.getBoundingBox().contains(blockposition)) {
+ List<StructurePiece> structurePieces = structureStart.getStructurePieces();
+ for (StructurePiece piece : structurePieces) {
+ if (piece.getBoundingBox().contains(blockposition)) {
+ return structureStart;
+ }
+ }
+ }
+
+ return null;
+ /*
ObjectIterator objectiterator = this.c.values().iterator();
while (objectiterator.hasNext()) {
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
}
return null;
+ */
}
public boolean a(World world, BlockPosition blockposition) {
if (this.g == null) return false; // Paper
this.a(world);
+ // Paper start - Replace method
+ StructureStart structureStart = this.allStructures.get(ChunkCoordIntPair.asLong(blockposition));
+ return structureStart != null && structureStart.isSizeable() && structureStart.getBoundingBox().contains(blockposition);
+ /* // comment out rest
ObjectIterator objectiterator = this.c.values().iterator();
StructureStart structurestart;
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
structurestart = (StructureStart) objectiterator.next();
} while (!structurestart.a() || !structurestart.b().b((BaseBlockPosition) blockposition));
- return true;
+ return true;*/ // Paper end
}
@Nullable
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
StructureStart structurestart = WorldGenFactory.a(nbttagcompound1, world);
if (structurestart != null) {
+ populateStructure(structurestart); // Paper
this.c.put(ChunkCoordIntPair.a(i, j), structurestart);
}
}
@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase {
}
+ // Paper start
+ private void populateStructure(StructureStart structurestart) {
+ for (StructurePiece piece : structurestart.getStructurePieces()) {
+ populateStructure(structurestart, piece.getBoundingBox());
+ }
+ populateStructure(structurestart, structurestart.getBoundingBox());
+ }
+ private void populateStructure(StructureStart structurestart, StructureBoundingBox bb) {
+ if (bb == null) {
+ return;
+ }
+ final BaseBlockPosition low = bb.getLowPosition();
+ final BaseBlockPosition high = bb.getHighPosition();
+ for (int x = low.getX() >> 4, maxX = high.getX() >> 4; x <= maxX; x++) {
+ for (int z = low.getZ() >> 4, maxZ = high.getZ() >> 4; z <= maxZ; z++) {
+ allStructures.put(ChunkCoordIntPair.asLong(x, z), structurestart);
+ }
+ }
+ }
+ // Paper end
+
private void a(int i, int j, StructureStart structurestart) {
this.a.a(structurestart.a(i, j), i, j);
this.a.c();
diff --git a/src/main/java/net/minecraft/server/StructurePiece.java b/src/main/java/net/minecraft/server/StructurePiece.java
index 93903bc67..fcc13f811 100644
--- a/src/main/java/net/minecraft/server/StructurePiece.java
+++ b/src/main/java/net/minecraft/server/StructurePiece.java
@@ -0,0 +0,0 @@ public abstract class StructurePiece {
public abstract boolean a(World world, Random random, StructureBoundingBox structureboundingbox);
+ public StructureBoundingBox getBoundingBox() { return d(); } // Paper - OBFHELPER
public StructureBoundingBox d() {
return this.l;
}
diff --git a/src/main/java/net/minecraft/server/StructureStart.java b/src/main/java/net/minecraft/server/StructureStart.java
index b6abc74e0..f9bb953d0 100644
--- a/src/main/java/net/minecraft/server/StructureStart.java
+++ b/src/main/java/net/minecraft/server/StructureStart.java
@@ -0,0 +0,0 @@ public abstract class StructureStart {
this.d = j;
}
+ public StructureBoundingBox getBoundingBox() { return b(); } // Paper - OBFHELPER
public StructureBoundingBox b() {
return this.b;
}
+ public List<StructurePiece> getStructurePieces() { return c(); } // Paper - OBFHELPER
public List<StructurePiece> c() {
return this.a;
}
@@ -0,0 +0,0 @@ public abstract class StructureStart {
}
- public boolean a() {
+ public boolean isSizeable() { return a(); } public boolean a() { // Paper - OBFHELPER
return true;
}
--

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Include Log4J2 SLF4J implementation
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 1639621d7..bf04f6d12 100644 index a98abca8e..9354f6edf 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@

View File

@ -5,34 +5,33 @@ Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 5ea9f3097..89e878365 100644 index d29364b01..9dc86e90d 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java --- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
while (iterator.hasNext()) {
EntityItem entityitem = (EntityItem) iterator.next(); EntityItem entityitem = (EntityItem) iterator.next();
+ // Paper Start if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.q()) {
+ if (!entityitem.canMobPickup) { + // Paper Start
+ continue; + if (!entityitem.canMobPickup) {
+ } + continue;
+ // Paper End + }
+ + // Paper End
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.t()) {
this.a(entityitem); this.a(entityitem);
} }
}
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 6593fc633..99dbb1393 100644 index 4af09f5cd..f2a4476c5 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java --- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity implements HopperPusher { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
private static final DataWatcherObject<ItemStack> c = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f); private static final DataWatcherObject<ItemStack> b = DataWatcher.a(EntityItem.class, DataWatcherRegistry.g);
private int age; private int age;
public int pickupDelay; public int pickupDelay;
+ public boolean canMobPickup = true; // Paper + public boolean canMobPickup = true; // Paper
private int f; private int e;
private String g; private UUID f;
private String h; private UUID g;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index a17a537d6..1df17f09b 100644 index a17a537d6..1df17f09b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] LivingEntity#setKiller
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index d4d51688c..a7b076377 100644 index 7e3a9eeb2..487bb9ece 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Fri, 11 Aug 2017 03:29:26 +0200
Subject: [PATCH] MC-94186 Fix dragon egg falling in lazy chunks
Fixes falling dragon eggs in lazy chunks fall to the block below the last empty block and replacing that block with them.
See also https://bugs.mojang.com/browse/MC-94186
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
index ce186f825..291342c90 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -0,0 +0,0 @@ public class BlockDragonEgg extends Block {
}
if (blockposition1.getY() > 0) {
- world.setTypeAndData(blockposition1, this.getBlockData(), 2);
+ world.setTypeAndData(blockposition1.up(), this.getBlockData(), 2); // Paper
}
}
--

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 66ff1adf6..de859ffd1 100644 index ef35eb7ec..70790386e 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
@ -16,5 +16,5 @@ index 66ff1adf6..de859ffd1 100644
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive + int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
// Spigot end // Spigot end
Iterator iterator = this.unloadQueue.iterator(); LongIterator longiterator = this.unloadQueue.iterator();
-- --

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 5a76821ea..858bbef5b 100644 index 6ea276aa0..720e7bbf9 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java --- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal { @@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4d30cdbc8..535a8d3ed 100644 index 6344537ec..33743f8fd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -0,0 +0,0 @@ public class PaperWorldConfig {
@ -20,10 +20,10 @@ index 4d30cdbc8..535a8d3ed 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 29dffc3ac..2c69ae748 100644 index b9472dddb..d28d4a9a7 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
EntityExperienceOrb xp = (EntityExperienceOrb) entity; EntityExperienceOrb xp = (EntityExperienceOrb) entity;
double radius = spigotConfig.expMerge; double radius = spigotConfig.expMerge;
if (radius > 0) { if (radius > 0) {

View File

@ -5,18 +5,18 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index ae4910b4b..0b7fc327f 100644 index 62d1c3d11..d232bab74 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java --- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit end // CraftBukkit end
+import org.bukkit.event.player.PlayerAttemptPickupItemEvent; // Paper +import org.bukkit.event.player.PlayerAttemptPickupItemEvent; // Paper
import com.destroystokyo.paper.HopperPusher; // Paper
// Paper start - implement HopperPusher public class EntityItem extends Entity {
@@ -0,0 +0,0 @@ public class EntityItem extends Entity implements HopperPusher {
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
int remaining = i - canHold; int remaining = i - canHold;
boolean flyAtPlayer = false; // Paper boolean flyAtPlayer = false; // Paper

View File

@ -5,10 +5,10 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 99dbb1393..ae4910b4b 100644 index f2a4476c5..62d1c3d11 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java --- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity implements HopperPusher { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
// CraftBukkit start - fire PlayerPickupItemEvent // CraftBukkit start - fire PlayerPickupItemEvent
int canHold = entityhuman.inventory.canHold(itemstack); int canHold = entityhuman.inventory.canHold(itemstack);
int remaining = i - canHold; int remaining = i - canHold;
@ -16,7 +16,7 @@ index 99dbb1393..ae4910b4b 100644
if (this.pickupDelay <= 0 && canHold > 0) { if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.setCount(canHold); itemstack.setCount(canHold);
@@ -0,0 +0,0 @@ public class EntityItem extends Entity implements HopperPusher { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
playerEvent.setCancelled(!entityhuman.canPickUpLoot); playerEvent.setCancelled(!entityhuman.canPickUpLoot);
this.world.getServer().getPluginManager().callEvent(playerEvent); this.world.getServer().getPluginManager().callEvent(playerEvent);
@ -30,11 +30,10 @@ index 99dbb1393..ae4910b4b 100644
return; return;
} }
@@ -0,0 +0,0 @@ public class EntityItem extends Entity implements HopperPusher { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
// CraftBukkit end
if (this.pickupDelay == 0 && (this.h == null || 6000 - this.age <= 200 || this.h.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) { if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
- entityhuman.receive(this, i); entityhuman.receive(this, i);
+ // Paper Start + // Paper Start
+ if (flyAtPlayer) { + if (flyAtPlayer) {
+ entityhuman.receive(this, i); + entityhuman.receive(this, i);

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Prevent logins from being processed when the player has
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 75df92836..eaac25dc3 100644 index d0e719f44..7dbc6f437 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java --- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable {

View File

@ -5,23 +5,23 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 3e5122486..b478f385a 100644 index 0f39fa49f..c1de6564a 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
// return s; // return chatmessage;
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); // Spigot if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot
- } else if (!this.isWhitelisted(gameprofile)) { - } else if (!this.isWhitelisted(gameprofile)) {
+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper + } else if (!this.isWhitelisted(gameprofile, event)) { // Paper
// return "You are not white-listed on this server!"; chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]);
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
+ //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted + //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
IpBanEntry ipbanentry = this.l.get(socketaddress); IpBanEntry ipbanentry = this.l.get(socketaddress);
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
this.server.getCommandDispatcher().a(entityplayer);
} }
+ // Paper start + // Paper start
@ -46,5 +46,5 @@ index 3e5122486..b478f385a 100644
+ // Paper end + // Paper end
public boolean isOp(GameProfile gameprofile) { public boolean isOp(GameProfile gameprofile) {
return this.operators.d(gameprofile) || this.server.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit return this.operators.d(gameprofile) || this.server.J() && this.server.worlds.get(0).getWorldData().u() && this.server.I().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit
-- --

View File

@ -30,27 +30,27 @@ will have plugins and worlds saving to the disk has a high potential to result
in corruption/dataloss. in corruption/dataloss.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 13c6b5ccd..908a5d273 100644 index f81ff5628..f679c6bc2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
public WorldServer[] worldServer; public WorldServer[] worldServer;
private PlayerList v; private PlayerList s;
private boolean isRunning = true; private boolean isRunning = true;
+ private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart + private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
private boolean isStopped; private boolean isStopped;
private int ticks; private int ticks;
protected final Proxy e; protected final Proxy d;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
if (this.v != null) { if (this.s != null) {
MinecraftServer.LOGGER.info("Saving players"); MinecraftServer.LOGGER.info("Saving players");
this.v.savePlayers(); this.s.savePlayers();
- this.v.u(); - this.s.u();
+ this.v.u(isRestarting); + this.s.u(isRestarting);;
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
} }
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
return this.isRunning; return this.isRunning;
} }
@ -69,20 +69,20 @@ index 13c6b5ccd..908a5d273 100644
// Paper start - Further improve server tick loop // Paper start - Further improve server tick loop
private static final int TPS = 20; private static final int TPS = 20;
private static final long SEC_IN_NANO = 1000000000; private static final long SEC_IN_NANO = 1000000000;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
return this.ab; return this.aa;
} }
+ public final Thread getServerThread() { return this.aI(); } // Paper - OBFHELPER + public final Thread getServerThread() { return this.aA(); } // Paper - OBFHELPER
public Thread aI() { public Thread aA() {
return this.serverThread; return this.serverThread;
} }
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index c49711cad..85357a003 100644 index e41850742..5e833c378 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(world.getWorldData().getGameType()); entityplayer.playerInteractManager.b(generatoraccess.getWorldData().getGameType());
} }
+ // Paper start - Extract method to allow for restarting flag + // Paper start - Extract method to allow for restarting flag

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 1ed0def1e..87fe4775f 100644 index 2b6b062c6..c76dbe74a 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {

View File

@ -6,11 +6,11 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 579996d1e..347237055 100644 index 8cf082d2e..34e79e7ca 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
this.j = 0; this.k = 0;
} }
+ // Paper start - send SoundEffect to everyone who can see fromEntity + // Paper start - send SoundEffect to everyone who can see fromEntity
@ -23,14 +23,14 @@ index 579996d1e..347237055 100644
+ // Paper end + // Paper end
+ +
public void attack(Entity entity) { public void attack(Entity entity) {
if (entity.bd()) { if (entity.bk()) {
if (!entity.t(this)) { if (!entity.t(this)) {
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
int i = b0 + EnchantmentManager.b((EntityLiving) this); int i = b0 + EnchantmentManager.b((EntityLiving) this);
if (this.isSprinting() && flag) { if (this.isSprinting() && flag) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fw, this.bK(), 1.0F, 1.0F); - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fw, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility + sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
++i; ++i;
flag1 = true; flag1 = true;
} }
@ -38,27 +38,27 @@ index 579996d1e..347237055 100644
} }
} }
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fz, this.bK(), 1.0F, 1.0F); - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fz, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility + sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
this.cX(); this.dk();
} }
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
} }
if (flag2) { if (flag2) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fv, this.bK(), 1.0F, 1.0F); - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fv, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility + sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
this.a(entity); this.a(entity);
} }
if (!flag2 && !flag3) { if (!flag2 && !flag3) {
if (flag) { if (flag) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fy, this.bK(), 1.0F, 1.0F); - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fy, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility + sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
} else { } else {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fA, this.bK(), 1.0F, 1.0F); - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fA, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility + sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
} }
} }
@ -66,16 +66,16 @@ index 579996d1e..347237055 100644
this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value
} else { } else {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fx, this.bK(), 1.0F, 1.0F); - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fx, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility + sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
if (flag4) { if (flag4) {
entity.extinguish(); entity.extinguish();
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index ea67b61b2..29dffc3ac 100644 index 62fd2e503..b9472dddb 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.a(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1); this.a(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1);
} }
@ -86,6 +86,6 @@ index ea67b61b2..29dffc3ac 100644
+ // Paper end + // Paper end
+ +
public void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) { public void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) {
for (int i = 0; i < this.u.size(); ++i) { for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.u.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1); ((IWorldAccess) this.v.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1);
-- --

View File

@ -12,46 +12,25 @@ This then triggers async chunk loads!
What in the hell were you thinking? What in the hell were you thinking?
diff --git a/src/main/java/net/minecraft/server/BlockBeacon.java b/src/main/java/net/minecraft/server/BlockBeacon.java diff --git a/src/main/java/net/minecraft/server/BlockBeacon.java b/src/main/java/net/minecraft/server/BlockBeacon.java
index f07ac0186..21075974d 100644 index 1181d45fa..d081166d8 100644
--- a/src/main/java/net/minecraft/server/BlockBeacon.java --- a/src/main/java/net/minecraft/server/BlockBeacon.java
+++ b/src/main/java/net/minecraft/server/BlockBeacon.java +++ b/src/main/java/net/minecraft/server/BlockBeacon.java
@@ -0,0 +0,0 @@ public class BlockBeacon extends BlockTileEntity { @@ -0,0 +0,0 @@ public class BlockBeacon extends BlockTileEntity {
} }
public static void c(final World world, final BlockPosition blockposition) { public static void a(World world, BlockPosition blockposition) {
- HttpUtilities.a.submit(new Runnable() { - HttpUtilities.a.submit(() -> {
- public void run() { + //HttpUtilities.a.submit(() -> { // Paper
+ /*HttpUtilities.a.submit(new Runnable() { Chunk chunk = world.getChunkAtWorldCoords(blockposition);
+ public void run() {*/ // Paper
Chunk chunk = world.getChunkAtWorldCoords(blockposition);
for (int i = blockposition.getY() - 1; i >= 0; --i) { for (int i = blockposition.getY() - 1; i >= 0; --i) {
@@ -0,0 +0,0 @@ public class BlockBeacon extends BlockTileEntity { @@ -0,0 +0,0 @@ public class BlockBeacon extends BlockTileEntity {
IBlockData iblockdata = world.getType(blockposition1); });
if (iblockdata.getBlock() == Blocks.BEACON) {
- ((WorldServer) world).postToMainThread(new Runnable() {
- public void run() {
+ /*((WorldServer) world).postToMainThread(new Runnable() {
+ public void run() {*/ // Paper
TileEntity tileentity = world.getTileEntity(blockposition);
if (tileentity instanceof TileEntityBeacon) {
@@ -0,0 +0,0 @@ public class BlockBeacon extends BlockTileEntity {
world.playBlockAction(blockposition, Blocks.BEACON, 1, 0);
}
- }
- });
+ /*}
+ });*/ // Paper
}
} }
}
- } -
- }); - });
+ /*} + // }); // Paper
+ });*/ // Paper
} }
} }
-- --

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Shoulder Entities Release API
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 9cda8a177..deb0f4a9c 100644 index 0da76b268..85e617979 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
@ -62,7 +62,7 @@ index 9cda8a177..deb0f4a9c 100644
public abstract boolean isSpectator(); public abstract boolean isSpectator();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index a54548f02..a0128426f 100644 index 073c8acf2..9e2fc4947 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {

View File

@ -12,7 +12,7 @@ results in a separate line, even though it should not result in
a line break. Log4j's implementation handles it correctly. a line break. Log4j's implementation handles it correctly.
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 26775156b..adf79de70 100644 index 4dd5fed25..1b4877868 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
@ -30,7 +30,7 @@ index 26775156b..adf79de70 100644
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index b3f1aa999..854455711 100644 index 069eb7d68..7ff2fa535 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java --- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer

View File

@ -20,22 +20,28 @@ Other changes:
configuration configuration
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 9d273c6d9..26775156b 100644 index 17bc80776..4dd5fed25 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<version>5.0.4</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
- <dependency> <dependency>
- <groupId>jline</groupId> - <groupId>jline</groupId>
- <artifactId>jline</artifactId> - <artifactId>jline</artifactId>
- <version>2.12.1</version> - <version>2.12.1</version>
- <scope>compile</scope> - <scope>compile</scope>
- </dependency> - </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- <version>6.2</version>
+ <groupId>net.sf.jopt-simple</groupId>
+ <artifactId>jopt-simple</artifactId>
+ <version>5.0.4</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<version>3.0.3</version> <version>3.0.3</version>
<scope>compile</scope> <scope>compile</scope>
@ -179,7 +185,7 @@ index 000000000..626bfeec8
+ +
+} +}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 8f2afcc32..b3f1aa999 100644 index a3d58b5ce..069eb7d68 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java --- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -197,7 +203,7 @@ index 8f2afcc32..b3f1aa999 100644
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
try { try {
// CraftBukkit start - JLine disabling compatibility // CraftBukkit start - JLine disabling compatibility
while (!isStopped() && isRunning()) { while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning()) {
+ // Paper start - code is not used for jline + // Paper start - code is not used for jline
+ /* + /*
if (org.bukkit.craftbukkit.Main.useJline) { if (org.bukkit.craftbukkit.Main.useJline) {
@ -210,7 +216,7 @@ index 8f2afcc32..b3f1aa999 100644
+ // Paper end + // Paper end
+ +
if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces
issueCommand(s, DedicatedServer.this); DedicatedServer.this.issueCommand(s, DedicatedServer.this.getServerCommandListener());
} }
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
} }
@ -232,7 +238,7 @@ index 8f2afcc32..b3f1aa999 100644
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 908a5d273..e8bddc171 100644 index f679c6bc2..39a8b1d69 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.apache.commons.lang3.Validate; @@ -0,0 +0,0 @@ import org.apache.commons.lang3.Validate;
@ -243,7 +249,7 @@ index 908a5d273..e8bddc171 100644
import joptsimple.OptionSet; import joptsimple.OptionSet;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
public OptionSet options; public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
@ -252,8 +258,8 @@ index 908a5d273..e8bddc171 100644
public static int currentTick = 0; // Paper - Further improve tick loop public static int currentTick = 0; // Paper - Further improve tick loop
public final Thread primaryThread; public final Thread primaryThread;
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.dataConverterManager = dataconvertermanager; this.ac.a((IResourcePackListener) this.al);
// CraftBukkit start // CraftBukkit start
this.options = options; this.options = options;
+ // Paper start - Handled by TerminalConsoleAppender + // Paper start - Handled by TerminalConsoleAppender
@ -262,7 +268,7 @@ index 908a5d273..e8bddc171 100644
if (System.console() == null && System.getProperty("jline.terminal") == null) { if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal"); System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
Main.useJline = false; Main.useJline = false;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
LOGGER.warn((String) null, ex); LOGGER.warn((String) null, ex);
} }
} }
@ -271,7 +277,7 @@ index 908a5d273..e8bddc171 100644
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
} finally { } finally {
// CraftBukkit start - Restore terminal to original settings // CraftBukkit start - Restore terminal to original settings
try { try {
@ -280,18 +286,17 @@ index 908a5d273..e8bddc171 100644
} catch (Exception ignored) { } catch (Exception ignored) {
} }
// CraftBukkit end // CraftBukkit end
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
} }
public void sendMessage(IChatBaseComponent ichatbasecomponent) { public void sendMessage(IChatBaseComponent ichatbasecomponent) {
- MinecraftServer.LOGGER.info(ichatbasecomponent.toPlainText()); - MinecraftServer.LOGGER.info(ichatbasecomponent.getString());
+ // Paper - Log message with colors + MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent, net.minecraft.server.EnumChatFormat.WHITE));// Paper - Log message with colors
+ MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent, net.minecraft.server.EnumChatFormat.WHITE));
} }
public boolean a(int i, String s) { public KeyPair G() {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 85357a003..3e5122486 100644 index 5e833c378..0f39fa49f 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
@ -305,17 +310,19 @@ index 85357a003..3e5122486 100644
this.k = new GameProfileBanList(PlayerList.a); this.k = new GameProfileBanList(PlayerList.a);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 27c6caddc..539f492e0 100644 index 6c611c0df..3b10c5e61 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ import io.netty.buffer.ByteBuf; @@ -0,0 +0,0 @@ import java.nio.ByteBuffer;
import io.netty.buffer.ByteBufOutputStream; import java.nio.charset.StandardCharsets;
import io.netty.buffer.Unpooled; import java.util.Base64;
import io.netty.handler.codec.base64.Base64; import java.util.HashMap;
-import jline.console.ConsoleReader; -import jline.console.ConsoleReader;
import org.apache.commons.lang.StringUtils; import org.bukkit.Keyed;
+import org.apache.commons.lang.StringUtils;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
return logger; return logger;
} }
@ -331,7 +338,7 @@ index 27c6caddc..539f492e0 100644
@Override @Override
public PluginCommand getPluginCommand(String name) { public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index d565a720f..c9e8a8737 100644 index aad208f47..ac38028d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ import java.util.logging.Logger; @@ -0,0 +0,0 @@ import java.util.logging.Logger;
@ -370,7 +377,7 @@ index d565a720f..c9e8a8737 100644
+ System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper + System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
} }
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
deleted file mode 100644 deleted file mode 100644
index 26a2fb894..000000000 index 26a2fb894..000000000

View File

@ -15,25 +15,23 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients. random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 08211a54c..72474a88e 100644 index 2255b8ccb..20bac8bc3 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
public void a(PacketPlayInKeepAlive packetplayinkeepalive) { public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
- PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit - PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit
+ //PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit // Paper - This shouldn't be on the main thread + PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.g && packetplayinkeepalive.a() == this.h) { if (this.g && packetplayinkeepalive.b() == this.h) {
int i = (int) (this.d() - this.f); int i = (int) (SystemUtils.b() - this.f);
this.player.ping = (this.player.ping * 3 + i) / 4; this.player.ping = (this.player.ping * 3 + i) / 4;
this.g = false; this.g = false;
} else if (!this.player.getName().equals(this.minecraftServer.Q())) { } else if (!this.player.getDisplayName().getString().equals(this.minecraftServer.I())) {
- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); - this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
+ // Paper start - This needs to be handled on the main thread for plugins + // Paper start - This needs to be handled on the main thread for plugins
+ PlayerConnection.LOGGER.warn("{} sent an invalid keepalive! pending keepalive: {} got id: {} expected id: {}",
+ this.player.getName(), this.isPendingPing(), packetplayinkeepalive.a(), this.getKeepAliveID());
+ minecraftServer.postToMainThread(() -> { + minecraftServer.postToMainThread(() -> {
+ this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
+ }); + });

View File

@ -6,7 +6,7 @@ Subject: [PATCH] provide a configurable option to disable creeper lingering
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 31aad03c2..646620d0c 100644 index 99fe720e8..c80d84b9b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -0,0 +0,0 @@ public class PaperWorldConfig {
@ -21,11 +21,11 @@ index 31aad03c2..646620d0c 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index c872607fc..8098d4d9f 100644 index f286b6286..f37169d73 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java --- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster {
private void ds() { private void dF() {
Collection collection = this.getEffects(); Collection collection = this.getEffects();
- if (!collection.isEmpty()) { - if (!collection.isEmpty()) {

View File

@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer. at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 869a2b402..284db9b9e 100644 index 20bac8bc3..4f9b4afdf 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -30,9 +30,9 @@ index 869a2b402..284db9b9e 100644
private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER
// CraftBukkit start - multithreaded fields // CraftBukkit start - multithreaded fields
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
private int E;
private int receivedMovePackets; private int receivedMovePackets;
private int processedMovePackets; private int processedMovePackets;
private AutoRecipe H = new AutoRecipe();
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit + private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
@ -41,25 +41,24 @@ index 869a2b402..284db9b9e 100644
} }
this.minecraftServer.methodProfiler.a("keepAlive"); this.minecraftServer.methodProfiler.a("keepAlive");
- long i = this.d(); - long i = SystemUtils.b();
- -
- if (i - this.f >= 25000L) { // CraftBukkit - if (i - this.f >= 25000L) { // CraftBukkit
- if (this.g) { - if (this.g) {
- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + // 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
+ long currentTime = SystemUtils.b();
+ long elapsedTime = currentTime - this.getLastPing();
+
+ if (this.isPendingPing()) {
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
+ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
- } else { - } else {
- this.g = true; - this.g = true;
- this.f = i; - this.f = i;
- this.h = i; - this.h = i;
- this.sendPacket(new PacketPlayOutKeepAlive(this.h)); - this.sendPacket(new PacketPlayOutKeepAlive(this.h));
+ // 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
+ long currentTime = this.getCurrentMillis();
+ long elapsedTime = currentTime - this.getLastPing();
+ if (this.isPendingPing()) {
+ // We're pending a ping from the client
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
+ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
+ this.disconnect(new ChatMessage("disconnect.timeout"));
+ } + }
+ } else { + } else {
+ if (elapsedTime >= 15000L) { // 15 seconds + if (elapsedTime >= 15000L) { // 15 seconds
@ -67,10 +66,11 @@ index 869a2b402..284db9b9e 100644
+ this.setLastPing(currentTime); + this.setLastPing(currentTime);
+ this.setKeepAliveID(currentTime); + this.setKeepAliveID(currentTime);
+ this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID())); + this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID()));
+
} }
} }
+ // Paper end + // Paper end
this.minecraftServer.methodProfiler.b(); this.minecraftServer.methodProfiler.e();
// CraftBukkit start // CraftBukkit start
-- --

View File

@ -18,16 +18,15 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled. information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2c69ae748..39b90fb4c 100644 index d28d4a9a7..069ba83db 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
// CraftBukkit start - capture blockstates // CraftBukkit start - capture blockstates
BlockState blockstate = null; CraftBlockState blockstate = null;
if (this.captureBlockStates) { if (this.captureBlockStates) {
- blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i); - blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition, i);
+ //blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i); // Paper + blockstate = (CraftBlockState) world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot
+ blockstate = world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot
this.capturedBlockStates.add(blockstate); this.capturedBlockStates.add(blockstate);
} }
// CraftBukkit end // CraftBukkit end