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 0f8bab7109
11 changed files with 177 additions and 27 deletions

View file

@ -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 +0,0 @@

View file

@ -5,7 +5,7 @@ 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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;

View file

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
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
@@ -0,0 +0,0 @@ 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
}
--

View file

@ -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 +0,0 @@

View file

@ -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
@@ -0,0 +0,0 @@
@ -45,9 +45,9 @@ index 099da6ce..7a8f4eb7 100644
/**
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
* @param move {@code true} if this armour stand can move, {@code false} otherwise
* @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

@ -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
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {

View file

@ -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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {

View file

@ -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 +0,0 @@
@ -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
@@ -0,0 +0,0 @@ package org.bukkit.entity;

View file

@ -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
@@ -0,0 +0,0 @@ import org.bukkit.configuration.InvalidConfigurationException;
@ -23,9 +23,8 @@ index 046bf33f66..8f12ad850b 100644
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ import java.lang.management.MonitorInfo;
@ -92,16 +94,17 @@ index 57a4748a30..2aff1039ad 100644
public static void doStart(int timeoutTime, boolean restart)
@@ -0,0 +0,0 @@ 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
@ -118,7 +121,8 @@ index 57a4748a30..2aff1039ad 100644
// 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 )
@@ -0,0 +0,0 @@ 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,70 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Riley Park <rileysebastianpark@gmail.com>
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
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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;
}
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ 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
}
--

View file

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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);
}
--