Updated Upstream (Paper & Tuinity)

Upstream has released updates that appears to apply and compile correctly

Paper Changes:
54890033 [Auto] Updated Upstream (CraftBukkit)
f96c6f5c [Auto] Updated Upstream (CraftBukkit)
4be8312f [CI-SKIP] [Auto] Rebuild Patches
43e5174a Fix Entity Teleportation and cancel velocity if teleported (#4210)
0fb3daf4 [Auto] Updated Upstream (CraftBukkit)
819ff324 Use wrapped StructureManager to prevent worldgen deadlock
507f302c Fix Zombie ShouldBurnInDay API (#4268)
ef5af6f6 [Auto] Updated Upstream (CraftBukkit)
101b0110 [Auto] Updated Upstream (Bukkit/CraftBukkit)
03689cf9 Fix javadoc (#4276)
c247857f Cache block data strings
ce2eae5c [Auto] Updated Upstream (Bukkit/CraftBukkit)
563f77ad install remapped server jar to paper package space
1ab021dd Updated Upstream (Bukkit/CraftBukkit)
c970f880 Properly pass the close reason for new inventory opens (#2658) (#4247)
07bca94f Create HoverEvent from ItemStack Entity
da33f8bb Add a way to get translation keys for blocks, entities and materials
5a20cbd7 Add more Evoker API
7a3e2520 [Auto] Updated Upstream (CraftBukkit)
b0cbebdc Fix build conflicts
dfc54a8b Add zombie targets turtle egg config (#4181)
0fe00f61 Add BellRingEvent for village bells (#2230)
414e5e1d fix #4144 (#4170)
5c7f3fc0 Fix PersistentDataContainer contract violation (_->!null returns null) (#3990)
65dbf5ff [CI-SKIP] [Auto] Rebuild Patches
7ed0f7f0 Fix NPE in getBedSpawnLocation (#4238)
9e0f1101 [CI-SKIP] Add issue template
6c138412 Fix CraftTeam null check (#4249)
32e45448 Update Paperclip
b84a37b7 Update Armor items in PlayerArmorChangeEvent (#4243)
a67abf5b Increase visibility of a few methods
7d69214b [Auto] Updated Upstream (CraftBukkit)
cbfc2362 PortalCreateEvent needs to know its entity
29032edb Fix PersistentDataContainer contract violation (_->!null returns null)
f42c53df [CI-SKIP] [Auto] Rebuild Patches
3efe45f5 Port Eigencraft to 1.16
0bad6958 Make engine-mode 2 truly random
cd06ca5e Updated Upstream (CraftBukkit)
ef36b4f8 Fix TNT not pushing creative players
915fe522 Fix hex colors not working in some kick messages
f5904171 [Auto] Updated Upstream (Bukkit/CraftBukkit)
757948dc [Auto] Updated Upstream (CraftBukkit)
0893de14 Fix reading the brand message from clients
243d2313 Updated Upstream (Bukkit/CraftBukkit)
4cc7de6c Add playPickupItemAnimation to LivingEntity
20fc1b5c [Auto] Updated Upstream (CraftBukkit/Spigot)
655258b3 [Auto] Updated Upstream (CraftBukkit)
167b1db6 Fix some modded clients getting kicked for invalid payload - Fixes #4201
7f0786cd Fix enderdragon tracking range to honor vanilla
586073c3 [CI-SKIP] Update README.md (for 1.16.2) (#4202)
853f4168 Remove debug
4d7ea429 fix config option in last commit
74d27463 Buffer joins to world
ac96307b [CI-SKIP] switch back to trusty now we figured out the issue
c97ce029 1.16.2 Release (#4123)
5486b3db Fix javadocs failing jenkins builds (#4189)
1330eb5f Brand support
b8372fc0 Improve handling of indestructable blocks
a2a06640 Add moon phase API
47f71aea Fix SpawnChangeEvent not firing for all use-cases
b6c860f2 Don't require FACING data
0c1716a1 Add #setMaxPlayers API
02aed275 [CI-SKIP] Require dependencies script (#4172)
1ccc1c67 Add smithing item helpers
627f4b85 Brand support
20d9ec6b Fix MC-197271
e9287056 [CI-SKIP] Update issue templates with notices
dccaf59a MC-197883: Bandaid decode issue
99a1e58f Merge branch 'master' into progress/1.16.2
ecbc5ca0 Updated Upstream (CraftBukkit)
99362d3c Decomp fix
5f9861a0 Fix MC-197883 by specifying the typeKey
1d8c9c23 [CI-SKIP] Make checkoutpr.sh use $SHELL (#4167)
2b1ca210 update checkout-pr to latest I use
95c9b45d Fix IDE Debug JVM Flag 2 (#4141)
9e6d742c Merge remote-tracking branch 'origin/master' into progress/1.16.2
c8542f23 Fix MC-99259 Wither Boss Bar doesn't update until invulnerability period is over (#4164)
862b8c18 Updated Upstream (Bukkit/CraftBukkit)
100d51eb Do not obfuscate air (#4149)
47740f67 Updated Upstream (CraftBukkit)
948c20e0 Merge remote-tracking branch 'origin/master' into progress/1.16.2
1daafe45 Updated Upstream (Bukkit/CraftBukkit)
98828b00 Merge pull request #4132 from Proximyst/progress/1.16.2
b23f27f8  Fix incorrect return for WorldServer#addAllEntitiesSafely (#3)
5085fa30 Fix MC-187716 Use configured height
c44add5a Initialise a new chunk section if none was found yet updated
74a4d5f8 Remove armour stand double add to world
6d25cc4e Don't mark null chunk sections for block updates
1ba2f214 Updated Upstream (Bukkit/CraftBukkit)
d29d5aaa Fix anti xray
ce6bbaa4 Import fastutil classes patch
9d4616a4 Updated Upstream (Bukkit/CraftBukkit)
109d072b Fix test, add strider mob goal and fix piglin goals
e6caaa20 Fix running; forgot to push this
ee7dce8b Add this to SHIT_TO_CHECK.md aswell
d378257c Fix IDE debug JVM flag for 1.16.2
0d8db446 Merge pull request #4112 from BillyGalbreath/progress/1.16.2
d319d8c4 It compiles!
8f8371c5 Add an OBFHELPER
9caa8e9f missed this
3ce5a5d7 volatile
159eb2e1 Oopsies
7eb08d2f Almost ready
7ca11e97 Current progress on 1.16.2

Tuinity Changes:
eaa6b50 Fix missing block property portal crash
fea5fbd Retain vanilla behavior for error correction rules in collisions
9eb1a3e Do not add a delayed unload ticket for some ticket types
This commit is contained in:
William Blake Galbreath
2020-09-09 07:01:21 -05:00
parent 7ae2890175
commit de30a3e5e2
156 changed files with 834 additions and 2056 deletions

View File

@@ -1,302 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 8 Aug 2019 15:29:15 -0500
Subject: [PATCH] AFK API
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index ce4ebc96c..eb62555cb 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -84,6 +84,15 @@ public abstract class EntityHuman extends EntityLiving {
}
// CraftBukkit end
+ // Purpur start
+ public void setAfk(boolean setAfk){
+ }
+
+ public boolean isAfk() {
+ return false;
+ }
+ // Purpur end
+
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.bL = ItemStack.b;
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index a947aabfc..8638d4622 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1718,8 +1718,54 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void resetIdleTimer() {
this.ca = SystemUtils.getMonotonicMillis();
+ setAfk(false); // Purpur
}
+ // Purpur start
+ private boolean isAfk = false;
+
+ @Override
+ public void setAfk(boolean setAfk) {
+ if (this.isAfk == setAfk) {
+ return;
+ }
+
+ String msg = setAfk ? net.pl3x.purpur.PurpurConfig.afkBroadcastAway : net.pl3x.purpur.PurpurConfig.afkBroadcastBack;
+
+ net.pl3x.purpur.event.PlayerAFKEvent event = new net.pl3x.purpur.event.PlayerAFKEvent(getBukkitEntity(), setAfk, world.purpurConfig.idleTimeoutKick, msg, !Bukkit.isPrimaryThread());
+ if (!event.callEvent() || event.shouldKick()) {
+ return;
+ }
+
+ this.isAfk = setAfk;
+
+ if (!setAfk) {
+ resetIdleTimer();
+ }
+
+ msg = event.getBroadcastMsg();
+ if (msg != null && !msg.isEmpty()) {
+ server.getPlayerList().sendAll(new PacketPlayOutChat(new ChatMessage(msg, getScoreboardDisplayName()), ChatMessageType.SYSTEM, SystemUtils.getNullUUID()));
+ }
+
+ if (world.purpurConfig.idleTimeoutUpdateTabList) {
+ getBukkitEntity().setPlayerListName((setAfk ? net.pl3x.purpur.PurpurConfig.afkTabListPrefix : "") + getName());
+ }
+
+ ((WorldServer) world).everyoneSleeping();
+ }
+
+ @Override
+ public boolean isAfk() {
+ return isAfk;
+ }
+
+ @Override
+ public boolean isCollidable() {
+ return !isAfk() && super.isCollidable();
+ }
+ // Purpur end
+
public ServerStatisticManager getStatisticManager() {
return this.serverStatisticManager;
}
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
index 882b82d89..90c37e4a8 100644
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
@@ -149,28 +149,18 @@ public interface IEntityAccess {
}
// Paper end
- default boolean isPlayerNearby(double d0, double d1, double d2, double d3) {
- Iterator iterator = this.getPlayers().iterator();
-
- double d4;
-
- do {
- EntityHuman entityhuman;
-
- do {
- do {
- if (!iterator.hasNext()) {
- return false;
- }
-
- entityhuman = (EntityHuman) iterator.next();
- } while (!IEntitySelector.g.test(entityhuman));
- } while (!IEntitySelector.b.test(entityhuman));
-
- d4 = entityhuman.h(d0, d1, d2);
- } while (d3 >= 0.0D && d4 >= d3 * d3);
-
- return true;
+ // Purpur start
+ default boolean isPlayerNearby(double x, double y, double z, double distance) {
+ double distanceSq = distance * distance;
+ for (EntityHuman player : getPlayers()) {
+ if (IEntitySelector.notSpectator().test(player) && IEntitySelector.isLivingAlive().test(player) && IEntitySelector.notAfk.test(player)) {
+ if (distance < 0.0D || player.getDistanceSquared(x, y, z) < distanceSq) {
+ return true;
+ }
+ }
+ }
+ return false;
+ // Purpur end
}
@Nullable
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
index 06ce390b6..939535cb2 100644
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -7,6 +7,7 @@ import javax.annotation.Nullable;
public final class IEntitySelector {
public static final Predicate<Entity> a = Entity::isAlive;
+ public static Predicate<EntityLiving> isLivingAlive() { return b; } // Purpur - OBFHELPER
public static final Predicate<EntityLiving> b = EntityLiving::isAlive;
public static final Predicate<Entity> c = (entity) -> {
return entity.isAlive() && !entity.isVehicle() && !entity.isPassenger();
@@ -27,6 +28,7 @@ public final class IEntitySelector {
return !entity.isSpectator();
};
public static Predicate<EntityHuman> isInsomniac = (player) -> MathHelper.clamp(((EntityPlayer) player).getStatisticManager().getStatisticValue(StatisticList.CUSTOM.get(StatisticList.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper
+ public static Predicate<EntityHuman> notAfk = (player) -> !player.isAfk(); // Purpur
// Paper start
public static final Predicate<Entity> affectsSpawning = (entity) -> {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index b44038534..1fa4f0c9d 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -235,6 +235,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
if (this.player.F() > 0L && this.minecraftServer.getIdleTimeout() > 0 && SystemUtils.getMonotonicMillis() - this.player.F() > (long) (this.minecraftServer.getIdleTimeout() * 1000 * 60)) {
+ // Purpur start
+ this.player.setAfk(true);
+ if (!this.player.world.purpurConfig.idleTimeoutKick) {
+ return;
+ }
+ // Purpur end
this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854
this.disconnect(new ChatMessage("multiplayer.disconnect.idling"));
}
@@ -458,6 +464,8 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
+ if (!to.getWorld().getUID().equals(from.getWorld().getUID()) || to.getBlockX() != from.getBlockX() || to.getBlockY() != from.getBlockY() || to.getBlockZ() != from.getBlockZ() || to.getYaw() != from.getYaw() || to.getPitch() != from.getPitch()) this.player.resetIdleTimer(); // Purpur
+
// Skip the first time we do this
if (true) { // Spigot - don't skip any move events
Location oldTo = to.clone();
@@ -1126,7 +1134,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (!this.player.H() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR) { // Spigot
flag1 = true;
- PlayerConnection.LOGGER.warn("{} moved wrongly!", this.player.getDisplayName().getString());
+ PlayerConnection.LOGGER.warn("{} moved wrongly! ({})", this.player.getDisplayName().getString(), d11); // Purpur
}
this.player.setLocation(d4, d5, d6, f, f1);
@@ -1165,6 +1173,8 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
+ if (!to.getWorld().getUID().equals(from.getWorld().getUID()) || to.getBlockX() != from.getBlockX() || to.getBlockY() != from.getBlockY() || to.getBlockZ() != from.getBlockZ() || to.getYaw() != from.getYaw() || to.getPitch() != from.getPitch()) this.player.resetIdleTimer(); // Purpur
+
// Skip the first time we do this
if (from.getX() != Double.MAX_VALUE) {
Location oldTo = to.clone();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 14318d046..ebf78f2cc 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -843,7 +843,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit end
if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
- return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit
+ return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping && !(purpurConfig.idleTimeoutCountAsSleeping && entityplayer.isAfk()); // CraftBukkit // Purpur
})) {
// CraftBukkit start
long l = this.worldData.getDayTime() + 24000L;
@@ -1176,7 +1176,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- if (entityplayer.isSpectator() || (entityplayer.fauxSleeping && !entityplayer.isSleeping())) { // CraftBukkit
+ if (entityplayer.isSpectator() || (entityplayer.fauxSleeping && !entityplayer.isSleeping()) || (purpurConfig.idleTimeoutCountAsSleeping && entityplayer.isAfk())) { // CraftBukkit // Purpur
++i;
} else if (entityplayer.isSleeping()) {
++j;
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 803a7ff92..d699a9168 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -1,6 +1,7 @@
package net.pl3x.purpur;
import com.google.common.base.Throwables;
+import net.minecraft.server.LocaleLanguage;
import net.minecraft.server.MinecraftServer;
import net.pl3x.purpur.command.PurpurCommand;
import org.bukkit.Bukkit;
@@ -129,6 +130,15 @@ public class PurpurConfig {
return config.getString(path, config.getString(path));
}
+ public static String afkBroadcastAway = "§e§o%s is now AFK";
+ public static String afkBroadcastBack = "§e§o%s is no longer AFK";
+ public static String afkTabListPrefix = "[AFK] ";
+ private static void messages() {
+ afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
+ afkBroadcastBack = getString("settings.messages.afk-broadcast-back", afkBroadcastBack);
+ afkTabListPrefix = getString("settings.messages.afk-tab-list-prefix", afkTabListPrefix);
+ }
+
public static String timingsUrl = "https://timings.pl3x.net";
private static void timingsSettings() {
timingsUrl = getString("settings.timings.url", timingsUrl);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 361f7857e..2578a4677 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -56,4 +56,15 @@ public class PurpurWorldConfig {
PurpurConfig.config.addDefault("world-settings.default." + path, def);
return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path));
}
+
+ public boolean idleTimeoutKick = true;
+ public boolean idleTimeoutTickNearbyEntities = true;
+ public boolean idleTimeoutCountAsSleeping = false;
+ public boolean idleTimeoutUpdateTabList = false;
+ private void playerIdleTimeoutSettings() {
+ idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick);
+ idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities);
+ idleTimeoutCountAsSleeping = getBoolean("gameplay-mechanics.player.idle-timeout.count-as-sleeping", idleTimeoutCountAsSleeping);
+ idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList);
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 32856f744..de4d6fb56 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2155,4 +2155,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return spigot;
}
// Spigot end
+
+ // Purpur start
+ @Override
+ public boolean isAfk() {
+ return getHandle().isAfk();
+ }
+
+ @Override
+ public void setAfk(boolean setAfk) {
+ getHandle().setAfk(setAfk);
+ }
+
+ @Override
+ public void resetIdleTimer() {
+ getHandle().resetIdleTimer();
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 37e930e0c..89dc611cd 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -207,6 +207,7 @@ public class ActivationRange
{
player.activatedTick = MinecraftServer.currentTick;
+ if (!player.world.purpurConfig.idleTimeoutTickNearbyEntities && player.isAfk()) continue; // Purpur
maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange );
ActivationType.MISC.boundingBox = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange );
ActivationType.RAIDER.boundingBox = player.getBoundingBox().grow( raiderActivationRange, 256, raiderActivationRange );