NOT FINISHED! even more 1.13-pre patches!

This commit is contained in:
Shane Freeder 2018-07-16 21:08:09 +01:00
parent 63214cb795
commit 8bf65f2872
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
43 changed files with 513 additions and 518 deletions

View File

@ -1,11 +1,11 @@
From 7bff1557c12e7c7c67a4901f488a7ff95605603e Mon Sep 17 00:00:00 2001
From ab5cb9f6f247e8ddd7219a298e41a4f5fffab5e5 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 15:08:03 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3b97981bc..36ea4ad47 100644
index 3b97981bc..4a4cc6c59 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -777,6 +777,10 @@ public class Chunk implements IChunkAccess {
@ -13,7 +13,7 @@ index 3b97981bc..36ea4ad47 100644
this.tileEntities.put(blockposition, tileentity);
// CraftBukkit start
+ // Paper start - Remove invalid mob spawner tile entities
+ } else if (tileentity instanceof TileEntityMobSpawner && org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) != org.bukkit.Material.MOB_SPAWNER) {
+ } else if (tileentity instanceof TileEntityMobSpawner && !(getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getBlock() instanceof BlockMobSpawner)) {
+ this.tileEntities.remove(blockposition);
+ // Paper end
} else {

View File

@ -1,4 +1,4 @@
From d8dc035a4c4013dbfc42842f5233022488a2649c Mon Sep 17 00:00:00 2001
From 165e6010c2951073c778f6d62469189754781c94 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 6 Apr 2016 01:04:23 -0500
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
@ -19,19 +19,19 @@ index 6ac58e5ec..ff9929a05 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c37c46e71..fecf29710 100644
index c37c46e71..88092d823 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2251,6 +2251,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.getFlag(5);
}
+ @Nullable public ScoreboardTeamBase getTeam() { return this.aY(); } // Paper - OBFHELPER
+ @Nullable public ScoreboardTeamBase getTeam() { return this.be(); } // Paper - OBFHELPER
@Nullable
public ScoreboardTeamBase be() {
if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 553011d88..d61ce6461 100644
index 553011d88..65fa09a01 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1622,7 +1622,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -42,7 +42,7 @@ index 553011d88..d61ce6461 100644
+ // Paper Start - (Meh) Support for vanilla world scoreboard name coloring
+ String displayName = event.getPlayer().getDisplayName();
+ if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) {
+ displayName = ScoreboardTeam.getPlayerDisplayName(this.player.getTeam(), player.getDisplayName());
+ displayName = CraftChatMessage.fromComponent(ScoreboardTeam.a(this.player.getTeam(),((CraftPlayer) player).getHandle().getDisplayName()));
+ }
+
+ s = String.format(event.getFormat(), displayName, event.getMessage());

View File

@ -1,11 +1,11 @@
From 7c0d5e351e70cae45275be880bb19b15859894fe Mon Sep 17 00:00:00 2001
From 3fc405ea7cc11069a684deb236861ad238e41efd Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Tue, 19 Apr 2016 14:09:31 -0500
Subject: [PATCH] Implement PlayerLocaleChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 5ca0dec1f..8b5cfc78a 100644
index 55eaa89f6..8b5cfc78a 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -37,7 +37,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -21,7 +21,7 @@ index 5ca0dec1f..8b5cfc78a 100644
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event);
}
- if (!this.locale.equals(packetplayinsettings.a())) {
- if (!this.locale.equals(packetplayinsettings.b())) {
+ if (this.locale == null || !this.locale.equals(packetplayinsettings.b())) { // Paper - fix bug and check for null
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.b());
this.server.server.getPluginManager().callEvent(event);

View File

@ -1,11 +1,11 @@
From e27e2dd897b4f710aad5f7ac293ca48ffad02fcb Mon Sep 17 00:00:00 2001
From 47d3cf8ea0a9e7d17cf085f1489ecb34c1331407 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 18:20:05 -0500
Subject: [PATCH] Vehicle Event Cancellation Changes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index fecf29710..115504bf6 100644
index fecf29710..85e5a0a4c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -80,7 +80,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -13,7 +13,7 @@ index fecf29710..115504bf6 100644
public final List<Entity> passengers;
protected int k;
- private Entity ax;
+ private Entity ax;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER
+ private Entity ax;public void setVehicle(Entity entity) { this.ax = entity; } // Paper - OBFHELPER
public boolean attachedToPlayer;
public World world;
public double lastX;
@ -41,5 +41,5 @@ index fecf29710..115504bf6 100644
entity.k = 60;
}
--
2.17.1
2.18.0

View File

@ -1,4 +1,4 @@
From 3f8a86086738570a1913027002282e9644e5a40c Mon Sep 17 00:00:00 2001
From a9063e4c96a63299f95371c012667bef2f741867 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 27 May 2016 21:41:26 -0400
Subject: [PATCH] Ensure Chunks never ever load async
@ -27,18 +27,21 @@ index 7b7a3d01b..9aaca21a7 100644
public static void queueChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable) {
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index 52a8c48fa..a4fcdbe04 100644
index 52a8c48fa..2bbd5a7e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -35,7 +35,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
@@ -35,9 +35,9 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
// sync stuff
public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException {
- if (chunk == null) {
+ if (chunk == null || queuedChunk.provider.chunks.containsKey(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z))) { // Paper - also call original if it was already loaded
// If the chunk loading failed just do it synchronously (may generate)
// queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
- // queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
+ queuedChunk.provider.getChunkAt(queuedChunk.x, queuedChunk.z); // Paper - actually call original if it was already loaded
return;
}
try (Timing ignored = queuedChunk.provider.world.timings.chunkIOStage2.startTimingIfSync()) { // Paper
--
2.17.1
2.18.0

View File

@ -1,4 +1,4 @@
From f4451963bcdefb63b5331539e134a7d553c06fe0 Mon Sep 17 00:00:00 2001
From 9ea3a3e7a7eb8e3e4d3c6289684125f195081e0e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 18 Jun 2016 23:22:12 -0400
Subject: [PATCH] Delay Chunk Unloads based on Player Movement
@ -17,12 +17,12 @@ This allows servers with smaller worlds who do less long distance exploring to s
wasting cpu cycles on saving/unloading/reloading chunks repeatedly.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ce43e7bb7..e35e72e8b 100644
index 321da3be3..0e6c18b32 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -344,4 +344,18 @@ public class PaperWorldConfig {
private void isHopperPushBased() {
isHopperPushBased = getBoolean("hopper.push-based", false);
@@ -284,4 +284,18 @@ public class PaperWorldConfig {
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
}
+
+ public long delayChunkUnloadsBy;
@ -40,22 +40,22 @@ index ce43e7bb7..e35e72e8b 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3904a1b8f..bcf68af4f 100644
index 718ebfea0..6c6924937 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -30,6 +30,7 @@ public class Chunk {
@@ -39,6 +39,7 @@ public class Chunk implements IChunkAccess {
private boolean j; public boolean isLoaded() { return j; } // Paper - OBFHELPER
public final World world;
public final int[] heightMap;
public final Map<HeightMap.Type, HeightMap> heightMap;
+ public Long scheduledForUnload; // Paper - delay chunk unloads
public final int locX;
public final int locZ;
private boolean m;
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 5cc192bbd..47159bff3 100644
index 7825dc91b..2e72a294d 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -315,6 +315,19 @@ public class ChunkProviderServer implements IChunkProvider {
@@ -318,6 +318,19 @@ public class ChunkProviderServer implements IChunkProvider {
activityAccountant.endActivity(); // Spigot
}
@ -73,13 +73,13 @@ index 5cc192bbd..47159bff3 100644
+ }
+ // Paper end
this.f.a();
this.chunkLoader.b();
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 3d30e1831..48a008e0a 100644
index ffff87dc0..344b95233 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -32,8 +32,16 @@ public class PlayerChunk {
@@ -33,14 +33,23 @@ public class PlayerChunk {
public void run() {
loadInProgress = false;
PlayerChunk.this.chunk = PlayerChunk.this.playerChunkMap.getWorld().getChunkProviderServer().getOrLoadChunkAt(location.x, location.z);
@ -96,27 +96,26 @@ index 3d30e1831..48a008e0a 100644
// CraftBukkit end
public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) {
@@ -42,6 +50,7 @@ public class PlayerChunk {
// CraftBukkit start
loadInProgress = true;
this.chunk = playerchunkmap.getWorld().getChunkProviderServer().getChunkAt(i, j, loadedRunnable, false);
this.playerChunkMap = playerchunkmap;
this.location = new ChunkCoordIntPair(i, j);
this.chunk = playerchunkmap.getWorld().getChunkProviderServer().getOrLoadChunkAt(i, j);
+ markChunkUsed(); // Paper - delay chunk unloads
// CraftBukkit end
}
@@ -110,6 +119,7 @@ public class PlayerChunk {
if (!loadInProgress) {
loadInProgress = true;
this.chunk = playerChunkMap.getWorld().getChunkProviderServer().getChunkAt(this.location.x, this.location.z, loadedRunnable, flag);
public ChunkCoordIntPair a() {
@@ -85,6 +94,7 @@ public class PlayerChunk {
this.chunk = this.playerChunkMap.getWorld().getChunkProviderServer().getChunkAt(this.location.x, this.location.z);
} else {
this.chunk = this.playerChunkMap.getWorld().getChunkProviderServer().getOrLoadChunkAt(this.location.x, this.location.z);
+ markChunkUsed(); // Paper - delay chunk unloads
}
// CraftBukkit end
return this.chunk != null;
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index ad1d90b56..0b10f1684 100644
index 4d888d6d4..cf5c76a78 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -487,7 +487,13 @@ public class PlayerChunkMap {
@@ -461,7 +461,13 @@ public class PlayerChunkMap {
Chunk chunk = playerchunk.f();
if (chunk != null) {
@ -132,29 +131,29 @@ index ad1d90b56..0b10f1684 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index eca4903ed..36a78daff 100644
index 4588df4b1..c34f42efc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1594,7 +1594,13 @@ public abstract class World implements IBlockAccess {
if (!tileentity.y() && tileentity.u()) {
@@ -1294,7 +1294,13 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
if (!tileentity.x() && tileentity.u()) {
BlockPosition blockposition = tileentity.getPosition();
- if (this.isLoaded(blockposition) && this.P.a(blockposition)) {
- if (this.isLoaded(blockposition) && this.K.a(blockposition)) {
+ // Paper start - Skip ticking in chunks scheduled for unload
+ net.minecraft.server.Chunk chunk = this.getChunkIfLoaded(blockposition);
+ boolean shouldTick = chunk != null;
+ if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload)
+ shouldTick = shouldTick && !chunk.isUnloading() && chunk.scheduledForUnload == null;
+ if (shouldTick && this.P.a(blockposition)) {
+ if (shouldTick && this.K.a(blockposition)) {
+ // Paper end
try {
this.methodProfiler.a(() -> {
return String.valueOf(TileEntity.a(tileentity.getClass()));
return String.valueOf(TileEntityTypes.a(tileentity.C()));
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 69dc11e2b..284dc6391 100644
index 9d88b9ddb..e516ec603 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1576,7 +1576,7 @@ public class CraftWorld implements World {
@@ -1601,7 +1601,7 @@ public class CraftWorld implements World {
ChunkProviderServer cps = world.getChunkProviderServer();
for (net.minecraft.server.Chunk chunk : cps.chunks.values()) {
// If in use, skip it
@ -164,10 +163,10 @@ index 69dc11e2b..284dc6391 100644
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 47865c027..b79bf70f0 100644
index a9b84fdec..e02647f80 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -283,6 +283,10 @@ public class ActivationRange
@@ -284,6 +284,10 @@ public class ActivationRange
{
isActive = false;
}

View File

@ -1,4 +1,4 @@
From 244438affa544cd9fb04141577b56ef2a0b11788 Mon Sep 17 00:00:00 2001
From 26d160c73d35a95a6684b1423daf224d7878a82e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 21 Jun 2016 22:54:34 -0400
Subject: [PATCH] Fix Double World Add issues
@ -8,23 +8,23 @@ Vanilla will double add Spider Jockeys to the world, so ignore already added.
Also add debug if something else tries to, and abort before world gets bad state
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 12bd558a7..8747d9a45 100644
index faaa1b36b..063d53f1c 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -546,7 +546,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@@ -1020,7 +1020,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
public static void a(Entity entity, World world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
- if (world.addEntity(entity, reason) && entity.isVehicle()) {
+ if (!entity.valid && world.addEntity(entity, reason) && entity.isVehicle()) { // Paper
public static void a(Entity entity, GeneratorAccess generatoraccess, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
- if (generatoraccess.addEntity(entity, reason) && entity.isVehicle()) {
+ if (!entity.valid && generatoraccess.addEntity(entity, reason) && entity.isVehicle()) { // Paper
// CraftBukkit end
Iterator iterator = entity.bF().iterator();
Iterator iterator = entity.bP().iterator();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 36a78daff..6e37c4366 100644
index c34f42efc..a8ef9e337 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1103,6 +1103,7 @@ public abstract class World implements IBlockAccess {
@@ -955,6 +955,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
if (entity == null) return false;

View File

@ -0,0 +1,116 @@
From 62dd445f7cb912223bd98f9be51823bb9ebb49ad Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 17 Jun 2016 20:50:11 -0400
Subject: [PATCH] Fix Old Sign Conversion
1) Sign loading code was trying to parse the JSON before the check for oldSign.
That code could then skip the old sign converting code if it triggers a JSON parse exception.
2) New Mojang Schematic system has Tile Entities in the new converted format, but missing the Bukkit.isConverted flag
This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
index 65910508f..002b74175 100644
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -88,7 +88,7 @@ public class DefinedStructure {
}
private void a(World world, BlockPosition blockposition, BlockPosition blockposition1) {
- List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1), (entity) -> {
+ List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1),(Predicate<? super Entity>) (entity) -> { // Paper - decompile fix
return !(entity instanceof EntityHuman);
});
@@ -218,9 +218,11 @@ public class DefinedStructure {
definedstructure_blockinfo1.c.setInt("x", blockposition1.getX());
definedstructure_blockinfo1.c.setInt("y", blockposition1.getY());
definedstructure_blockinfo1.c.setInt("z", blockposition1.getZ());
+ tileentity.isLoadingStructure = true; // Paper
tileentity.load(definedstructure_blockinfo1.c);
tileentity.a(definedstructureinfo.b());
tileentity.a(definedstructureinfo.c());
+ tileentity.isLoadingStructure = false; // Paper
}
}
@@ -285,21 +287,27 @@ public class DefinedStructure {
voxelshapebitset.a(blockposition3.getX() - i2, blockposition3.getY() - j2, blockposition3.getZ() - l1, true, true);
}
- voxelshapebitset.a((enumdirection, i, j, k) -> {
- BlockPosition blockposition = new BlockPosition(l + i, i1 + j, j1 + k);
- BlockPosition blockposition1 = blockposition.shift(enumdirection);
- IBlockData iblockdata = generatoraccess.getType(blockposition);
+ // Paper start - decompile fixes
+ int finalL = l;
+ int finalI = i1;
+ int finalJ = j1;
+ int finalK = k1;
+ voxelshapebitset.a((enumdirection, i_, j_, k_) -> {
+ BlockPosition innerBlockposition = new BlockPosition(finalL + i_, finalI + j_, finalJ + k_);
+ BlockPosition blockposition1 = innerBlockposition.shift(enumdirection);
+ IBlockData iblockdata = generatoraccess.getType(innerBlockposition);
IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
- IBlockData iblockdata2 = iblockdata.updateState(enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
+ IBlockData iblockdata2 = iblockdata.updateState(enumdirection, iblockdata1, generatoraccess, innerBlockposition, blockposition1);
if (iblockdata != iblockdata2) {
- generatoraccess.setTypeAndData(blockposition, iblockdata2, k1 & -2 | 16);
+ generatoraccess.setTypeAndData(innerBlockposition, iblockdata2, finalK & -2 | 16);
}
- IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, blockposition);
+ IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, innerBlockposition);
if (iblockdata1 != iblockdata3) {
- generatoraccess.setTypeAndData(blockposition1, iblockdata3, k1 & -2 | 16);
+ generatoraccess.setTypeAndData(blockposition1, iblockdata3, finalK & -2 | 16);
+ // Paper end - decompile fixes
}
});
@@ -734,7 +742,7 @@ public class DefinedStructure {
public IBlockData a(int i) {
IBlockData iblockdata = (IBlockData) this.b.fromId(i);
- return iblockdata == null ? DefinedStructure.a.a : iblockdata;
+ return iblockdata == null ? a : iblockdata; // Paper - decompile error - Blocks.AIR.getBlockData()
}
public Iterator<IBlockData> iterator() {
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 8cab71c0e..2cfe2202e 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -11,6 +11,7 @@ import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public abstract class TileEntity implements KeyedObject {
public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
+ boolean isLoadingStructure = false; // Paper
private static final Logger a = LogManager.getLogger();
private final TileEntityTypes<?> e; public TileEntityTypes getTileEntityType() { return e; } // Paper - OBFHELPER
protected World world;
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 939d8790f..335a4d27f 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -49,13 +49,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener {
}
try {
- IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s);
+ //IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s); // Paper - move down - the old format might throw a json error
- if (oldSign) {
+ if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
lines[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
continue;
}
// CraftBukkit end
+ IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s); // Paper - after old sign
if (this.world instanceof WorldServer) {
try {
--
2.18.0

View File

@ -1,11 +1,11 @@
From 0aa3b7dfdf6535beb442e6ef6a6f609e15d4671c Mon Sep 17 00:00:00 2001
From 346d6a77e1974d7f4765f616c06cad3746ed4039 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 16 Jul 2016 19:11:17 -0500
Subject: [PATCH] Don't lookup game profiles that have no UUID and no name
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 4fb17a801..7ce08eb8b 100644
index f8b7d695c..a47a51a41 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -87,7 +87,7 @@ public class UserCache {

View File

@ -1,18 +1,18 @@
From 7d692b1b168fdc8a7d3d1394bb6d58f59de98053 Mon Sep 17 00:00:00 2001
From cb692770973181e52d95b3f1616a8e07667832d3 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 Jul 2016 17:58:53 -0500
Subject: [PATCH] More informative vehicle moved wrongly message
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9eb7b012f..e66584deb 100644
index d61ce6461..e4f28b8ac 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -357,7 +357,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -354,7 +354,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
flag1 = true;
- PlayerConnection.LOGGER.warn("{} moved wrongly!", entity.getName());
- PlayerConnection.LOGGER.warn("{} moved wrongly!", entity.getDisplayName().getString());
+ PlayerConnection.LOGGER.warn(entity.getName() + " (vehicle of " + this.player.getName() + ") moved wrongly!"); // Paper - More informative
}

View File

@ -1,14 +1,14 @@
From e5dae80584dbf0caa5a09109148f8063a834d834 Mon Sep 17 00:00:00 2001
From edd50cef4c8769d05a85ebfb88e0b85d88af36ab Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 31 Jul 2016 16:33:03 -0500
Subject: [PATCH] Re-track players that dismount from other players
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 4b6976b19..2391adac7 100644
index 8b5cfc78a..5aafa4e23 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -724,6 +724,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -733,6 +733,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (entity1 != entity && this.playerConnection != null) {
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}

View File

@ -1,4 +1,4 @@
From 75da66ca4a6bd260906024ddab96c665c9231c9d Mon Sep 17 00:00:00 2001
From eb105e6e240bc10506a92fc0972efbbf8912ee05 Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com>
Date: Fri, 5 Aug 2016 01:03:08 +0200
Subject: [PATCH] Add setting for proxy online mode status
@ -19,12 +19,12 @@ index 011cbf5e3..cf06f8ac3 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index b943a9b20..8f3b93dc1 100644
index f13534917..85c7a96c5 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -66,7 +66,8 @@ public class NameReferencingFileConverter {
}
}), String.class);
@@ -60,7 +60,8 @@ public class NameReferencingFileConverter {
return new String[i];
});
- if (minecraftserver.getOnlineMode() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.
+ if (minecraftserver.getOnlineMode()
@ -33,10 +33,10 @@ index b943a9b20..8f3b93dc1 100644
} else {
String[] astring1 = astring;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 054ac1b47..d3165763c 100644
index 2bcd1c3ca..a36192362 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1335,7 +1335,8 @@ public final class CraftServer implements Server {
@@ -1374,7 +1374,8 @@ public final class CraftServer implements Server {
// Spigot Start
GameProfile profile = null;
// Only fetch an online UUID in online mode

View File

@ -1,14 +1,14 @@
From a447b4a83b584f8af1b4b6d5fb660a9db06d2179 Mon Sep 17 00:00:00 2001
From 7c023b2177ae11b64004ab1ab12096db67d4352d Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Fri, 19 Aug 2016 01:52:56 +0100
Subject: [PATCH] Optimise BlockStateEnum hashCode and equals
diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java
index 21ac1e066..a241d7d8c 100644
index 725087de5..5e6cb5d7d 100644
--- a/src/main/java/net/minecraft/server/BlockStateEnum.java
+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java
@@ -16,6 +16,11 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
@@ -17,6 +17,11 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
private final ImmutableSet<T> a;
private final Map<String, T> b = Maps.newHashMap();
@ -20,19 +20,23 @@ index 21ac1e066..a241d7d8c 100644
protected BlockStateEnum(String s, Class<T> oclass, Collection<T> collection) {
super(s, oclass);
this.a = ImmutableSet.copyOf(collection);
@@ -32,6 +37,7 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
this.b.put(s1, (T) oenum);
@@ -30,9 +35,10 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
throw new IllegalArgumentException("Multiple values have the same name \'" + s1 + "\'");
}
- this.b.put(s1, oenum);
+ this.b.put(s1, (T) oenum); // Paper - decompile fix
}
+ this.hashCode = hashId++; // Paper
}
public Collection<T> c() {
@@ -46,32 +52,15 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
public Collection<T> d() {
@@ -47,24 +53,14 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
return ((INamable) t0).getName();
}
+ @Override // Paper - override equals as BlockStateEnum is a singleton
+ @Override // Paper start - override equals as BlockStateEnum is a singleton
public boolean equals(Object object) {
- if (this == object) {
- return true;
@ -44,27 +48,19 @@ index 21ac1e066..a241d7d8c 100644
- return false;
- }
+ return this == object;
+ // Paper end - override equals as BlockStateEnum is a singleton
}
- // Spigot start
- private int hashCode;
+ @Override // Paper - override equals as BlockStateEnum is a singleton
public int hashCode() {
- int hash = hashCode;
- if (hash == 0) {
- int i = super.hashCode();
public int c() {
- int i = super.c();
-
- i = 31 * i + this.a.hashCode();
- i = 31 * i + this.b.hashCode();
- hashCode = hash = i;
- }
- return hash;
+ return hashCode;
- i = 31 * i + this.a.hashCode();
- i = 31 * i + this.b.hashCode();
- return i;
+ return hashCode; // Paper - hashCode method is final, but we can do this here
}
- // Spigot end
public static <T extends Enum<T> & INamable> BlockStateEnum<T> of(String s, Class<T> oclass) {
return a(s, oclass, Predicates.alwaysTrue());
--
2.18.0

View File

@ -1,32 +1,23 @@
From c495d06f61d0f6a57b3a0b008d4f60e937ecff42 Mon Sep 17 00:00:00 2001
From 093f67662e108285ca05b0485d6ff14d2c73323d Mon Sep 17 00:00:00 2001
From: killme <killme-git@ibts.me>
Date: Tue, 30 Aug 2016 16:39:48 +0200
Subject: [PATCH] Disable ticking of snow blocks
diff --git a/src/main/java/net/minecraft/server/BlockSnowBlock.java b/src/main/java/net/minecraft/server/BlockSnowBlock.java
index 8123d7295..b6765e5bc 100644
index 0c8f9d37f..44ed65626 100644
--- a/src/main/java/net/minecraft/server/BlockSnowBlock.java
+++ b/src/main/java/net/minecraft/server/BlockSnowBlock.java
@@ -6,7 +6,7 @@ public class BlockSnowBlock extends Block {
protected BlockSnowBlock() {
super(Material.SNOW_BLOCK);
- this.a(true);
+ // this.a(true); // Paper - snow blocks don't need to tick
this.a(CreativeModeTab.b);
}
@@ -18,6 +18,8 @@ public class BlockSnowBlock extends Block {
@@ -16,6 +16,8 @@ public class BlockSnowBlock extends Block {
return 4;
}
+ // Paper start - snow blocks don't need to tick
+ /*
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (world.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
// CraftBukkit start
@@ -30,4 +32,6 @@ public class BlockSnowBlock extends Block {
@@ -28,4 +30,6 @@ public class BlockSnowBlock extends Block {
}
}

View File

@ -1,22 +1,22 @@
From ccc20dcc8957311e38f8f1d350e01e9f3ec46d9f Mon Sep 17 00:00:00 2001
From 6ad7cbab0516dc2372b5a23e12f64abc400ca6a3 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sun, 4 Sep 2016 16:35:43 -0500
Subject: [PATCH] Fix AIOOBE in inventory handling
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e66584deb..f5fb86414 100644
index e4f28b8ac..c09620b37 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1849,7 +1849,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2080,7 +2080,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
case CLONE:
if (packetplayinwindowclick.c() == 2) {
if (packetplayinwindowclick.d() == 2) {
click = ClickType.MIDDLE;
- if (packetplayinwindowclick.b() == -999) {
+ if (packetplayinwindowclick.b() < 0) { // Paper - GH-404
- if (packetplayinwindowclick.c() == -999) {
+ if (packetplayinwindowclick.c() < 0) { // Paper - GH-404
action = InventoryAction.NOTHING;
} else {
Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.b());
Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.c());
--
2.18.0

View File

@ -1,4 +1,4 @@
From fc0280fe1ab9b4a8eff7c35bb03792e00440b736 Mon Sep 17 00:00:00 2001
From c1b9295b23dbaf419b41f1fbe6aa1df6cccfbbe6 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 11 Sep 2016 14:30:57 -0500
Subject: [PATCH] Configurable packet in spam threshold
@ -23,10 +23,10 @@ index cf06f8ac3..2001175bf 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index f5fb86414..16c343b54 100644
index c09620b37..aa7c019ab 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -909,13 +909,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1185,13 +1185,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// Spigot start - limit place/interactions
private int limitedPackets;
private long lastLimitedPacket = -1;

View File

@ -1,4 +1,4 @@
From 4a14ee67890687fcab9c5e662e07a082ea0e0fe6 Mon Sep 17 00:00:00 2001
From 1bc0a231c368f5dbfb900443a1532d7cf547e328 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Tue, 20 Sep 2016 00:58:01 +0000
Subject: [PATCH] Configurable flying kick messages
@ -21,22 +21,21 @@ index 2001175bf..621c585e7 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 16c343b54..8981e94df 100644
index aa7c019ab..be0322941 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -144,7 +144,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (this.B) {
@@ -144,6 +144,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (++this.C > 80) {
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getName());
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0]));
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString());
this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0]));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message
return;
}
} else {
@@ -163,7 +163,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (this.D && this.player.getVehicle().bE() == this.player) {
@@ -162,7 +163,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (this.D && this.player.getRootVehicle().bO() == this.player) {
if (++this.E > 80) {
PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName());
PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getDisplayName().getString());
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0]));
+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message
return;

View File

@ -1,4 +1,4 @@
From 3116c6b8cd13ddce911fcb81a43a7a8b6696bd67 Mon Sep 17 00:00:00 2001
From 9c20a3d7127f062b7270bafc120ccb55f69e3900 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 19 Sep 2016 23:16:39 -0400
Subject: [PATCH] Auto Save Improvements
@ -32,7 +32,7 @@ index 621c585e7..459c86bce 100644
+ }
}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1b9eb7f45..ce848d63e 100644
index 0e6c18b32..c182ceffb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -2,6 +2,7 @@ package com.destroystokyo.paper;
@ -43,9 +43,9 @@ index 1b9eb7f45..ce848d63e 100644
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -363,4 +364,19 @@ public class PaperWorldConfig {
private void elytraHitWallDamage() {
elytraHitWallDamage = getBoolean("elytra-hit-wall-damage", true);
@@ -298,4 +299,19 @@ public class PaperWorldConfig {
private void skipEntityTickingInChunksScheduledForUnload() {
skipEntityTickingInChunksScheduledForUnload = getBoolean("skip-entity-ticking-in-chunks-scheduled-for-unload", skipEntityTickingInChunksScheduledForUnload);
}
+
+ public int autoSavePeriod = -1;
@ -64,25 +64,25 @@ index 1b9eb7f45..ce848d63e 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index cc9c8b2e0..a59f5b190 100644
index 6c6924937..5163bd11b 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1000,11 +1000,9 @@ public class Chunk {
if (this.t && this.world.getTime() != this.lastSaved || this.s) {
@@ -1013,11 +1013,9 @@ public class Chunk implements IChunkAccess {
if (this.w && this.world.getTime() != this.lastSaved || this.y) {
return true;
}
- } else if (this.t && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification
- } else if (this.w && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification
- return true;
}
-
- return this.s;
+ // This !flag section should say if s(isModified) or t(hasEntities), then check auto save
+ return ((this.s || this.t) && this.world.getTime() >= this.lastSaved + world.paperConfig.autoSavePeriod); // Paper - Make world configurable and incremental
- return this.y;
+ // This !flag section should say if y(isModified) or w(hasEntities), then check auto save
+ return ((this.y || this.w) && this.world.getTime() >= this.lastSaved + world.paperConfig.autoSavePeriod); // Paper - Make world configurable and incremental
}
public Random a(long i) {
public boolean isEmpty() {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 47159bff3..db81b4a8c 100644
index 2e72a294d..1e6ea3084 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -1,5 +1,6 @@
@ -90,11 +90,11 @@ index 47159bff3..db81b4a8c 100644
+import com.destroystokyo.paper.PaperConfig;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
@@ -266,7 +267,7 @@ public class ChunkProviderServer implements IChunkProvider {
import it.unimi.dsi.fastutil.longs.Long2ObjectMaps;
@@ -260,7 +261,7 @@ public class ChunkProviderServer implements IChunkProvider {
this.saveChunk(chunk, false); // Spigot
chunk.f(false);
chunk.a(false);
++i;
- if (i == 24 && !flag && false) { // Spigot
+ if (!flag && i >= world.paperConfig.maxAutoSaveChunksPerTick) { // Spigot - // Paper - Incremental Auto Save - cap max per tick
@ -102,36 +102,36 @@ index 47159bff3..db81b4a8c 100644
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 2391adac7..8b7eb47a2 100644
index 5aafa4e23..f5fae7ba8 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -32,6 +32,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger bV = LogManager.getLogger();
public String locale = null; // PAIL: private -> public // Paper - default to null
@@ -38,6 +38,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger cc = LogManager.getLogger();
private static final IChatBaseComponent cd = (new ChatMessage("multiplayer.message_not_delivered", new Object[0])).a(EnumChatFormat.RED);
public String locale = null; // CraftBukkit - lowercase // Paper - default to null
+ public long lastSave = MinecraftServer.currentTick; // Paper
public PlayerConnection playerConnection;
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ab7933079..5c09c6ff7 100644
index 49b2c27c6..bf020293d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -119,6 +119,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
public final Thread primaryThread;
@@ -147,6 +147,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
public File bukkitDataPackFolder;
+ public boolean serverAutoSave = false; // Paper
// CraftBukkit end
// Spigot start
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
@@ -766,22 +767,30 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.q.b().a(agameprofile);
@@ -868,22 +869,30 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.n.b().a(agameprofile);
}
- if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
this.methodProfiler.a("save");
- this.v.savePlayers();
- this.s.savePlayers();
+
+ serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper
+ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate;
@ -139,7 +139,7 @@ index ab7933079..5c09c6ff7 100644
+ playerSaveInterval = autosavePeriod;
+ }
+ if (playerSaveInterval > 0) { // CraftBukkit // Paper
+ this.v.savePlayers(playerSaveInterval);
+ this.s.savePlayers(playerSaveInterval);
// Spigot Start
+ } // Paper - Incremental Auto Saving
+
@ -154,17 +154,17 @@ index ab7933079..5c09c6ff7 100644
server.playerCommandState = false;
// this.saveChunks(true);
// Spigot End
this.methodProfiler.b();
this.methodProfiler.e();
- }
+ //} // Paper - Incremental Auto Saving
this.methodProfiler.a("tallying");
// Spigot start
this.methodProfiler.a("snooper");
if (getSnooperEnabled() && !this.j.d() && this.ticks > 100) { // Spigot
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 950dbdc50..23ed9efbf 100644
index 801a147f0..1f2265231 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -343,6 +343,7 @@ public abstract class PlayerList {
@@ -340,6 +340,7 @@ public abstract class PlayerList {
}
protected void savePlayerFile(EntityPlayer entityplayer) {
@ -172,7 +172,7 @@ index 950dbdc50..23ed9efbf 100644
this.playerFileData.save(entityplayer);
ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit
@@ -1245,13 +1246,25 @@ public abstract class PlayerList {
@@ -1219,13 +1220,25 @@ public abstract class PlayerList {
}
@ -197,13 +197,13 @@ index 950dbdc50..23ed9efbf 100644
}
+ // Paper end
public void addWhitelist(GameProfile gameprofile) {
this.whitelist.add(new WhiteListEntry(gameprofile));
public WhiteList getWhitelist() {
return this.whitelist;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ebe397116..53cea76e2 100644
index e3d62fc9c..72b3a6d40 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1053,8 +1053,9 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@@ -872,8 +872,9 @@ public class WorldServer extends World implements IAsyncTaskHandler {
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
if (chunkproviderserver.e()) {
@ -212,11 +212,11 @@ index ebe397116..53cea76e2 100644
timings.worldSave.startTiming(); // Paper
+ if (flag || server.serverAutoSave) { // Paper
if (iprogressupdate != null) {
iprogressupdate.a("Saving level");
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
}
@@ -1063,6 +1064,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@@ -882,6 +883,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
if (iprogressupdate != null) {
iprogressupdate.c("Saving chunks");
iprogressupdate.c(new ChatMessage("menu.savingChunks", new Object[0]));
}
+ } // Paper

View File

@ -1,4 +1,4 @@
From e12d715554fa2684d9c5c7dcfc765fdf66f02654 Mon Sep 17 00:00:00 2001
From 25b0a8a99230a59bf4252825e53800faad6e5368 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
@ -8,10 +8,10 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6e37c4366..000d2eeb9 100644
index a8ef9e337..3b2de1f31 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1770,7 +1770,7 @@ public abstract class World implements IBlockAccess {
@@ -1470,7 +1470,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
i = MathHelper.floor(entity.locX / 16.0D);
@ -19,7 +19,7 @@ index 6e37c4366..000d2eeb9 100644
+ j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
int k = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.aa || entity.ab != i || entity.ac != j || entity.ad != k) {
if (!entity.inChunk || entity.ae != i || entity.af != j || entity.ag != k) {
--
2.18.0

View File

@ -1,14 +1,14 @@
From 1b510c55f2ced947504bbe7ecd6f5936f9a644f0 Mon Sep 17 00:00:00 2001
From b25b163404c102ab0e30bec1af51a85ac8dc13f1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 16 Jun 2016 00:17:23 -0400
Subject: [PATCH] Remove FishingHook reference on Craft Entity removal
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java
index d555597dc..f5419dea4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java
@@ -62,4 +62,14 @@ public class CraftFish extends AbstractProjectile implements Fish {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
index 8392b16b3..752b56435 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
@@ -62,4 +62,15 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1.");
this.biteChance = chance;
}
@ -22,6 +22,7 @@ index d555597dc..f5419dea4 100644
+ }
+ }
+ // Paper end
+
}
--
2.18.0

View File

@ -1,4 +1,4 @@
From f181f1048f4dd143fc9f0b998e8e1a789efbf1b2 Mon Sep 17 00:00:00 2001
From 7267f517bb9c00b59b8d441d00a286d15fd55d0d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 23:48:39 -0400
Subject: [PATCH] Auto fix bad Y levels on player login
@ -6,17 +6,17 @@ Subject: [PATCH] Auto fix bad Y levels on player login
Bring down to a saner Y level if super high, as this can cause the server to crash
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 8b7eb47a2..7886eee61 100644
index f5fae7ba8..dc32dc80d 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -140,6 +140,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -199,6 +199,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
+ if (this.locY > 300) this.locY = 257; // Paper - bring down to a saner Y level if out of world
if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
if (this.C_().getForceGamemode()) {
this.playerInteractManager.setGameMode(this.C_().getGamemode());
if (this.bK().getForceGamemode()) {
this.playerInteractManager.setGameMode(this.bK().getGamemode());
--
2.18.0

View File

@ -1,4 +1,4 @@
From 839a3b9a54a2c51c8c3333c3a05eef5009561dae Mon Sep 17 00:00:00 2001
From 3e0826f735fb80823d60d8fc9bc6100dfd3e8644 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 26 Sep 2016 01:51:30 -0400
Subject: [PATCH] Disable Vanilla Chunk GC
@ -6,10 +6,10 @@ Subject: [PATCH] Disable Vanilla Chunk GC
Bukkit has its own system for this.
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 53cea76e2..737ade74d 100644
index 72b3a6d40..e766e2536 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1070,7 +1070,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@@ -889,7 +889,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
chunkproviderserver.a(flag);
timings.worldSaveChunks.stopTiming(); // Paper
// CraftBukkit - ArrayList -> Collection
@ -18,7 +18,7 @@ index 53cea76e2..737ade74d 100644
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
@@ -1079,7 +1079,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@@ -898,7 +898,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
if (chunk != null && !this.manager.a(chunk.locX, chunk.locZ)) {
chunkproviderserver.unload(chunk);
}

View File

@ -1,14 +1,14 @@
From 5b908630761c4e62419ce38535eaa3b715c34675 Mon Sep 17 00:00:00 2001
From 972bafac578a82a102ff389e5faf3b35d3b58e72 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 5 Oct 2016 16:27:36 -0500
Subject: [PATCH] Option to remove corrupt tile entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ce848d63e..93b0af036 100644
index c182ceffb..9a2ec0793 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -379,4 +379,9 @@ public class PaperWorldConfig {
@@ -314,4 +314,9 @@ public class PaperWorldConfig {
private void maxAutoSaveChunksPerTick() {
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
}
@ -19,10 +19,10 @@ index ce848d63e..93b0af036 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index a59f5b190..27a36b2b0 100644
index 5163bd11b..f31524eb0 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -823,11 +823,18 @@ public class Chunk {
@@ -832,6 +832,12 @@ public class Chunk implements IChunkAccess {
"Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);
@ -35,6 +35,8 @@ index a59f5b190..27a36b2b0 100644
// Paper end
// CraftBukkit end
}
@@ -841,6 +847,7 @@ public class Chunk implements IChunkAccess {
this.i.put(new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")), nbttagcompound);
}
+ public void removeTileEntity(BlockPosition blockposition) { this.d(blockposition); } // Paper - OBFHELPER

View File

@ -1,14 +1,14 @@
From 13f069785d26dfc9ab4f6f87fb7c7d5c40b1b8c9 Mon Sep 17 00:00:00 2001
From c66ad22a6abf417c552de63b264628c814f718c1 Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Sun, 16 Oct 2016 23:19:30 -0700
Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 94d011721..fcf99e668 100644
index 286382399..2c7677b48 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -158,6 +158,12 @@ public class EntityPig extends EntityAnimal {
@@ -152,6 +152,12 @@ public class EntityPig extends EntityAnimal {
if (!this.world.isClientSide && !this.dead) {
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
@ -22,10 +22,10 @@ index 94d011721..fcf99e668 100644
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
return;
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 87ed31b21..9d201b14e 100644
index 2ec695c9e..abfd9adbd 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -638,6 +638,12 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
@@ -610,6 +610,12 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
if (!this.world.isClientSide && !this.dead) {
EntityWitch entitywitch = new EntityWitch(this.world);
@ -36,9 +36,9 @@ index 87ed31b21..9d201b14e 100644
+ // Paper end
+
entitywitch.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitywitch.prepare(this.world.D(new BlockPosition(entitywitch)), (GroupDataEntity) null);
entitywitch.prepare(this.world.getDamageScaler(new BlockPosition(entitywitch)), (GroupDataEntity) null, (NBTTagCompound) null);
entitywitch.setNoAI(this.isNoAI());
@@ -646,7 +652,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
@@ -618,7 +624,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
entitywitch.setCustomNameVisible(this.getCustomNameVisible());
}
@ -48,10 +48,10 @@ index 87ed31b21..9d201b14e 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index bc84dd30f..ba7e5d181 100644
index 1d39ebcfa..2a7f89537 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -684,6 +684,14 @@ public class CraftEventFactory {
@@ -692,6 +692,14 @@ public class CraftEventFactory {
return event;
}

View File

@ -1,71 +0,0 @@
From b9cd2fb5f5d0dd6ef57e7d8b5c550d760e472077 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 17 Jun 2016 20:50:11 -0400
Subject: [PATCH] Fix Old Sign Conversion
1) Sign loading code was trying to parse the JSON before the check for oldSign.
That code could then skip the old sign converting code if it triggers a JSON parse exception.
2) New Mojang Schematic system has Tile Entities in the new converted format, but missing the Bukkit.isConverted flag
This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
index 9f314204b..23da9467e 100644
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -203,9 +203,11 @@ public class DefinedStructure {
definedstructure_blockinfo1.c.setInt("x", blockposition1.getX());
definedstructure_blockinfo1.c.setInt("y", blockposition1.getY());
definedstructure_blockinfo1.c.setInt("z", blockposition1.getZ());
+ tileentity.isLoadingStructure = true; // Paper
tileentity.load(definedstructure_blockinfo1.c);
tileentity.a(definedstructureinfo.b());
tileentity.a(definedstructureinfo.c());
+ tileentity.isLoadingStructure = false; // Paper
}
}
}
@@ -600,7 +602,7 @@ public class DefinedStructure {
public IBlockData a(int i) {
IBlockData iblockdata = (IBlockData) this.b.fromId(i);
- return iblockdata == null ? DefinedStructure.a.a : iblockdata;
+ return iblockdata == null ? a : iblockdata; // Paper - decompile error - Blocks.AIR.getBlockData()
}
public Iterator<IBlockData> iterator() {
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index dfdc55583..d3bc13726 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -11,6 +11,7 @@ import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public abstract class TileEntity implements KeyedObject {
public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
+ boolean isLoadingStructure = false; // Paper
private static final Logger a = LogManager.getLogger();
private static final RegistryMaterials<MinecraftKey, Class<? extends TileEntity>> f = new RegistryMaterials();
protected World world;
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 77a7b4458..54b719d91 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -77,13 +77,14 @@ public class TileEntitySign extends TileEntity {
}
try {
- IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s);
+ //IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s); // Paper - move down - the old format might throw a json error
- if (oldSign) {
+ if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
lines[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
continue;
}
// CraftBukkit end
+ IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s); // Paper - after old sign
try {
this.lines[i] = ChatComponentUtils.filterForDisplay(icommandlistener, ichatbasecomponent, (Entity) null);
--
2.18.0

View File

@ -0,0 +1,35 @@
From 3fae37b400f05dba3d1ca15ad221ac4127ba2c20 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Nov 2016 20:28:12 -0400
Subject: [PATCH] Don't load Chunks from Hoppers and other things
Hoppers call this to I guess "get the primary side" of a double sided chest.
If the double sided chest crosses chunk lines, it causes the chunk to load.
This will end up causing sync chunk loads, which will unload with Chunk GC,
only to be reloaded again the next tick.
This of course is undesirable, so just return the loaded side as "primary"
and treat it as a single chest if the other sides are unloaded
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
index f8be07258..633c75ffe 100644
--- a/src/main/java/net/minecraft/server/BlockChest.java
+++ b/src/main/java/net/minecraft/server/BlockChest.java
@@ -196,7 +196,12 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC
return (ITileInventory) object;
} else {
BlockPosition blockposition1 = blockposition.shift(j(iblockdata));
- IBlockData iblockdata1 = world.getType(blockposition1);
+ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk
+ final IBlockData iblockdata1 = world.getTypeIfLoaded(blockposition1); // Paper
+ if (iblockdata1 == null) {
+ return null;
+ }
+ // Paper end
if (iblockdata1.getBlock() == this) {
BlockPropertyChestType blockpropertychesttype1 = (BlockPropertyChestType) iblockdata1.get(BlockChest.b);
--
2.18.0

View File

@ -1,4 +1,4 @@
From 8b4d08357734d240e14b6cef4b3ad9563cbfb822 Mon Sep 17 00:00:00 2001
From 55d61d596dd28c87be9a6885282a21abc2caff4f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Nov 2016 21:52:22 -0400
Subject: [PATCH] Prevent Auto Save if Save Queue is full
@ -7,10 +7,10 @@ If the save queue already has 50 (configurable) of chunks pending,
then avoid processing auto save (which would add more)
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 93b0af036..086a7fdaa 100644
index 9a2ec0793..f88444c7e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -380,6 +380,11 @@ public class PaperWorldConfig {
@@ -315,6 +315,11 @@ public class PaperWorldConfig {
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
}
@ -23,13 +23,13 @@ index 93b0af036..086a7fdaa 100644
private void removeCorruptTEs() {
removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index db81b4a8c..93e938a9d 100644
index 1e6ea3084..9145401bc 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -254,6 +254,14 @@ public class ChunkProviderServer implements IChunkProvider {
int i = 0;
@@ -250,6 +250,14 @@ public class ChunkProviderServer implements IChunkProvider {
ArrayList arraylist = Lists.newArrayList(this.chunks.values());
Iterator iterator = arraylist.iterator();
// CraftBukkit start
+ // Paper start
+ final ChunkRegionLoader chunkLoader = (ChunkRegionLoader) world.getChunkProviderServer().chunkLoader;
+ final int queueSize = chunkLoader.getQueueSize();
@ -38,12 +38,12 @@ index db81b4a8c..93e938a9d 100644
+ }
+ final int autoSaveLimit = world.paperConfig.maxAutoSaveChunksPerTick;
+ // Paper end
Iterator iterator = this.chunks.values().iterator();
while (iterator.hasNext()) {
Chunk chunk = (Chunk) iterator.next();
@@ -267,7 +275,7 @@ public class ChunkProviderServer implements IChunkProvider {
@@ -261,7 +269,7 @@ public class ChunkProviderServer implements IChunkProvider {
this.saveChunk(chunk, false); // Spigot
chunk.f(false);
chunk.a(false);
++i;
- if (!flag && i >= world.paperConfig.maxAutoSaveChunksPerTick) { // Spigot - // Paper - Incremental Auto Save - cap max per tick
+ if (!flag && i >= autoSaveLimit) { // Spigot - // Paper - Incremental Auto Save - cap max per tick
@ -51,18 +51,18 @@ index db81b4a8c..93e938a9d 100644
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 8747d9a45..77943821e 100644
index 063d53f1c..071e8a196 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -39,6 +39,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
this.e = dataconvertermanager;
@@ -99,6 +99,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
}
+ public int getQueueSize() { return queue.size(); } // Paper
+
// CraftBukkit start - Add async variant, provide compatibility
@Nullable
public Chunk a(World world, int i, int j) throws IOException {
public synchronized Chunk a(GeneratorAccess generatoraccess, int i, int j, Consumer<Chunk> consumer) throws IOException {
--
2.18.0

View File

@ -1,4 +1,4 @@
From 4c7de2e2109d66a5a3911af98b61c1af58e0d8a6 Mon Sep 17 00:00:00 2001
From 6e299603426bfed427e4ae7bded471d86ab70a0b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 4 Nov 2016 02:12:10 -0400
Subject: [PATCH] Chunk Save Stats Debug Option
@ -8,22 +8,22 @@ Adds a command line flag to enable stats on how chunk saves are processing.
Stats on current queue, how many was processed and how many were queued.
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 93e938a9d..66ff1adf6 100644
index 9145401bc..ef35eb7ec 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -28,6 +28,11 @@ public class ChunkProviderServer implements IChunkProvider {
public final Set<Long> unloadQueue = Sets.newHashSet();
public final ChunkGenerator chunkGenerator;
private final IChunkLoader chunkLoader;
@@ -36,6 +36,11 @@ public class ChunkProviderServer implements IChunkProvider {
public final Long2ObjectMap<Chunk> chunks = Long2ObjectMaps.synchronize(new ChunkMap(8192));
private final ChunkTaskScheduler f;
private final SchedulerBatch<ChunkCoordIntPair, ChunkStatus, ProtoChunk> g;
+ // Paper start - chunk save stats
+ private long lastQueuedSaves = 0L; // Paper
+ private long lastProcessedSaves = 0L; // Paper
+ private long lastSaveStatPrinted = System.currentTimeMillis();
+ // Paper end
// Paper start
protected Chunk lastChunkByPos = null;
public Long2ObjectOpenHashMap<Chunk> chunks = new Long2ObjectOpenHashMap<Chunk>(8192) {
@@ -257,6 +262,30 @@ public class ChunkProviderServer implements IChunkProvider {
public final WorldServer world;
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, ChunkGenerator<?> chunkgenerator, IAsyncTaskHandler iasynctaskhandler) {
@@ -253,6 +258,30 @@ public class ChunkProviderServer implements IChunkProvider {
// Paper start
final ChunkRegionLoader chunkLoader = (ChunkRegionLoader) world.getChunkProviderServer().chunkLoader;
final int queueSize = chunkLoader.getQueueSize();
@ -55,11 +55,11 @@ index 93e938a9d..66ff1adf6 100644
return false;
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 77943821e..14f88e91d 100644
index 071e8a196..fedc38dc1 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -39,7 +39,13 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
this.e = dataconvertermanager;
@@ -99,7 +99,13 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
}
- public int getQueueSize() { return queue.size(); } // Paper
@ -73,15 +73,15 @@ index 77943821e..14f88e91d 100644
// CraftBukkit start - Add async variant, provide compatibility
@Nullable
@@ -163,6 +169,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
synchronized (lock) { // Paper - Chunk queue improvements
this.b.put(chunkcoordintpair, nbttagcompound);
}
+ queuedSaves++; // Paper
queue.add(new QueuedChunk(chunkcoordintpair, nbttagcompound)); // Paper - Chunk queue improvements
@@ -291,6 +297,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
protected synchronized void a(ChunkCoordIntPair chunkcoordintpair, Supplier<NBTTagCompound> nbttagcompound) { // Spigot
queue.add(new QueuedChunk(chunkcoordintpair, nbttagcompound)); // Paper - Chunk queue improvements
+ queuedSaves++; // Paper
this.b.put(chunkcoordintpair, nbttagcompound);
FileIOThread.a().a(this);
@@ -187,6 +194,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
@@ -314,6 +321,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
return false;
} else {
ChunkCoordIntPair chunkcoordintpair = chunk.coords; // Paper - Chunk queue improvements

View File

@ -1,11 +1,11 @@
From 051ae98e08452cc8838801081b84366dbc42b7f8 Mon Sep 17 00:00:00 2001
From fe49df954c155646594c102bbf909fbbcc55a37d Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 12 Nov 2016 23:25:22 -0600
Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 086a7fdaa..4b9bf3b4f 100644
index f88444c7e..f64a5ef35 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -3,6 +3,7 @@ package com.destroystokyo.paper;
@ -16,7 +16,7 @@ index 086a7fdaa..4b9bf3b4f 100644
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -389,4 +390,12 @@ public class PaperWorldConfig {
@@ -324,4 +325,12 @@ public class PaperWorldConfig {
private void removeCorruptTEs() {
removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
}
@ -30,44 +30,25 @@ index 086a7fdaa..4b9bf3b4f 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 59acc9088..d0b67d8fd 100644
index 1d4a7b64d..c4a25bd87 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -271,6 +271,14 @@ public class EntityFallingBlock extends Entity {
this.block = Block.getById(nbttagcompound.getByte("Tile") & 255).fromLegacyData(i);
}
@@ -228,6 +228,15 @@ public class EntityFallingBlock extends Entity {
protected void a(NBTTagCompound nbttagcompound) {
this.block = GameProfileSerializer.d(nbttagcompound.getCompound("BlockState"));
+
+ // Paper start - Block FallingBlocks with Command Blocks
+ // Check mappings on update - dc = "repeating_command_block" - dd = "chain_command_block"
+ final Block b = this.block.getBlock();
+ if (this.world.paperConfig.filterNBTFromSpawnEgg && (b == Blocks.COMMAND_BLOCK || b == Blocks.dc || b == Blocks.dd)) {
+ if (this.world.paperConfig.filterNBTFromSpawnEgg && (b == Blocks.COMMAND_BLOCK || b == Blocks.REPEATING_COMMAND_BLOCK || b == Blocks.CHAIN_COMMAND_BLOCK)) {
+ this.block = Blocks.STONE.getBlockData();
+ }
+ // Paper end
+
this.ticksLived = nbttagcompound.getInt("Time");
Block block = this.block.getBlock();
diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index b24f7d8b2..5a08f6b4e 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -102,7 +102,14 @@ public class ItemMonsterEgg extends Item {
NBTTagCompound nbttagcompound1 = entity.save(new NBTTagCompound());
UUID uuid = entity.getUniqueID();
- nbttagcompound1.a(nbttagcompound.getCompound("EntityTag"));
+ // Paper start - Filter out position and motion information
+ final NBTTagCompound entityTag = nbttagcompound.getCompound("EntityTag");
+ if (world.paperConfig.filterNBTFromSpawnEgg) {
+ entityTag.remove("Pos");
+ entityTag.remove("Motion");
+ }
+ nbttagcompound1.a(entityTag);
+ // Paper end
entity.a(uuid);
entity.f(nbttagcompound1);
}
if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) {
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");
--
2.18.0

View File

@ -1,14 +1,14 @@
From 9f3a20649274a2ecc29be930cb9257172ce21902 Mon Sep 17 00:00:00 2001
From a2e44a310b6d7c52649acda35aba0cd677d3a7e7 Mon Sep 17 00:00:00 2001
From: vemacs <d@nkmem.es>
Date: Wed, 23 Nov 2016 08:31:45 -0500
Subject: [PATCH] Cache user authenticator threads
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 57f728567..2158fcd32 100644
index 2f6d79b03..89a11a496 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -96,6 +96,12 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -93,6 +93,12 @@ public class LoginListener implements PacketLoginInListener, ITickable {
}
@ -21,8 +21,8 @@ index 57f728567..2158fcd32 100644
// Spigot start
public void initUUID()
{
@@ -178,8 +184,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.O().getPublic(), this.e));
@@ -169,8 +175,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.G().getPublic(), this.e));
} else {
// Spigot start
- new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
@ -32,7 +32,7 @@ index 57f728567..2158fcd32 100644
@Override
public void run() {
try {
@@ -191,7 +197,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -182,7 +188,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
}
}
@ -42,21 +42,24 @@ index 57f728567..2158fcd32 100644
// Spigot end
}
@@ -207,7 +214,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -198,7 +205,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
this.loginKey = packetlogininencryptionbegin.a(privatekey);
this.g = LoginListener.EnumProtocolState.AUTHENTICATING;
this.networkManager.a(this.loginKey);
- (new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
- Thread thread = new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
+ // Paper start - Cache authenticator threads
+ authenticatorPool.execute(new Runnable() {
public void run() {
GameProfile gameprofile = LoginListener.this.i;
@@ -254,7 +262,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -245,10 +253,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
return LoginListener.this.server.ac() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
return LoginListener.this.server.U() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
}
- }).start();
- };
-
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LoginListener.c));
- thread.start();
+ });
+ // Paper end
}

View File

@ -0,0 +1,22 @@
From 146ed7d9845c818bcf091214784ba462f02ae69e Mon Sep 17 00:00:00 2001
From: vemacs <d@nkmem.es>
Date: Wed, 23 Nov 2016 12:54:56 -0500
Subject: [PATCH] Optimize Network Queue
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bf020293d..f81ff5628 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -118,7 +118,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
private final GameProfileRepository W;
private final UserCache X;
private long Y;
- protected final Queue<FutureTask<?>> g = Queues.newConcurrentLinkedQueue();
+ protected final Queue<FutureTask<?>> g = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Spigot, PAIL: Rename // Paper - Make size() constant-time
private Thread serverThread;
private long aa = SystemUtils.b();
private final IReloadableResourceManager ac;
--
2.18.0

View File

@ -1,34 +1,34 @@
From 620aaee71fea323a42cfb6674a33a1b715c03a99 Mon Sep 17 00:00:00 2001
From 1e1c86320251ddee4d47d350d6aeafba60214f49 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Fri, 25 Nov 2016 13:22:40 +0000
Subject: [PATCH] Optimise removeQueue
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 7886eee61..f8e289475 100644
index dc32dc80d..cf2a39384 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -3,8 +3,10 @@ package net.minecraft.server;
import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
@@ -5,8 +5,10 @@ import com.mojang.authlib.GameProfile;
import io.netty.buffer.Unpooled;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
+import java.util.ArrayDeque; // Paper
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Deque; // Paper
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;
@@ -38,7 +40,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
import java.util.Random;
@@ -44,7 +46,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public final PlayerInteractManager playerInteractManager;
public double d;
public double e;
- public final List<Integer> removeQueue = Lists.newLinkedList();
+ public final Deque<Integer> removeQueue = new ArrayDeque<>(); // Paper
private final AdvancementDataPlayer bY;
private final ServerStatisticManager bZ;
private float ca = Float.MIN_VALUE;
@@ -295,10 +297,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private final AdvancementDataPlayer cg;
private final ServerStatisticManager ch;
private float ci = Float.MIN_VALUE;
@@ -351,10 +353,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
Iterator iterator = this.removeQueue.iterator();
int j = 0;
@ -47,18 +47,18 @@ index 7886eee61..f8e289475 100644
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint));
}
@@ -1112,7 +1121,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1119,7 +1128,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.lastHealthSent = -1.0F;
this.ch = -1;
// this.cr.a((RecipeBook) entityplayer.cr); // CraftBukkit
this.cp = -1;
// this.cz.a((RecipeBook) entityplayer.cz); // CraftBukkit
- this.removeQueue.addAll(entityplayer.removeQueue);
+ // Paper start - Optimize remove queue
+ //this.removeQueue.addAll(entityplayer.removeQueue);
+ if (this.removeQueue != entityplayer.removeQueue) {
+ this.removeQueue.addAll(entityplayer.removeQueue);
+ }
this.cq = entityplayer.cq;
this.cv = entityplayer.cv;
this.cy = entityplayer.cy;
this.cD = entityplayer.cD;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
--
2.18.0

View File

@ -1,4 +1,4 @@
From bd9e06a79e32b2c983c41827e7c4127c3436f6cc Mon Sep 17 00:00:00 2001
From 92afeaf4b7ea1551a2a035a2e0443e28571f5a00 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 28 Nov 2016 10:21:52 -0500
Subject: [PATCH] Allow Reloading of Command Aliases
@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d3165763c..41357cb0e 100644
index a36192362..f3dfd65d6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1889,5 +1889,24 @@ public final class CraftServer implements Server {
@@ -1985,5 +1985,24 @@ public final class CraftServer implements Server {
});
}
}

View File

@ -1,15 +1,15 @@
From a5060ec7126dd0c5ea6396bffc5a17ca54ba650b Mon Sep 17 00:00:00 2001
From 6ad2b5f736ba163164761a7ef91c718e52aaddfa Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Thu, 8 Sep 2016 08:48:33 -0700
Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index eae706368..bf5f1f0e8 100644
index c8698b2f6..3c888d601 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -178,7 +178,7 @@ public class EntityExperienceOrb extends Entity {
}
@@ -185,7 +185,7 @@ public class EntityExperienceOrb extends Entity {
}
if (this.value > 0) {
- entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value -> event.getAmount()
@ -18,7 +18,7 @@ index eae706368..bf5f1f0e8 100644
this.die();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ba7e5d181..87b4e9189 100644
index 2a7f89537..e32d7fdd1 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -46,6 +46,7 @@ import org.bukkit.entity.Player;
@ -29,7 +29,7 @@ index ba7e5d181..87b4e9189 100644
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.block.*;
@@ -656,6 +657,17 @@ public class CraftEventFactory {
@@ -661,6 +662,17 @@ public class CraftEventFactory {
return event;
}
@ -44,9 +44,9 @@ index ba7e5d181..87b4e9189 100644
+ }
+ // Paper end
+
public static boolean handleBlockGrowEvent(World world, int x, int y, int z, net.minecraft.server.Block type, int data) {
Block block = world.getWorld().getBlockAt(x, y, z);
CraftBlockState state = (CraftBlockState) block.getState();
public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData block) {
return handleBlockGrowEvent(world, pos, block, 3);
}
--
2.18.0

View File

@ -0,0 +1,25 @@
From 449f4ed9e6999fef7cb2a95bbde1eaba7894e946 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 2 Dec 2016 00:11:43 -0500
Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 3b2de1f31..0ba99bcbc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -273,6 +273,10 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
return this.getType(blockposition).isAir();
}
+ public boolean isLoaded(BlockPosition blockposition) {
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; // Paper
+ }
+
// Paper start
public Chunk getChunkIfLoaded(BlockPosition blockposition) {
return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
--
2.18.0

View File

@ -1,27 +1,27 @@
From 5f57f26f976b45cda5fcda4dffebc4981d748109 Mon Sep 17 00:00:00 2001
From 3ff34f57ccb9cc01fe8512784f15a6b2cefff8fb Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 16 Dec 2016 16:03:19 -0600
Subject: [PATCH] Don't let fishinghooks use portals
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c675a6e16..f71528b5f 100644
index 51b42933d..eb2a693af 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -144,7 +144,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
public boolean ah;
@@ -143,7 +143,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public boolean ak;
public boolean impulse;
public int portalCooldown;
- protected boolean ak;
+ protected boolean ak; public boolean inPortal() { return ak; } // Paper - OBFHELPER
protected int al;
- protected boolean an;
+ protected boolean an; public boolean inPortal() { return an; } // Paper - OBFHELPER
protected int ao;
public int dimension;
protected BlockPosition an;
protected BlockPosition aq;
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 339d1f1b1..7f011aef8 100644
index 866f41980..8630184d4 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -185,6 +185,12 @@ public class EntityFishingHook extends Entity {
@@ -190,6 +190,12 @@ public class EntityFishingHook extends Entity {
this.motY *= 0.92D;
this.motZ *= 0.92D;
this.setPosition(this.locX, this.locY, this.locZ);

View File

@ -1,18 +1,19 @@
From 14204e807bf59765b9126dceee7a62469db61a16 Mon Sep 17 00:00:00 2001
From 1fde28664611a9d358932373b047810dd1f48acd Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Fri, 16 Dec 2016 21:25:39 -0600
Subject: [PATCH] Add ProjectileCollideEvent
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 86836a5d0..8a9e16ad6 100644
index 75445b00d..4ab875a3d 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -190,6 +190,15 @@ public abstract class EntityArrow extends Entity implements IProjectile {
@@ -191,6 +191,16 @@ public abstract class EntityArrow extends Entity implements IProjectile {
}
}
+ // Paper start - Call ProjectileCollideEvent
+ // TODO: flag - noclip - call cancelled?
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
+ if (event.isCancelled()) {
@ -21,14 +22,14 @@ index 86836a5d0..8a9e16ad6 100644
+ }
+ // Paper end
+
if (movingobjectposition != null) {
if (movingobjectposition != null && !flag) {
this.a(movingobjectposition);
}
this.impulse = true;
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index 365e070f8..657b3b5ac 100644
index 3e3619d79..58cc4824c 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -70,6 +70,15 @@ public abstract class EntityFireball extends Entity {
@@ -68,6 +68,15 @@ public abstract class EntityFireball extends Entity {
++this.f;
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.f >= 25, this.shooter);
@ -45,10 +46,10 @@ index 365e070f8..657b3b5ac 100644
this.a(movingobjectposition);
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 7f011aef8..6ac89d1e3 100644
index 8630184d4..7440e4a2a 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -240,6 +240,16 @@ public class EntityFishingHook extends Entity {
@@ -245,6 +245,16 @@ public class EntityFishingHook extends Entity {
vec3d = new Vec3D(this.locX, this.locY, this.locZ);
vec3d1 = new Vec3D(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
@ -66,10 +67,10 @@ index 7f011aef8..6ac89d1e3 100644
vec3d1 = new Vec3D(movingobjectposition.pos.x, movingobjectposition.pos.y, movingobjectposition.pos.z);
}
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index cfcaf3832..01c7fcc8b 100644
index ee402d414..fc8c0cab5 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -160,6 +160,15 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
@@ -144,6 +144,15 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
movingobjectposition = new MovingObjectPosition(entity);
}
@ -83,13 +84,13 @@ index cfcaf3832..01c7fcc8b 100644
+ // Paper end
+
if (movingobjectposition != null) {
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) {
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.NETHER_PORTAL) {
this.e(movingobjectposition.a());
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 87b4e9189..06a277b3b 100644
index e32d7fdd1..3f9a66002 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -805,6 +805,16 @@ public class CraftEventFactory {
@@ -797,6 +797,16 @@ public class CraftEventFactory {
return CraftItemStack.asNMSCopy(bitem);
}

View File

@ -1,27 +0,0 @@
From 650f61273af6eb6f665ba0395293aaa4ce1eee97 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 23:54:20 -0400
Subject: [PATCH] Raise string limit for packet serialization
The default limit is possible to hit with 50 page books with color codes, causing clients to disconnect.
Bump the limit up a hair to above currently seen sizes.
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index a8fc7e431..c1273e988 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -300,8 +300,8 @@ public class PacketDataSerializer extends ByteBuf {
public PacketDataSerializer a(String s) {
byte[] abyte = s.getBytes(StandardCharsets.UTF_8);
- if (abyte.length > 32767) {
- throw new EncoderException("String too big (was " + abyte.length + " bytes encoded, max " + 32767 + ")");
+ if (abyte.length > 44767) { // Paper - raise limit a bit more as normal means can trigger this
+ throw new EncoderException("String too big (was " + s.length() + " bytes encoded, max " + 44767 + ")"); // Paper
} else {
this.d(abyte.length);
this.writeBytes(abyte);
--
2.18.0

View File

@ -1,36 +0,0 @@
From 3d7dc05a042dca4e664cbabe11769c6b80da55af Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Nov 2016 20:28:12 -0400
Subject: [PATCH] Don't load Chunks from Hoppers and other things
Hoppers call this to I guess "get the primary side" of a double sided chest.
If the double sided chest crosses chunk lines, it causes the chunk to load.
This will end up causing sync chunk loads, which will unload with Chunk GC,
only to be reloaded again the next tick.
This of course is undesirable, so just return the loaded side as "primary"
and treat it as a single chest if the other sides are unloaded
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
index bc398ec52..90267a1fb 100644
--- a/src/main/java/net/minecraft/server/BlockChest.java
+++ b/src/main/java/net/minecraft/server/BlockChest.java
@@ -339,7 +339,13 @@ public class BlockChest extends BlockTileEntity {
while (iterator.hasNext()) {
EnumDirection enumdirection = (EnumDirection) iterator.next();
BlockPosition blockposition1 = blockposition.shift(enumdirection);
- Block block = world.getType(blockposition1).getBlock();
+ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk
+ final IBlockData type = world.getTypeIfLoaded(blockposition1); // Paper
+ if (type == null) {
+ continue;
+ }
+ Block block = type.getBlock();
+ // Paper end
if (block == this) {
if (this.e(world, blockposition1)) {
--
2.18.0

View File

@ -1,22 +0,0 @@
From d3c90cc09b0a21f0ff27b57d39cff7634386b55f Mon Sep 17 00:00:00 2001
From: vemacs <d@nkmem.es>
Date: Wed, 23 Nov 2016 12:54:56 -0500
Subject: [PATCH] Optimize Network Queue
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5c09c6ff7..13c6b5ccd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -104,7 +104,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
private final GameProfileRepository X;
private final UserCache Y;
private long Z;
- protected final Queue<FutureTask<?>> j = new java.util.concurrent.ConcurrentLinkedQueue<FutureTask<?>>(); // Spigot, PAIL: Rename
+ protected final Queue<FutureTask<?>> j = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Spigot, PAIL: Rename // Paper - Make size() constant-time
private Thread serverThread;
private long ab = aw();
--
2.18.0

View File

@ -1,23 +0,0 @@
From 1ae942442cdb03e6bc32f33adafa4b0ab464e99f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 2 Dec 2016 00:11:43 -0500
Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 000d2eeb9..d7bf8378e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -290,7 +290,7 @@ public abstract class World implements IBlockAccess {
}
public boolean isLoaded(BlockPosition blockposition) {
- return this.a(blockposition, true);
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; // Paper
}
public boolean a(BlockPosition blockposition, boolean flag) {
--
2.18.0

@ -1 +1 @@
Subproject commit 1fccb8950186caae273e45f1b08ebe2797214293
Subproject commit b4bff6fc3d3f80a7e297624f5d9dbf3ec7d6f6aa