Merge branch 'master' into pre/1.13

* master:
  Fix bug in last patch
  Ensure chunks are always loaded on hard position sets
  Improve Watchdog Early Warning Feature - Closes #1319
  Allow disabling armour stand ticking
This commit is contained in:
Aikar 2018-08-16 18:11:35 -04:00
commit 5302850894
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
14 changed files with 199 additions and 43 deletions

View file

@ -0,0 +1,35 @@
From 800083976a454caf39f0a2019df51e3af314b022 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 15 Aug 2018 01:26:03 -0700
Subject: [PATCH] Allow disabling armour stand ticking
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index 099da6ce..859f166f 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -275,5 +275,21 @@ public interface ArmorStand extends LivingEntity {
* @param move {@code true} if this armour stand can move, {@code false} otherwise
*/
void setCanMove(boolean move);
+
+ /**
+ * Tests if this armor stand can tick.
+ *
+ * <p>The default value is defined in {@code paper.yml}.</p>
+ *
+ * @return {@code true} if this armour stand can tick, {@code false} otherwise
+ */
+ boolean canTick();
+
+ /**
+ * Sets if this armor stand can tick.
+ *
+ * @param tick {@code true} if this armour stand can tick, {@code false} otherwise
+ */
+ void setCanTick(final boolean tick);
// Paper end
}
--
2.18.0

View file

@ -1,4 +1,4 @@
From a8ee859d2eaaefabf9f95aad32589825cfb68981 Mon Sep 17 00:00:00 2001
From 7ac4f5cdd7d311561825b74a6b6d229e84b68f2d Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 27 Jul 2018 22:36:17 -0500
Subject: [PATCH] SkeletonHorse Additions
@ -6,7 +6,7 @@ Subject: [PATCH] SkeletonHorse Additions
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
new file mode 100644
index 00000000..55bae018
index 000000000..55bae018e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
@@ -0,0 +1,43 @@
@ -54,7 +54,7 @@ index 00000000..55bae018
+}
+
diff --git a/src/main/java/org/bukkit/entity/SkeletonHorse.java b/src/main/java/org/bukkit/entity/SkeletonHorse.java
index b2c6b6a8..ba998346 100644
index b2c6b6a86..ba9983463 100644
--- a/src/main/java/org/bukkit/entity/SkeletonHorse.java
+++ b/src/main/java/org/bukkit/entity/SkeletonHorse.java
@@ -3,4 +3,12 @@ package org.bukkit.entity;

View file

@ -1,4 +1,4 @@
From c099f3364056fc23f1394a1cfcba17e229b1f082 Mon Sep 17 00:00:00 2001
From ef1b3e51447d82944f9f1b57d1656f6b0f8aca10 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 25 Jul 2018 01:36:07 -0400
Subject: [PATCH] Expand Location Manipulation API
@ -6,7 +6,7 @@ Subject: [PATCH] Expand Location Manipulation API
Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z);
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index d0d86e1a..253f0c2d 100644
index d0d86e1a4..253f0c2d5 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -503,6 +503,51 @@ public class Location implements Cloneable, ConfigurationSerializable {

View file

@ -1,4 +1,4 @@
From 5a23a70f98ba4d43a2a3ea02a6265bcbb5cb11c7 Mon Sep 17 00:00:00 2001
From 252df7b3e431a46b2c623727bb2b2e74671a7a07 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Thu, 26 Jul 2018 02:22:44 -0400
Subject: [PATCH] Expand ArmorStand API
@ -8,7 +8,7 @@ Add the following:
- Enable/Disable slot interactions
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index 099da6ce..7a8f4eb7 100644
index 859f166fb..4285f67fe 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -1,5 +1,6 @@
@ -44,10 +44,10 @@ index 099da6ce..7a8f4eb7 100644
void setItemInHand(ItemStack item);
/**
@@ -275,5 +286,67 @@ public interface ArmorStand extends LivingEntity {
* @param move {@code true} if this armour stand can move, {@code false} otherwise
@@ -291,5 +302,67 @@ public interface ArmorStand extends LivingEntity {
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise
*/
void setCanMove(boolean move);
void setCanTick(final boolean tick);
+
+ /**
+ * Returns the item the armor stand has

View file

@ -1,4 +1,4 @@
From 8a3a59da5ab19bd6129293e325dd0ba039947628 Mon Sep 17 00:00:00 2001
From 15b281e9cf37ea9d4b929f459664d0a731ad4f45 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 20 Jul 2018 23:36:55 -0500
Subject: [PATCH] AnvilDamageEvent
@ -6,7 +6,7 @@ Subject: [PATCH] AnvilDamageEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
new file mode 100644
index 00000000..fd3c5c02
index 000000000..fd3c5c02e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
@@ -0,0 +1,139 @@

View file

@ -1,11 +1,11 @@
From 71a62262e3b7a417bb316b0067d86744556662a4 Mon Sep 17 00:00:00 2001
From 67165721579587b8aa2da9db575fa501970e1bdb Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Thu, 2 Aug 2018 08:44:20 -0500
Subject: [PATCH] Add hand to bucket events
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
index 8fb121a9..7b9596f3 100644
index 8fb121a91..7b9596f30 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
@ -30,7 +30,7 @@ index 8fb121a9..7b9596f3 100644
public HandlerList getHandlers() {
return handlers;
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
index 56584687..3dbe428b 100644
index 56584687f..3dbe428ba 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
@ -82,7 +82,7 @@ index 56584687..3dbe428b 100644
return cancelled;
}
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
index 94e042a3..884b9240 100644
index 94e042a36..884b9240b 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
@ -107,5 +107,5 @@ index 94e042a3..884b9240 100644
public HandlerList getHandlers() {
return handlers;
--
2.11.0
2.18.0

View file

@ -1,4 +1,4 @@
From de75e8ea0d047e0bf404ca6131f2aa21c6d46cd5 Mon Sep 17 00:00:00 2001
From 1b88f97354ecb14699543f01215e47280d963f32 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Sun, 15 Jul 2018 22:17:55 +0300
Subject: [PATCH] Add TNTPrimeEvent
@ -6,7 +6,7 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
new file mode 100644
index 00000000..4f8d5d2d
index 000000000..4f8d5d2db
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
@@ -0,0 +1,108 @@

View file

@ -1,4 +1,4 @@
From 264867ed8aaad89877a3934ff8c8bcd6e226f3ef Mon Sep 17 00:00:00 2001
From 3db6552e5028e2772b82d8eed338b5819f65f4ad Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 4 Aug 2018 19:37:35 -0400
Subject: [PATCH] Provide Chunk Coordinates as a Long API
@ -7,7 +7,7 @@ Allows you to easily access the chunks X/z as a long, and a method
to look up by the long key too.
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
index 079b9feb..c75bce07 100644
index 079b9febe..c75bce07a 100644
--- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java
@@ -23,6 +23,15 @@ public interface Chunk {
@ -27,7 +27,7 @@ index 079b9feb..c75bce07 100644
* Gets the world containing this chunk
*
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index b8381d2e..73825a37 100644
index a9054d8f5..53517dab1 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -137,6 +137,21 @@ public interface World extends PluginMessageRecipient, Metadatable {

View file

@ -1,4 +1,4 @@
From de1ddd9370ca64acffbc01d5346ccc1ec13d720d Mon Sep 17 00:00:00 2001
From 72a734adf9e87b7f06a82916aca7b02c09020ffc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 10 Aug 2018 22:08:34 -0400
Subject: [PATCH] Make EnderDragon extend Mob

View file

@ -1,4 +1,4 @@
From cf321e2bc3a1fdb44194e62e0976849571f04387 Mon Sep 17 00:00:00 2001
From be69af0fbbb28f65f3bbbc30ab647010cf0bc0d4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 15 Aug 2018 01:04:58 -0400
Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots

View file

@ -1,4 +1,4 @@
From 65a6244ec0d4bddeda62628e2edc621f0f448ed9 Mon Sep 17 00:00:00 2001
From 33e6d2fc56ffb361eafe4a240cad4529d548b7e8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 15 Aug 2018 01:19:37 -0400
Subject: [PATCH] Don't use snapshots for Timings Tile Entity reports

View file

@ -1,4 +1,4 @@
From b232efe9bd3523537d680cca1176dc07cc4adc8c Mon Sep 17 00:00:00 2001
From 28c2b63fee54568b70849d02503af0f619c70fc1 Mon Sep 17 00:00:00 2001
From: miclebrick <miclebrick@outlook.com>
Date: Wed, 8 Aug 2018 15:30:52 -0400
Subject: [PATCH] Add Early Warning Feature to WatchDog
@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash.
This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 046bf33f66..8f12ad850b 100644
index 046bf33f66..b23d45f7df 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -24,6 +24,8 @@ import org.bukkit.configuration.InvalidConfigurationException;
@ -21,11 +21,10 @@ index 046bf33f66..8f12ad850b 100644
public class PaperConfig {
@@ -341,4 +343,12 @@ public class PaperConfig {
@@ -328,6 +330,14 @@ public class PaperConfig {
}
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
}
+
+ public static int watchdogPrintEarlyWarningEvery = 5000;
+ public static int watchdogPrintEarlyWarningDelay = 10000;
+ private static void watchdogEarlyWarning() {
@ -33,16 +32,19 @@ index 046bf33f66..8f12ad850b 100644
+ watchdogPrintEarlyWarningDelay = getInt("settings.watchdog.early-warning-delay", 10000);
+ WatchdogThread.doStart(SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash );
+ }
}
+
public static int tabSpamIncrement = 2;
public static int tabSpamLimit = 500;
private static void tabSpamLimiters() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 74c97b5db6..da2e84c6b8 100644
index 74c97b5db6..5fdd65b083 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -768,6 +768,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.a(this.n);
// Spigot start
+ org.spigotmc.WatchdogThread.hasStarted = true;
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop
while (this.isRunning) {
@ -60,7 +62,7 @@ index 4ac0ab9974..0c45d75adf 100644
public static boolean bungee;
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 57a4748a30..2aff1039ad 100644
index 57a4748a30..ac6aeb875a 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -5,6 +5,7 @@ import java.lang.management.MonitorInfo;
@ -91,17 +93,18 @@ index 57a4748a30..2aff1039ad 100644
}
public static void doStart(int timeoutTime, boolean restart)
@@ -52,9 +59,19 @@ public class WatchdogThread extends Thread
@@ -51,10 +58,19 @@ public class WatchdogThread extends Thread
{
while ( !stopping )
{
//
- //
- if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable
+ long currentTime = System.currentTimeMillis(); // Paper - do we REALLY need to call this method multiple times?
+ if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") ) // Paper - Add property to disable and short timeout
+ // Paper start
+ long currentTime = System.currentTimeMillis();
+ if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") )
{
+ // Paper start
+ boolean isLongTimeout = currentTime > lastTick + timeoutTime;
+ // Don't spam short dumps
+ // Don't spam early warning dumps
+ if ( !isLongTimeout && (earlyWarningEvery <= 0 || !hasStarted || currentTime < lastEarlyWarning + earlyWarningEvery || currentTime < lastTick + earlyWarningDelay)) continue;
+ lastEarlyWarning = currentTime;
+ // Paper end
@ -112,13 +115,14 @@ index 57a4748a30..2aff1039ad 100644
log.log( Level.SEVERE, "The server has stopped responding!" );
log.log( Level.SEVERE, "Please report this to https://github.com/PaperMC/Paper/issues" );
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
@@ -79,11 +96,19 @@ public class WatchdogThread extends Thread
@@ -79,29 +95,45 @@ public class WatchdogThread extends Thread
}
}
// Paper end
+ } else
+ {
+ log.log( Level.SEVERE, "The server has not responded for " + earlyWarningEvery / 1000 + " seconds! Creating thread dump");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
+ }
+ // Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
@ -132,9 +136,21 @@ index 57a4748a30..2aff1039ad 100644
log.log( Level.SEVERE, "Entire Thread Dump:" );
ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true );
for ( ThreadInfo thread : threads )
@@ -97,11 +122,12 @@ public class WatchdogThread extends Thread
{
dumpThread( thread, log );
}
+ } else {
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ }
+
+
log.log( Level.SEVERE, "------------------------------" );
if ( restart )
{
RestartCommand.restart();
}
+ if (isLongTimeout) {
break;
+ } // Paper end
}

View file

@ -0,0 +1,72 @@
From 8088becc75a9d4d1ef01cbf85ff0445d06cf0215 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 15 Aug 2018 01:26:09 -0700
Subject: [PATCH] Allow disabling armour stand ticking
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 61c8b58b16..458baf4442 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -483,4 +483,10 @@ public class PaperWorldConfig {
allowPermaChunkLoaders = getBoolean("game-mechanics.allow-permanent-chunk-loaders", allowPermaChunkLoaders);
log("Allow Perma Chunk Loaders: " + (allowPermaChunkLoaders ? "enabled" : "disabled"));
}
+
+ public boolean armorStandTick = true;
+ private void armorStandTick() {
+ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
+ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 3b2b94d8c6..7edeb9bb0e 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -45,6 +45,7 @@ public class EntityArmorStand extends EntityLiving {
public Vector3f leftLegPose;
public Vector3f rightLegPose;
public boolean canMove = true; // Paper
+ public boolean canTick = true; // Paper - armour stand ticking
public EntityArmorStand(World world) {
super(EntityTypes.ARMOR_STAND, world);
@@ -57,6 +58,7 @@ public class EntityArmorStand extends EntityLiving {
this.leftLegPose = EntityArmorStand.bB;
this.rightLegPose = EntityArmorStand.bC;
this.noclip = this.isNoGravity();
+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking
this.setSize(0.5F, 1.975F);
this.Q = 0.0F;
}
@@ -554,6 +556,7 @@ public class EntityArmorStand extends EntityLiving {
}
public void tick() {
+ if (!this.canTick) return;// Paper
super.tick();
Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.b);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 9f5c3b92e3..07ce93f17c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -297,5 +297,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) {
return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
}
+
+ @Override
+ public boolean canTick() {
+ return this.getHandle().canTick;
+ }
+
+ @Override
+ public void setCanTick(final boolean tick) {
+ this.getHandle().canTick = tick;
+ }
// Paper end
}
--
2.18.0

View file

@ -0,0 +1,33 @@
From ee27ea20d00895926b5fe61aad162123283de3e4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 16 Aug 2018 17:36:41 -0400
Subject: [PATCH] Ensure chunks are always loaded on hard position sets
Player Movement, Entity Creation and Teleportation move
entities with a very "You are here, no debate" change, making
the server register them as there, regardless if that chunk was
loaded or not.
It appears possible that with hack clients and lag, a player
may be able to move fast enough to move into an unloaded
chunk and get into a buggy state.
To prevent this, we will ensure a chunk is always loaded,
guaranteeing that the entity will be properly registered
into its new home comfortably.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ce33cd5b83..41a951d580 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1367,6 +1367,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.lastYaw -= 360.0F;
}
+ world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // Paper - ensure chunk is always loaded
this.setPosition(this.locX, this.locY, this.locZ);
this.setYawPitch(f, f1);
}
--
2.18.0