3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00

some more patches

Dieser Commit ist enthalten in:
Jake Potrebic 2023-09-21 20:29:51 -07:00
Ursprung 78a003ee89
Commit 2bc818efd4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
14 geänderte Dateien mit 94 neuen und 96 gelöschten Zeilen

Datei anzeigen

@ -59,7 +59,7 @@ index 6aaed8e8bf8c721fc834da5c76ac72a4c3e92458..4b002e8b75d117b726b0de274a76d359
// Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the
// bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay.
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 336795dff742b7c6957fbd3476aff31d25a5e659..30a58229aa6dac5039511d0c0df5f2912ea7de9f 100644
index d7995cadda8f48bbf642114935311180d3ebde5b..226cba0c1eeedd9e80acd603c46b802c183db1fa 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -230,6 +230,7 @@ public class CrashReport {
@ -71,10 +71,10 @@ index 336795dff742b7c6957fbd3476aff31d25a5e659..30a58229aa6dac5039511d0c0df5f291
cause = cause.getCause();
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697e22ecf48 100644
index 0fa1d9f299194ff660130a1cf33d9a405d56a842..d50878653132218dd494e0e5ed6fc3a32d4f1465 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -296,7 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -291,7 +291,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
public Commands vanillaCommandDispatcher;
@ -83,7 +83,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
// CraftBukkit end
// Spigot start
public static final int TPS = 20;
@@ -307,6 +307,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -302,6 +302,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
public static long currentTickLong = 0L; // Paper
@ -92,8 +92,8 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
+
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
@@ -883,6 +886,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Thread thread = new Thread(() -> {
@@ -858,6 +861,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
@ -101,7 +101,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -897,6 +901,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -872,6 +876,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -121,14 +121,13 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
// CraftBukkit end
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -953,7 +970,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper
@@ -955,6 +972,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Spigot end
+
+ // Paper start - move final shutdown items here
+ LOGGER.info("Flushing Chunk IO");
io.papermc.paper.chunk.system.io.RegionFileIOThread.close(true); // Paper // Paper - rewrite chunk system
+ // TODO chunk system patch has a line here
+ LOGGER.info("Closing Thread Pool");
+ Util.shutdownExecutors(); // Paper
+ LOGGER.info("Closing Server");
@ -141,7 +140,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
}
public String getLocalIp() {
@@ -1048,6 +1077,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1047,6 +1076,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() {
try {
@ -149,7 +148,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
@@ -1057,6 +1087,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1056,6 +1086,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
// Spigot start
@ -168,7 +167,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -1117,6 +1159,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1110,6 +1152,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
}
} catch (Throwable throwable) {
@ -181,7 +180,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
// Spigot Start
if ( throwable.getCause() != null )
@@ -1147,14 +1195,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1140,14 +1188,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.services.profileCache().clearExecutor();
}
@ -199,7 +198,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
}
}
@@ -1223,6 +1271,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1211,6 +1259,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public TickTask wrapRunnable(Runnable runnable) {
@ -212,7 +211,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
return new TickTask(this.tickCount, runnable);
}
@@ -1458,6 +1512,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1451,6 +1505,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
} catch (Throwable t) {
@ -220,7 +219,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
throw new RuntimeException("Error generating crash report", t);
}
// Spigot End
@@ -1958,7 +2013,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1964,7 +2019,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.worldData.setDataConfiguration(worlddataconfiguration);
this.resources.managers.updateRegistryTags(this.registryAccess());
@ -238,7 +237,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 56b17a1ce545ec43bf588d4ab438440fb829bc97..ba75c854faed13c60ae5464c4685373b99ef42c2 100644
index 6d2f49204e6a8fe8057a0c83f23adae3e1dbf00c..f72c1a4baff6ac9a3b1df83ece3925e2b1678df9 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -269,7 +269,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -260,7 +259,7 @@ index 56b17a1ce545ec43bf588d4ab438440fb829bc97..ba75c854faed13c60ae5464c4685373b
}
@Override
@@ -770,7 +771,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -748,7 +749,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public void stopServer() {
super.stopServer();
@ -270,10 +269,10 @@ index 56b17a1ce545ec43bf588d4ab438440fb829bc97..ba75c854faed13c60ae5464c4685373b
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5b8b345ade30012371bdda744ba82c585f74db07..0d100788312a234616c1401656f09835458e79f6 100644
index 89310108e94f3198c5f4ecd65e414a2c7af262cb..d1e5db7b0b260002198b1262f914d3c5a30cd2d9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -547,7 +547,7 @@ public abstract class PlayerList {
@@ -534,7 +534,7 @@ public abstract class PlayerList {
this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
@ -295,10 +294,10 @@ index f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb89
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7a1886585bd00dc8213ce22130b8b6fea52c5cf6..52a44510d0499df56d2ebef0963fe8164eda7301 100644
index 495ab82a3a9d47583eb7239730aa78dd51f16fc6..8b0c85d341c75e86421fc7c72aefcce83a165075 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -904,6 +904,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -896,6 +896,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try {
tickConsumer.accept(entity);
} catch (Throwable throwable) {
@ -307,10 +306,10 @@ index 7a1886585bd00dc8213ce22130b8b6fea52c5cf6..52a44510d0499df56d2ebef0963fe816
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index c3760f22fcc56ccb25e3315823054416c2172386..246606164117e8140ab0892ec1326503b414a1ab 100644
index f229838bf0566d61b2716463ff95fcc0b04d2e97..c9a6a56dfd25601bc0a11e5ddb349dba372c0e18 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1180,6 +1180,7 @@ public class LevelChunk extends ChunkAccess {
@@ -1091,6 +1091,7 @@ public class LevelChunk extends ChunkAccess {
gameprofilerfiller.pop();
} catch (Throwable throwable) {
@ -319,7 +318,7 @@ index c3760f22fcc56ccb25e3315823054416c2172386..246606164117e8140ab0892ec1326503
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 2badebc0d7954c6d343bfd66dd14dc2d2d4661d7..f847527bf22fa34817dee79e61a47545b1e1f7bc 100644
index 8c9a6e1b34865c3a15eea40637d6a4b540396a5c..c561677e81095ab6735d81a414a249838b135f7a 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -178,6 +178,36 @@ public class Main {
@ -471,18 +470,18 @@ index 14eadb0f81dfad072d82d7793cce1a4dd3f2c5f0..29b39dff0aceaa902f701162a42d3f2f
String[] split = restartScript.split( " " );
if ( split.length > 0 && new File( split[0] ).isFile() )
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..a9bd33b58a6a3296b70eaaaea3adbee74724e448 100644
index 06efdd7aa6d35a670e81c4f303618a7ba301396a..e71041d41eae31cce73d8817c4f95f16c8c600aa 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
public final class WatchdogThread extends io.papermc.paper.util.TickThread // Paper - rewrite chunk system
public class WatchdogThread extends Thread
{
+ public static final boolean DISABLE_WATCHDOG = Boolean.getBoolean("disable.watchdog"); // Paper
private static WatchdogThread instance;
private long timeoutTime;
private boolean restart;
@@ -39,6 +40,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -39,6 +40,7 @@ public class WatchdogThread extends Thread
{
if ( WatchdogThread.instance == null )
{
@ -490,7 +489,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..a9bd33b58a6a3296b70eaaaea3adbee7
WatchdogThread.instance = new WatchdogThread( timeoutTime * 1000L, restart );
WatchdogThread.instance.start();
} else
@@ -70,12 +72,13 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -70,12 +72,13 @@ public class WatchdogThread extends Thread
// Paper start
Logger log = Bukkit.getServer().getLogger();
long currentTime = WatchdogThread.monotonicMillis();
@ -507,7 +506,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..a9bd33b58a6a3296b70eaaaea3adbee7
lastEarlyWarning = currentTime;
if (isLongTimeout) {
// Paper end
@@ -137,9 +140,24 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -136,9 +139,24 @@ public class WatchdogThread extends Thread
if ( isLongTimeout )
{

Datei anzeigen

@ -7,7 +7,7 @@ Prevents pathfinding from spamming failures for things such as
arrow attacks.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 03cc97b13b1b8eb591b563c1eb52355b00ea3bf1..b376670d11088e524ce246f667e580e90cd119a3 100644
index 68edd488087a6ec1e65797cfbd4118bd0efbab50..b37415d45dda8e658c8995a4519e552dc378bb41 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -192,9 +192,29 @@ public abstract class PathNavigation {

Datei anzeigen

@ -8,19 +8,19 @@ is important because we clone chunk data after reading it for safety.
So, reduce the impact of the clone on GC.
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 64765dab6fed87ffdf4af197d8d5f28a04544db0..1d13bc15c56faa69699fb3ad39210233d6b6934d 100644
index 92095b494a0c4fb89b84f0b1c0376615d28e34ce..ad0251b73d21b36bf19e9aa649817b4da2d0a6b4 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -36,7 +36,7 @@ public class CompoundTag implements Tag {
if (i > 512) {
throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512");
} else {
- Map<String, Tag> map = Maps.newHashMap();
+ it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<String, Tag> map = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - reduce memory footprint of NBTTagCompound
@@ -46,7 +46,7 @@ public class CompoundTag implements Tag {
byte b;
while((b = CompoundTag.readNamedTagType(dataInput, nbtAccounter)) != 0) {
@@ -130,7 +130,7 @@ public class CompoundTag implements Tag {
private static CompoundTag loadCompound(DataInput input, NbtAccounter tracker) throws IOException {
tracker.accountBytes(48L);
- Map<String, Tag> map = Maps.newHashMap();
+ it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<String, Tag> map = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - reduce memory footprint of NBTTagCompound
byte b;
while((b = input.readByte()) != 0) {
@@ -167,7 +167,7 @@ public class CompoundTag implements Tag {
}
public CompoundTag() {
@ -29,7 +29,7 @@ index 64765dab6fed87ffdf4af197d8d5f28a04544db0..1d13bc15c56faa69699fb3ad39210233
}
@Override
@@ -449,8 +449,16 @@ public class CompoundTag implements Tag {
@@ -486,8 +486,16 @@ public class CompoundTag implements Tag {
@Override
public CompoundTag copy() {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent opening inventories when frozen
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c7d4341642df2fc847e139cf03992b13645afa3e..0e7f5d780d8c17a68a6d3cf98febad94f63e3f81 100644
index 3ebcbda84de7817ff1aab5cdac6566f9eb05f2dd..06d257ac2d307cdae1c3eeba50f133814c13b181 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -693,7 +693,7 @@ public class ServerPlayer extends Player {
@@ -652,7 +652,7 @@ public class ServerPlayer extends Player {
containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate;
}
// Paper end
@ -17,7 +17,7 @@ index c7d4341642df2fc847e139cf03992b13645afa3e..0e7f5d780d8c17a68a6d3cf98febad94
this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper
this.containerMenu = this.inventoryMenu;
}
@@ -1542,7 +1542,7 @@ public class ServerPlayer extends Player {
@@ -1501,7 +1501,7 @@ public class ServerPlayer extends Player {
} else {
// CraftBukkit start
this.containerMenu = container;
@ -27,7 +27,7 @@ index c7d4341642df2fc847e139cf03992b13645afa3e..0e7f5d780d8c17a68a6d3cf98febad94
this.initMenu(container);
return OptionalInt.of(this.containerCounter);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 552fb0be2f31bd52a5ae43526d55aa29828f786e..ec7ea1ef632bea761ca8b9603059a12fb72dfa47 100644
index aa131c233ee9d7926ca77e1afedd27baf7639423..872adf91703baa24d67f417e7a45309f92984da9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -325,7 +325,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {

Datei anzeigen

@ -12,10 +12,10 @@ The entity's current team collision rule causes them to NEVER collide.
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 11e84ea16177f11b834bcf13e9b36985ac4cfd4e..fe5995a79929fb46ae5d9d9056993a6e37b670e7 100644
index 4008d402b01d7ea25a56d16ebbf00e182b0d60c3..d8c337ae968f04af8870591da6c89dc25b5db311 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3370,10 +3370,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3399,10 +3399,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.level().isClientSide()) {
this.level().getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush);
} else {
@ -38,6 +38,6 @@ index 11e84ea16177f11b834bcf13e9b36985ac4cfd4e..fe5995a79929fb46ae5d9d9056993a6e
if (!list.isEmpty()) {
- int i = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
+ // Paper - moved up
int j;
if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) {
int j = 0;

Datei anzeigen

@ -87,10 +87,10 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0e7f5d780d8c17a68a6d3cf98febad94f63e3f81..f4a8491d6b6333030cecee3920da060d6b96a309 100644
index 06d257ac2d307cdae1c3eeba50f133814c13b181..77859358366eb51282bedf61c8b0094302548e2a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1949,9 +1949,24 @@ public class ServerPlayer extends Player {
@@ -1908,7 +1908,23 @@ public class ServerPlayer extends Player {
}
}
@ -108,18 +108,17 @@ index 0e7f5d780d8c17a68a6d3cf98febad94f63e3f81..f4a8491d6b6333030cecee3920da060d
+ return map;
+ }
+ // Paper end
public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
public void updateOptions(ServerboundClientInformationPacket packet) {
+ new com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent(getBukkitEntity(), getClientOptionMap(packet.language, packet.viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(packet.chatVisibility().name()), packet.chatColors(), new com.destroystokyo.paper.PaperSkinParts(packet.modelCustomisation()), packet.mainHand() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT, packet.allowsListing(), packet.textFilteringEnabled())).callEvent(); // Paper - settings event
+
public void updateOptions(ClientInformation clientOptions) {
+ new com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent(getBukkitEntity(), getClientOptionMap(clientOptions.language(), clientOptions.viewDistance(), com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(clientOptions.chatVisibility().name()), clientOptions.chatColors(), new com.destroystokyo.paper.PaperSkinParts(clientOptions.modelCustomisation()), clientOptions.mainHand() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT, clientOptions.allowsListing(), clientOptions.textFilteringEnabled())).callEvent(); // Paper - settings event
// CraftBukkit start
if (getMainArm() != packet.mainHand()) {
if (getMainArm() != clientOptions.mainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 08404472a89192fb0cbae0192793c4c4ae63a9bb..cb9482240de0d5d56be4ec591b4fbb23006767c1 100644
index 1fecbdbc382a47aa76bd562fb3cc0625b7807bfc..e28872e0f86a0106e4ea4e06d1ea8e41128de5c7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -602,6 +602,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -562,6 +562,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
}
}

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from
I suspect it deals with teleporting as it uses players current x/y/z
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index c716047fefb51a77ce18df243c517d80c78b6853..0a926afa06a5e37cf2650afa1b5099a2a9ffa659 100644
index f3c9a3dbb6f0e6f825b7477c89ed72ed52845419..2dbea6eef75ee90d62145ed855935bbc9996f15a 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
@@ -147,8 +147,8 @@ public abstract class DistanceManager {
@@ -285,8 +285,8 @@ public abstract class DistanceManager {
ObjectSet<ServerPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
if (objectset == null) return; // CraftBukkit - SPIGOT-6208
@ -20,4 +20,4 @@ index c716047fefb51a77ce18df243c517d80c78b6853..0a926afa06a5e37cf2650afa1b5099a2
+ if (objectset == null || objectset.isEmpty()) { // Paper
this.playersPerChunk.remove(i);
this.naturalSpawnChunkCounter.update(i, Integer.MAX_VALUE, false);
//this.playerTicketManager.update(i, Integer.MAX_VALUE, false); // Paper - no longer used
this.playerTicketManager.update(i, Integer.MAX_VALUE, false);

Datei anzeigen

@ -31,10 +31,10 @@ delays anymore.
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a8c4c7298e127e5b60a3b43ad168976d29901bc5..48586780da5d260894fe59efaa97cb1facfe73fe 100644
index b652019a5feffeeec2871011e2df0d609e1a7647..9cdebd7715fca949cc390684d044235d75b89c24 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1037,6 +1037,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1556,6 +1556,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+ ": " + entity + (this.entityMap.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""), new Throwable());
return;
}
@ -43,22 +43,22 @@ index a8c4c7298e127e5b60a3b43ad168976d29901bc5..48586780da5d260894fe59efaa97cb1f
if (!(entity instanceof EnderDragonPart)) {
EntityType<?> entitytypes = entity.getType();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f4a8491d6b6333030cecee3920da060d6b96a309..15a70bad66eb2508f58ff184061c2d19e45297e1 100644
index 77859358366eb51282bedf61c8b0094302548e2a..fcf875c6145c2428cab7a801442f34adc098b3ce 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -267,6 +267,7 @@ public class ServerPlayer extends Player {
@@ -265,6 +265,7 @@ public class ServerPlayer extends Player {
public double maxHealthCache;
public boolean joining = true;
public boolean sentListPacket = false;
+ public boolean supressTrackerForLogin = false; // Paper
public Integer clientViewDistance;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
public boolean isRealPlayer; // Paper
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131395815e6 100644
index d1e5db7b0b260002198b1262f914d3c5a30cd2d9..fdd518b5ea21ae617069fd03429712de4b44841b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -311,6 +311,12 @@ public abstract class PlayerList {
@@ -297,6 +297,12 @@ public abstract class PlayerList {
this.playersByUUID.put(player.getUUID(), player);
// this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer))); // CraftBukkit - replaced with loop below
@ -71,7 +71,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131
// CraftBukkit start
CraftPlayer bukkitPlayer = player.getBukkitEntity();
@@ -349,6 +355,8 @@ public abstract class PlayerList {
@@ -335,6 +341,8 @@ public abstract class PlayerList {
player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1)));
}
player.sentListPacket = true;
@ -80,7 +80,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131
// CraftBukkit end
player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
@@ -374,6 +382,11 @@ public abstract class PlayerList {
@@ -357,6 +365,11 @@ public abstract class PlayerList {
playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect));
}
@ -92,7 +92,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
// CraftBukkit start
@@ -422,6 +435,10 @@ public abstract class PlayerList {
@@ -405,6 +418,10 @@ public abstract class PlayerList {
}
}
@ -103,7 +103,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131
player.initInventoryMenu();
// CraftBukkit - Moved from above, added world
// Paper start - Add to collideRule team if needed
@@ -431,6 +448,7 @@ public abstract class PlayerList {
@@ -414,6 +431,7 @@ public abstract class PlayerList {
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end

Datei anzeigen

@ -7,10 +7,10 @@ The code following this has better support for null worlds to move
them back to the world spawn.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 70d1d664efa323cbb0c07fd5aa746122261b6bfa..d7cf9ca3a1002463b09ed709f3003d0528a3ff0b 100644
index 961213739ba810c6e39aca76a32d74bcf2a58ad3..d8f8ca63079eed7d97488f954d989e99ec4c054e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2319,9 +2319,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2275,9 +2275,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
bworld = server.getWorld(worldName);
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fe5995a79929fb46ae5d9d9056993a6e37b670e7..1cae4bcd7d5d310ead65342af063a4617d24c694 100644
index d8c337ae968f04af8870591da6c89dc25b5db311..29c5372f48211e86fa8cfbdea9e10025a4f310d1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2162,7 +2162,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2196,7 +2196,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {

Datei anzeigen

@ -17,10 +17,10 @@ index 668a7c3f36cdbe48e472cb810b27ae4ab39a65d6..d15e62da0307728a7c2be191a27f87da
private EntitySelector() {}
// Paper start
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..ab639cb2faaafaeb33be91bfe99ffad6d23088db 100644
index 658393f451e46a93c5665fe3c580aa395ace68d1..a40852acf5d175cc3a06bc17fb021c76f0c11a28 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -563,6 +563,7 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -568,6 +568,7 @@ public class Phantom extends FlyingMob implements Enemy {
Player entityhuman = (Player) iterator.next();
if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) {

Datei anzeigen

@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73eb4193a8 100644
index d8f8ca63079eed7d97488f954d989e99ec4c054e..f57d9a298a6e3be63c37ed7e14c99b154d372709 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2449,11 +2449,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2405,11 +2405,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else {
// CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
@ -34,9 +34,9 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73
entityitem.setDefaultPickUpDelay();
// CraftBukkit start
@@ -3227,6 +3228,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3211,6 +3212,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@Nullable
public Entity teleportTo(ServerLevel worldserver, PositionImpl location) {
public Entity teleportTo(ServerLevel worldserver, Vec3 location) {
// CraftBukkit end
+ // Paper start - fix bad state entities causing dupes
+ if (!this.isAlive() || !this.valid) {
@ -47,7 +47,7 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73
if (this.level() instanceof ServerLevel && !this.isRemoved()) {
this.level().getProfiler().push("changeDimension");
// CraftBukkit start
@@ -3253,6 +3260,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3237,6 +3244,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit end
this.level().getProfiler().popPush("reloading");
@ -59,7 +59,7 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73
Entity entity = this.getType().create(worldserver);
if (entity != null) {
@@ -3266,10 +3278,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3250,10 +3262,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity);
entity.bukkitEntity = this.getBukkitEntity();
@ -70,7 +70,7 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73
// CraftBukkit end
}
@@ -3390,7 +3398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3374,7 +3382,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean canChangeDimensions() {
@ -80,10 +80,10 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 1cae4bcd7d5d310ead65342af063a4617d24c694..3ec6243f831330a8096e209a00e0164dea2ef9d0 100644
index 29c5372f48211e86fa8cfbdea9e10025a4f310d1..a8f51cb5be994783eca8ff13eb172fd651deb05e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1678,9 +1678,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1711,9 +1711,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Paper start
org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource);
if (deathEvent == null || !deathEvent.isCancelled()) {
@ -96,7 +96,7 @@ index 1cae4bcd7d5d310ead65342af063a4617d24c694..3ec6243f831330a8096e209a00e0164d
// Paper start - clear equipment if event is not cancelled
if (this instanceof Mob) {
for (EquipmentSlot slot : this.clearedEquipmentSlots) {
@@ -1781,8 +1781,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1814,8 +1814,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.dropCustomDeathLoot(source, i, flag);
this.clearEquipmentSlots = prev; // Paper
}
@ -113,10 +113,10 @@ index 1cae4bcd7d5d310ead65342af063a4617d24c694..3ec6243f831330a8096e209a00e0164d
this.drops = new ArrayList<>();
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index a35a0952ce8e1fc42e92734786d531c7e10b34d7..498c6664fcfb028111031691348bfa2eb21d605b 100644
index 7eecbe85949e47b367014c04d7a37c2cbea80168..3d2d638da2d4b9c00f98477320b3300f36cff119 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -624,7 +624,7 @@ public class ArmorStand extends LivingEntity {
@@ -637,7 +637,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@ -125,7 +125,7 @@ index a35a0952ce8e1fc42e92734786d531c7e10b34d7..498c6664fcfb028111031691348bfa2e
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -632,7 +632,7 @@ public class ArmorStand extends LivingEntity {
@@ -645,7 +645,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@ -135,10 +135,10 @@ index a35a0952ce8e1fc42e92734786d531c7e10b34d7..498c6664fcfb028111031691348bfa2e
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ee7a7b80f96712830ea92daefb4454df70def170..81c77354a856956283fc149980a9a09e99b544f5 100644
index ceca2bccb4c36713cf15fb1d7cab0cbd3f31aff5..0b45481cdbbfbe4e1756e19e696e1c11d8fccd00 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -866,6 +866,11 @@ public class CraftEventFactory {
@@ -868,6 +868,11 @@ public class CraftEventFactory {
}
public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, List<org.bukkit.inventory.ItemStack> drops) {
@ -150,7 +150,7 @@ index ee7a7b80f96712830ea92daefb4454df70def170..81c77354a856956283fc149980a9a09e
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
populateFields(victim, event); // Paper - make cancellable
@@ -879,11 +884,13 @@ public class CraftEventFactory {
@@ -881,11 +886,13 @@ public class CraftEventFactory {
playDeathSound(victim, event);
// Paper end
victim.expToDrop = event.getDroppedExp();