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

[ci skip] add more comments & move 1 hunk to correct patch

Dieser Commit ist enthalten in:
Jake Potrebic 2024-01-13 12:31:02 -08:00
Ursprung c0e4697dbd
Commit 17275ffd68
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
24 geänderte Dateien mit 201 neuen und 214 gelöschten Zeilen

Datei anzeigen

@ -1390,7 +1390,7 @@ index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..071d3877e386a0c7c4d2f2e8ddd06e0765c49d0d index 0000000000000000000000000000000000000000..385ca2c1022e0985550a5cc2bbff953f1aa33f5c
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,548 @@ @@ -0,0 +1,548 @@
@ -4814,17 +4814,17 @@ index 0000000000000000000000000000000000000000..614aba60bb07946a144650fd3aedb316
+ protected abstract boolean belowZero(O value); + protected abstract boolean belowZero(O value);
+} +}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 6b0a1ff870e013a83f7922021ab296bb1c716079..f3130afbfd70e39a8000b0471854f8ef892bbbf5 100644 index 6b0a1ff870e013a83f7922021ab296bb1c716079..403c57fc683bb0497602e1a9ec7b81b2722ecc01 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -137,6 +137,10 @@ public class Main { @@ -137,6 +137,10 @@ public class Main {
dedicatedserversettings.forceSave(); dedicatedserversettings.forceSave();
Path path2 = Paths.get("eula.txt"); Path path2 = Paths.get("eula.txt");
Eula eula = new Eula(path2); Eula eula = new Eula(path2);
+ // Paper start - load config files for access below if needed + // Paper start - load config files early for access below if needed
+ org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings")); + org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
+ org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings")); + org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
+ // Paper end + // Paper end - load config files early for access below if needed
if (optionset.has("initSettings")) { // CraftBukkit if (optionset.has("initSettings")) { // CraftBukkit
// CraftBukkit start - SPIGOT-5761: Create bukkit.yml and commands.yml if not present // CraftBukkit start - SPIGOT-5761: Create bukkit.yml and commands.yml if not present
@ -4833,19 +4833,19 @@ index 6b0a1ff870e013a83f7922021ab296bb1c716079..f3130afbfd70e39a8000b0471854f8ef
File file = (File) optionset.valueOf("universe"); // CraftBukkit File file = (File) optionset.valueOf("universe"); // CraftBukkit
- Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file); - Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file);
+ Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper + Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper - pass OptionSet to load paper config files
// CraftBukkit start // CraftBukkit start
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8cc3fd73eaa41b87c63cf26e299affca16f20d87..afd39623d2c2e9270510a6a83b5918392442744d 100644 index 8cc3fd73eaa41b87c63cf26e299affca16f20d87..7193029f1f8b5db7d94306e7dd07c5053795533c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private static final int SAMPLE_INTERVAL = 100; private static final int SAMPLE_INTERVAL = 100;
public final double[] recentTps = new double[ 3 ]; public final double[] recentTps = new double[ 3 ];
// Spigot end // Spigot end
+ public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; + public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) { public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference(); AtomicReference<S> atomicreference = new AtomicReference();
@ -4853,12 +4853,12 @@ index 8cc3fd73eaa41b87c63cf26e299affca16f20d87..afd39623d2c2e9270510a6a83b591839
} }
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end // CraftBukkit end
+ this.paperConfigurations = services.paperConfigurations(); // Paper + this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
} }
private void readScoreboard(DimensionDataStorage persistentStateManager) { private void readScoreboard(DimensionDataStorage persistentStateManager) {
diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java
index 1d611538d339345df065cd9c0c582d02e1fb0cc7..92d1ad919c1b3e27af9cc74ada19f1e9c4f3471f 100644 index 1d611538d339345df065cd9c0c582d02e1fb0cc7..d200619b4aa820e273c26f2f6133589c727f8a0e 100644
--- a/src/main/java/net/minecraft/server/Services.java --- a/src/main/java/net/minecraft/server/Services.java
+++ b/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java
@@ -10,14 +10,30 @@ import javax.annotation.Nullable; @@ -10,14 +10,30 @@ import javax.annotation.Nullable;
@ -4866,7 +4866,7 @@ index 1d611538d339345df065cd9c0c582d02e1fb0cc7..92d1ad919c1b3e27af9cc74ada19f1e9
import net.minecraft.util.SignatureValidator; import net.minecraft.util.SignatureValidator;
-public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) { -public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) {
+// Paper start +// Paper start - add paper configuration files
+public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations) { +public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations) {
+ +
+ public Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) { + public Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) {
@ -4877,53 +4877,53 @@ index 1d611538d339345df065cd9c0c582d02e1fb0cc7..92d1ad919c1b3e27af9cc74ada19f1e9
+ public io.papermc.paper.configuration.PaperConfigurations paperConfigurations() { + public io.papermc.paper.configuration.PaperConfigurations paperConfigurations() {
+ return java.util.Objects.requireNonNull(this.paperConfigurations); + return java.util.Objects.requireNonNull(this.paperConfigurations);
+ } + }
+ // Paper end + // Paper end - add paper configuration files
private static final String USERID_CACHE_FILE = "usercache.json"; private static final String USERID_CACHE_FILE = "usercache.json";
- public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory) { - public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory) {
+ public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, joptsimple.OptionSet optionSet) throws Exception { // Paper + public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, joptsimple.OptionSet optionSet) throws Exception { // Paper - add optionset to load paper config files
MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService(); MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService();
GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository(); GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository();
GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, new File(rootDirectory, "usercache.json")); GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, new File(rootDirectory, "usercache.json"));
- return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache); - return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache);
+ // Paper start + // Paper start - load paper config files from cli options
+ final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath(); + final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath();
+ final java.nio.file.Path configDirPath = ((File) optionSet.valueOf("paper-settings-directory")).toPath(); + final java.nio.file.Path configDirPath = ((File) optionSet.valueOf("paper-settings-directory")).toPath();
+ io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(legacyConfigPath, configDirPath, rootDirectory.toPath(), (File) optionSet.valueOf("spigot-settings")); + io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(legacyConfigPath, configDirPath, rootDirectory.toPath(), (File) optionSet.valueOf("spigot-settings"));
+ return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache, paperConfigurations); + return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache, paperConfigurations);
+ // Paper end + // Paper end - load paper config files from cli options
} }
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index dd16b56a478e1cd6f1b3c5563c9c02025d894802..458c04786f7b56f3c006e1e717c0ac709fddb1a0 100644 index dd16b56a478e1cd6f1b3c5563c9c02025d894802..c56c7293261ec2601ab02d051b37e820f023f0ff 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -183,6 +183,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -183,6 +183,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings")); org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands(); org.spigotmc.SpigotConfig.registerCommands();
// Spigot end // Spigot end
+ // Paper start + // Paper start - initialize global and world-defaults configuration
+ paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); + this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
+ paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); + this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
+ // Paper end + // Paper end - initialize global and world-defaults configuration
this.setPvpAllowed(dedicatedserverproperties.pvp); this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setFlightAllowed(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java
index 37ab411817008d4e6194e177d88d50931e53b42e..ca23639f15107ccd43b874ae38fa37279b827a8f 100644 index 397c978c71f36c8abe1c52e545699fc7928a6917..fc45c2c4ecdf3906df6bceaf3e019c462fe62186 100644
--- a/src/main/java/net/minecraft/server/dedicated/Settings.java --- a/src/main/java/net/minecraft/server/dedicated/Settings.java
+++ b/src/main/java/net/minecraft/server/dedicated/Settings.java +++ b/src/main/java/net/minecraft/server/dedicated/Settings.java
@@ -119,6 +119,7 @@ public abstract class Settings<T extends Settings<T>> { @@ -119,6 +119,7 @@ public abstract class Settings<T extends Settings<T>> {
try { try {
// CraftBukkit start - Don't attempt writing to file if it's read only // CraftBukkit start - Don't attempt writing to file if it's read only
if (path.toFile().exists() && !path.toFile().canWrite()) { if (path.toFile().exists() && !path.toFile().canWrite()) {
+ Settings.LOGGER.warn("Can not write to file {}, skipping.", path); // Paper + Settings.LOGGER.warn("Can not write to file {}, skipping.", path); // Paper - log message file is read-only
return; return;
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ecc61c7b1b4eb887795ffd39578b70b4e77f5213..92cb1c23f2ef95f9be6c688146ee81aae5ac101c 100644 index ecc61c7b1b4eb887795ffd39578b70b4e77f5213..674c996af91de91ee6302cc67334b836ea4fa4de 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -236,7 +236,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -236,7 +236,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -4931,24 +4931,24 @@ index ecc61c7b1b4eb887795ffd39578b70b4e77f5213..92cb1c23f2ef95f9be6c688146ee81aa
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env); - super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess()))); // Paper + super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess()))); // Paper - create paper world configs
this.pvpMode = minecraftserver.isPvpAllowed(); this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession; this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index cff78fc8d073be7541628bb40670f82d1e9917cd..50ea733f42d0f06a62b55e61b0c73995896b0d6a 100644 index 8487fa452e4009c0f2a23a0d4eac4bf56f91447b..00ddf94c5bade8c0c486337ce920f59d63cb64e2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -158,6 +158,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -158,6 +158,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
public boolean populating; public boolean populating;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
+ // Paper start + // Paper start - add paper world config
+ private final io.papermc.paper.configuration.WorldConfiguration paperConfig; + private final io.papermc.paper.configuration.WorldConfiguration paperConfig;
+ public io.papermc.paper.configuration.WorldConfiguration paperConfig() { + public io.papermc.paper.configuration.WorldConfiguration paperConfig() {
+ return this.paperConfig; + return this.paperConfig;
+ } + }
+ // Paper end + // Paper end - add paper world config
public final SpigotTimings.WorldTimingsHandler timings; // Spigot public final SpigotTimings.WorldTimingsHandler timings; // Spigot
public static BlockPos lastPhysicsProblem; // Spigot public static BlockPos lastPhysicsProblem; // Spigot
@ -4957,9 +4957,9 @@ index cff78fc8d073be7541628bb40670f82d1e9917cd..50ea733f42d0f06a62b55e61b0c73995
public abstract ResourceKey<LevelStem> getTypeKey(); public abstract ResourceKey<LevelStem> getTypeKey();
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { - protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper + protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
+ this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper + this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
this.generator = gen; this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);

Datei anzeigen

@ -6051,14 +6051,14 @@ index 44cac39893eb968aa8ea21ee571c0dcb866ce06c..5151d68ba6ec72a7124f298253c5f0af
+ +
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 21e84dfd9ee3f8ce6234581ec31c64c35021d3c8..729849caf3e3cb542d5c4097a568c5fadeff0f6d 100644 index fb9f70b08e96ba4de52dca717ee245c405bf06e5..d4fb6d031acbb009fcb600718a16ac0b5437d88e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -296,6 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -296,6 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 3 ]; public final double[] recentTps = new double[ 3 ];
// Spigot end // Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
+ public static long currentTickLong = 0L; // Paper + public static long currentTickLong = 0L; // Paper - track current tick as a long
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) { public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference(); AtomicReference<S> atomicreference = new AtomicReference();
@ -6076,7 +6076,7 @@ index 21e84dfd9ee3f8ce6234581ec31c64c35021d3c8..729849caf3e3cb542d5c4097a568c5fa
} }
} }
// Spigot start // Spigot start
+ ++MinecraftServer.currentTickLong; // Paper + ++MinecraftServer.currentTickLong; // Paper - track current tick as a long
if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 ) if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 )
{ {
long curTime = Util.getMillis(); long curTime = Util.getMillis();
@ -6962,7 +6962,7 @@ index 1d12a7934308aa48d7ea7fa10c7b6b5ccb27e707..7cacfceed5ef9276a19123a8a9079579
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos); ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9cf839be15126444d4d2ffdb7faa637859941d6b..cb6fbb3a1512d69a3f1192c969c3d5c78c046cef 100644 index 93867b8883c6f5d5086e8fdc153e6d7c1e5d9fec..aa2c9b13b86130a613ed171a3c16f3639e7c82c6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -230,6 +230,98 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -230,6 +230,98 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -7355,7 +7355,7 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..db61b6b0158a9bcc0e1d735e34fe3671
public BlockState getBlockState(BlockPos pos) { public BlockState getBlockState(BlockPos pos) {
return Blocks.AIR.defaultBlockState(); return Blocks.AIR.defaultBlockState();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 81fbc18b0cd9bc443555001947796342be4123b8..9f8f9dea26e55f8785d3702c1e3d83f6f87358bb 100644 index 00ddf94c5bade8c0c486337ce920f59d63cb64e2..32afa096f148ebb546963bae7c9c9b194cb1a99c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -93,6 +93,7 @@ import org.bukkit.craftbukkit.CraftServer; @@ -93,6 +93,7 @@ import org.bukkit.craftbukkit.CraftServer;

Datei anzeigen

@ -2077,14 +2077,14 @@ index 0000000000000000000000000000000000000000..c0701d4f93a4d77a8177d2dd8d5076f9
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java
index e7980c88d036c617420e80bda8e1972723f97b52..44a1c467c429feee2f6292b6fcb1dbfa0354d46b 100644 index e7980c88d036c617420e80bda8e1972723f97b52..efbc104acc62c5af8acf35b15f1be0d9f11113c9 100644
--- a/src/main/java/net/minecraft/ChatFormatting.java --- a/src/main/java/net/minecraft/ChatFormatting.java
+++ b/src/main/java/net/minecraft/ChatFormatting.java +++ b/src/main/java/net/minecraft/ChatFormatting.java
@@ -113,6 +113,18 @@ public enum ChatFormatting implements StringRepresentable { @@ -113,6 +113,18 @@ public enum ChatFormatting implements StringRepresentable {
return name == null ? null : FORMATTING_BY_NAME.get(cleanName(name)); return name == null ? null : FORMATTING_BY_NAME.get(cleanName(name));
} }
+ // Paper start + // Paper start - add method to get by hex value
+ @Nullable public static ChatFormatting getByHexValue(int i) { + @Nullable public static ChatFormatting getByHexValue(int i) {
+ for (ChatFormatting value : values()) { + for (ChatFormatting value : values()) {
+ if (value.getColor() != null && value.getColor() == i) { + if (value.getColor() != null && value.getColor() == i) {
@ -2094,25 +2094,25 @@ index e7980c88d036c617420e80bda8e1972723f97b52..44a1c467c429feee2f6292b6fcb1dbfa
+ +
+ return null; + return null;
+ } + }
+ // Paper end + // Paper end - add method to get by hex value
+ +
@Nullable @Nullable
public static ChatFormatting getById(int colorIndex) { public static ChatFormatting getById(int colorIndex) {
if (colorIndex < 0) { if (colorIndex < 0) {
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index db93483cfee13ca4303d7452ecbb47507dc5f89e..b836a85ce3a4374e94061fe9368e86a61522615d 100644 index db93483cfee13ca4303d7452ecbb47507dc5f89e..f6938c35ac6f6116084d3e7ec9cdc918f20b6f61 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -65,6 +65,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS @@ -65,6 +65,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
private final CommandSigningContext signingContext; private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer; private final TaskChainer chatMessageChainer;
public volatile CommandNode currentCommand; // CraftBukkit public volatile CommandNode currentCommand; // CraftBukkit
+ public boolean bypassSelectorPermissions = false; // Paper + public boolean bypassSelectorPermissions = false; // Paper - add bypass for selector permissions
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server)); this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server));
diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
index 979ea69678319338c543185ba026ad0699a388d6..34ed1f92328ee8826b58dfaf239a96b6ee196ca3 100644 index 979ea69678319338c543185ba026ad0699a388d6..a3e8b2baec7ac8a61f6cbed7095f84273be385e7 100644
--- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java --- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
+++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
@@ -51,17 +51,21 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message> @@ -51,17 +51,21 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message>
@ -2122,11 +2122,11 @@ index 979ea69678319338c543185ba026ad0699a388d6..34ed1f92328ee8826b58dfaf239a96b6
- Component component = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); - Component component = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent());
- source.getChatMessageChainer().append(completableFuture, (filtered) -> { - source.getChatMessageChainer().append(completableFuture, (filtered) -> {
- PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(component).filter(filtered.mask()); - PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(component).filter(filtered.mask());
+ // Paper start + // Paper start - support asynchronous chat decoration
+ CompletableFuture<ChatDecorator.Result> componentFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); + CompletableFuture<ChatDecorator.Result> componentFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent());
+ source.getChatMessageChainer().append(CompletableFuture.allOf(completableFuture, componentFuture), (filtered) -> { + source.getChatMessageChainer().append(CompletableFuture.allOf(completableFuture, componentFuture), (filtered) -> {
+ PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(componentFuture.join().component()).filter(completableFuture.join().mask()); // Paper + PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(componentFuture.join().component()).filter(completableFuture.join().mask());
+ // Paper end + // Paper end - support asynchronous chat decoration
callback.accept(playerChatMessage2); callback.accept(playerChatMessage2);
}); });
} }
@ -2135,15 +2135,15 @@ index 979ea69678319338c543185ba026ad0699a388d6..34ed1f92328ee8826b58dfaf239a96b6
ChatDecorator chatDecorator = source.getServer().getChatDecorator(); ChatDecorator chatDecorator = source.getServer().getChatDecorator();
- Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent()); - Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent());
- callback.accept(message.withUnsignedContent(component)); - callback.accept(message.withUnsignedContent(component));
+ // Paper start + // Paper start - support asynchronous chat decoration
+ CompletableFuture<ChatDecorator.Result> componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent()); + CompletableFuture<ChatDecorator.Result> componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent());
+ source.getChatMessageChainer().append(componentFuture, (result) -> callback.accept(message.withUnsignedContent(result.component()))); + source.getChatMessageChainer().append(componentFuture, (result) -> callback.accept(message.withUnsignedContent(result.component())));
+ // Paper end + // Paper end - support asynchronous chat decoration
} }
private static CompletableFuture<FilteredText> filterPlainText(CommandSourceStack source, PlayerChatMessage message) { private static CompletableFuture<FilteredText> filterPlainText(CommandSourceStack source, PlayerChatMessage message) {
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
index d120fff432d9c4fc7a35ddffdc4186459e45e950..73c15a0c56a103ba4e62f0a51af8d42566b07245 100644 index d120fff432d9c4fc7a35ddffdc4186459e45e950..676a1499747b071515479130875157263d3a8352 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java --- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -92,7 +92,7 @@ public class EntitySelector { @@ -92,7 +92,7 @@ public class EntitySelector {
@ -2151,19 +2151,19 @@ index d120fff432d9c4fc7a35ddffdc4186459e45e950..73c15a0c56a103ba4e62f0a51af8d425
private void checkPermissions(CommandSourceStack source) throws CommandSyntaxException { private void checkPermissions(CommandSourceStack source) throws CommandSyntaxException {
- if (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector")) { // CraftBukkit - if (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector")) { // CraftBukkit
+ if (source.bypassSelectorPermissions || (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector"))) { // CraftBukkit // Paper + if (source.bypassSelectorPermissions || (this.usesSelector && !source.hasPermission(2, "minecraft.command.selector"))) { // CraftBukkit // Paper - add bypass for selector perms
throw EntityArgument.ERROR_SELECTORS_NOT_ALLOWED.create(); throw EntityArgument.ERROR_SELECTORS_NOT_ALLOWED.create();
} }
} }
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 9373502ede6c8a881af67db005cf12fd9313f37f..39940edf4aef21842c8abd77bec0d0f1e7e9c762 100644 index 9373502ede6c8a881af67db005cf12fd9313f37f..53f033d2d887909f5f905c00122d1b09809e5e3c 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -87,6 +87,7 @@ public class FriendlyByteBuf extends ByteBuf { @@ -87,6 +87,7 @@ public class FriendlyByteBuf extends ByteBuf {
public static final int DEFAULT_NBT_QUOTA = 2097152; public static final int DEFAULT_NBT_QUOTA = 2097152;
private final ByteBuf source; private final ByteBuf source;
+ public java.util.Locale adventure$locale; // Paper + public java.util.Locale adventure$locale; // Paper - track player's locale for server-side translations
public static final short MAX_STRING_LENGTH = 32767; public static final short MAX_STRING_LENGTH = 32767;
public static final int MAX_COMPONENT_STRING_LENGTH = 262144; public static final int MAX_COMPONENT_STRING_LENGTH = 262144;
private static final int PUBLIC_KEY_SIZE = 256; private static final int PUBLIC_KEY_SIZE = 256;
@ -2171,17 +2171,17 @@ index 9373502ede6c8a881af67db005cf12fd9313f37f..39940edf4aef21842c8abd77bec0d0f1
} }
public <T> void writeJsonWithCodec(Codec<T> codec, T value) { public <T> void writeJsonWithCodec(Codec<T> codec, T value) {
+ // Paper start - Adventure + // Paper start - Adventure; add max length parameter
+ this.writeJsonWithCodec(codec, value, MAX_STRING_LENGTH); + this.writeJsonWithCodec(codec, value, MAX_STRING_LENGTH);
+ } + }
+ public <T> void writeJsonWithCodec(Codec<T> codec, T value, int maxLength) { + public <T> void writeJsonWithCodec(Codec<T> codec, T value, int maxLength) {
+ // Paper end - Adventure + // Paper end - Adventure; add max length parameter
DataResult<JsonElement> dataresult = codec.encodeStart(JsonOps.INSTANCE, value); DataResult<JsonElement> dataresult = codec.encodeStart(JsonOps.INSTANCE, value);
this.writeUtf(FriendlyByteBuf.GSON.toJson((JsonElement) Util.getOrThrow(dataresult, (s) -> { this.writeUtf(FriendlyByteBuf.GSON.toJson((JsonElement) Util.getOrThrow(dataresult, (s) -> {
return new EncoderException("Failed to encode: " + s + " " + value); return new EncoderException("Failed to encode: " + s + " " + value);
- }))); - })));
+ })), maxLength); // Paper - Adventure + })), maxLength); // Paper - Adventure; add max length parameter
} }
public <T> void writeId(IdMap<T> registry, T value) { public <T> void writeId(IdMap<T> registry, T value) {
@ -2189,7 +2189,7 @@ index 9373502ede6c8a881af67db005cf12fd9313f37f..39940edf4aef21842c8abd77bec0d0f1
return (Component) this.readWithCodecTrusted(NbtOps.INSTANCE, ComponentSerialization.CODEC); return (Component) this.readWithCodecTrusted(NbtOps.INSTANCE, ComponentSerialization.CODEC);
} }
+ // Paper start - adventure + // Paper start - adventure; support writing adventure components directly and server-side translations
+ public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) { + public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) {
+ return this.writeWithCodec(NbtOps.INSTANCE, io.papermc.paper.adventure.PaperAdventure.localizedCodec(this.adventure$locale), component); + return this.writeWithCodec(NbtOps.INSTANCE, io.papermc.paper.adventure.PaperAdventure.localizedCodec(this.adventure$locale), component);
+ } + }
@ -2201,24 +2201,24 @@ index 9373502ede6c8a881af67db005cf12fd9313f37f..39940edf4aef21842c8abd77bec0d0f1
+ } + }
+ +
+ return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.localizedCodec(this.adventure$locale), text); + return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.localizedCodec(this.adventure$locale), text);
+ // Paper end - adventure + // Paper end - adventure; support writing adventure components directly and server-side translations
} }
public <T extends Enum<T>> T readEnum(Class<T> enumClass) { public <T extends Enum<T>> T readEnum(Class<T> enumClass) {
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index 344c5af75c4a66bb27f3f422937c6c427c15ed25..3d359f80f52bff6f19fcb484f491a874f9dcff27 100644 index 344c5af75c4a66bb27f3f422937c6c427c15ed25..7070d093c80033b61a9c8495bc56153d986b6b03 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -35,6 +35,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -35,6 +35,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
} else { } else {
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
friendlyByteBuf.writeVarInt(i); friendlyByteBuf.writeVarInt(i);
+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper + friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - adventure; set player's locale
try { try {
int j = friendlyByteBuf.writerIndex(); int j = friendlyByteBuf.writerIndex();
diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/main/java/net/minecraft/network/chat/ChatDecorator.java diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/main/java/net/minecraft/network/chat/ChatDecorator.java
index 887b9fd625aa23c4ec828a175d63695f915232d3..8152420b9c3eb1bf13c012dd43505d9913fb9c4d 100644 index 887b9fd625aa23c4ec828a175d63695f915232d3..8e4a4b15152c2f83444fa8017bec06bbd1389e2c 100644
--- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java --- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java
+++ b/src/main/java/net/minecraft/network/chat/ChatDecorator.java +++ b/src/main/java/net/minecraft/network/chat/ChatDecorator.java
@@ -2,12 +2,72 @@ package net.minecraft.network.chat; @@ -2,12 +2,72 @@ package net.minecraft.network.chat;
@ -2231,14 +2231,14 @@ index 887b9fd625aa23c4ec828a175d63695f915232d3..8152420b9c3eb1bf13c012dd43505d99
public interface ChatDecorator { public interface ChatDecorator {
ChatDecorator PLAIN = (sender, message) -> { ChatDecorator PLAIN = (sender, message) -> {
- return message; - return message;
+ return CompletableFuture.completedFuture(message); // Paper + return CompletableFuture.completedFuture(message); // Paper - adventure; support async chat decoration events
}; };
- Component decorate(@Nullable ServerPlayer sender, Component message); - Component decorate(@Nullable ServerPlayer sender, Component message);
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper + @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - adventure; support chat decoration events
+ CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message); // Paper - make a completable future again + CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message); // Paper - adventure; support async chat decoration events
+ +
+ // Paper start + // Paper start - adventure; support async chat decoration events
+ default CompletableFuture<Result> decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message) { + default CompletableFuture<Result> decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message) {
+ throw new UnsupportedOperationException("Must override this implementation"); + throw new UnsupportedOperationException("Must override this implementation");
+ } + }
@ -2294,17 +2294,17 @@ index 887b9fd625aa23c4ec828a175d63695f915232d3..8152420b9c3eb1bf13c012dd43505d99
+ return new MessagePair(adventureComponent, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(adventureComponent)); + return new MessagePair(adventureComponent, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(adventureComponent));
+ } + }
+ } + }
+ // Paper end + // Paper end - adventure; support async chat decoration events
} }
diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java
index 49138ccda0f378b13c7f425be765876eb4026b06..dc572d5be6ee3af74be2ffb4c02351c8be235159 100644 index 49138ccda0f378b13c7f425be765876eb4026b06..30568c1be4d412bfae5bd07d45b823861ec39ab3 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java --- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java
+++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java +++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java
@@ -55,12 +55,58 @@ public class ComponentSerialization { @@ -55,12 +55,58 @@ public class ComponentSerialization {
return ExtraCodecs.orCompressed(mapCodec3, mapCodec2); return ExtraCodecs.orCompressed(mapCodec3, mapCodec2);
} }
+ // Paper start - adventure + // Paper start - adventure; create separate codec for each locale
+ private static final java.util.Map<java.util.Locale, Codec<Component>> LOCALIZED_CODECS = new java.util.concurrent.ConcurrentHashMap<>(); + private static final java.util.Map<java.util.Locale, Codec<Component>> LOCALIZED_CODECS = new java.util.concurrent.ConcurrentHashMap<>();
+ +
+ public static Codec<Component> localizedCodec(final java.util.@org.checkerframework.checker.nullness.qual.Nullable Locale locale) { + public static Codec<Component> localizedCodec(final java.util.@org.checkerframework.checker.nullness.qual.Nullable Locale locale) {
@ -2314,21 +2314,21 @@ index 49138ccda0f378b13c7f425be765876eb4026b06..dc572d5be6ee3af74be2ffb4c02351c8
+ return LOCALIZED_CODECS.computeIfAbsent(locale, + return LOCALIZED_CODECS.computeIfAbsent(locale,
+ loc -> ExtraCodecs.recursive("Component", selfCodec -> createCodec(selfCodec, loc))); + loc -> ExtraCodecs.recursive("Component", selfCodec -> createCodec(selfCodec, loc)));
+ } + }
+ // Paper end + // Paper end - adventure; create separate codec for each locale
+ +
private static Codec<Component> createCodec(Codec<Component> selfCodec) { private static Codec<Component> createCodec(Codec<Component> selfCodec) {
+ // Paper start - adventure + // Paper start - adventure; create separate codec for each locale
+ return createCodec(selfCodec, null); + return createCodec(selfCodec, null);
+ } + }
+ +
+ private static Codec<Component> createCodec(Codec<Component> selfCodec, @javax.annotation.Nullable java.util.Locale locale) { + private static Codec<Component> createCodec(Codec<Component> selfCodec, @javax.annotation.Nullable java.util.Locale locale) {
+ // Paper end + // Paper end - adventure; create separate codec for each locale
ComponentContents.Type<?>[] types = new ComponentContents.Type[]{PlainTextContents.TYPE, TranslatableContents.TYPE, KeybindContents.TYPE, ScoreContents.TYPE, SelectorContents.TYPE, NbtContents.TYPE}; ComponentContents.Type<?>[] types = new ComponentContents.Type[]{PlainTextContents.TYPE, TranslatableContents.TYPE, KeybindContents.TYPE, ScoreContents.TYPE, SelectorContents.TYPE, NbtContents.TYPE};
MapCodec<ComponentContents> mapCodec = createLegacyComponentMatcher(types, ComponentContents.Type::codec, ComponentContents::type, "type"); MapCodec<ComponentContents> mapCodec = createLegacyComponentMatcher(types, ComponentContents.Type::codec, ComponentContents::type, "type");
Codec<Component> codec = RecordCodecBuilder.create((instance) -> { Codec<Component> codec = RecordCodecBuilder.create((instance) -> {
return instance.group(mapCodec.forGetter(Component::getContents), ExtraCodecs.strictOptionalField(ExtraCodecs.nonEmptyList(selfCodec.listOf()), "extra", List.of()).forGetter(Component::getSiblings), Style.Serializer.MAP_CODEC.forGetter(Component::getStyle)).apply(instance, MutableComponent::new); return instance.group(mapCodec.forGetter(Component::getContents), ExtraCodecs.strictOptionalField(ExtraCodecs.nonEmptyList(selfCodec.listOf()), "extra", List.of()).forGetter(Component::getSiblings), Style.Serializer.MAP_CODEC.forGetter(Component::getStyle)).apply(instance, MutableComponent::new);
}); });
+ // Paper start - adventure + // Paper start - adventure; create separate codec for each locale
+ final Codec<Component> origCodec = codec; + final Codec<Component> origCodec = codec;
+ codec = new Codec<>() { + codec = new Codec<>() {
+ @Override + @Override
@ -2355,35 +2355,35 @@ index 49138ccda0f378b13c7f425be765876eb4026b06..dc572d5be6ee3af74be2ffb4c02351c8
+ return origCodec.toString() + "[AdventureComponentAware]"; + return origCodec.toString() + "[AdventureComponentAware]";
+ } + }
+ }; + };
+ // Paper end + // Paper end - adventure; create separate codec for each locale
return Codec.either(Codec.either(Codec.STRING, ExtraCodecs.nonEmptyList(selfCodec.listOf())), codec).xmap((either) -> { return Codec.either(Codec.either(Codec.STRING, ExtraCodecs.nonEmptyList(selfCodec.listOf())), codec).xmap((either) -> {
return either.map((either2) -> { return either.map((either2) -> {
return either2.map(Component::literal, ComponentSerialization::createFromList); return either2.map(Component::literal, ComponentSerialization::createFromList);
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
index b6506e881ef337bfd2a7a0644296b48b7300a0f6..7daca712816a79cc4a30b084afbd3d07b5d3755f 100644 index b6506e881ef337bfd2a7a0644296b48b7300a0f6..57206594f305961a33542e1f8079c75bfa7c535f 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
@@ -41,6 +41,11 @@ public class ComponentUtils { @@ -41,6 +41,11 @@ public class ComponentUtils {
if (depth > 100) { if (depth > 100) {
return text.copy(); return text.copy();
} else { } else {
+ // Paper start + // Paper start - adventure; pass actual vanilla component
+ if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) { + if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
+ text = adventureComponent.deepConverted(); + text = adventureComponent.deepConverted();
+ } + }
+ // Paper end + // Paper end - adventure; pass actual vanilla component
MutableComponent mutableComponent = text.getContents().resolve(source, sender, depth + 1); MutableComponent mutableComponent = text.getContents().resolve(source, sender, depth + 1);
for(Component component : text.getSiblings()) { for(Component component : text.getSiblings()) {
diff --git a/src/main/java/net/minecraft/network/chat/MessageSignature.java b/src/main/java/net/minecraft/network/chat/MessageSignature.java diff --git a/src/main/java/net/minecraft/network/chat/MessageSignature.java b/src/main/java/net/minecraft/network/chat/MessageSignature.java
index df9997873c4bbec184379ec14dca1bf4566eb89d..e2812cdce3b1170b7b7d0f52209e8b4fd2b64c61 100644 index df9997873c4bbec184379ec14dca1bf4566eb89d..a3e2d03ffe9392cc69e850c5db7d71889a0a27ea 100644
--- a/src/main/java/net/minecraft/network/chat/MessageSignature.java --- a/src/main/java/net/minecraft/network/chat/MessageSignature.java
+++ b/src/main/java/net/minecraft/network/chat/MessageSignature.java +++ b/src/main/java/net/minecraft/network/chat/MessageSignature.java
@@ -13,11 +13,12 @@ import net.minecraft.util.SignatureUpdater; @@ -13,11 +13,12 @@ import net.minecraft.util.SignatureUpdater;
import net.minecraft.util.SignatureValidator; import net.minecraft.util.SignatureValidator;
public record MessageSignature(byte[] bytes) { public record MessageSignature(byte[] bytes) {
+ public net.kyori.adventure.chat.SignedMessage.Signature adventure() { return () -> this.bytes; } // Paper + public net.kyori.adventure.chat.SignedMessage.Signature adventure() { return () -> this.bytes; } // Paper - adventure; support signed messages
public static final Codec<MessageSignature> CODEC = ExtraCodecs.BASE64_STRING.xmap(MessageSignature::new, MessageSignature::bytes); public static final Codec<MessageSignature> CODEC = ExtraCodecs.BASE64_STRING.xmap(MessageSignature::new, MessageSignature::bytes);
public static final int BYTES = 256; public static final int BYTES = 256;
@ -2439,7 +2439,7 @@ index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee
sender.connection.sendPlayerChatMessage(playerChatMessage, params); sender.connection.sendPlayerChatMessage(playerChatMessage, params);
} }
diff --git a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java diff --git a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java
index 901c1aba1653ed70f4af931835ceb12a357aff55..4ac5276dae775210d73ae943d183e5aa8c10bf57 100644 index 901c1aba1653ed70f4af931835ceb12a357aff55..00560ea19c29fd0e16cbe11ab0b07f12a2ff0cb6 100644
--- a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java --- a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java
+++ b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java +++ b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java
@@ -14,7 +14,53 @@ import net.minecraft.Util; @@ -14,7 +14,53 @@ import net.minecraft.Util;
@ -2447,7 +2447,7 @@ index 901c1aba1653ed70f4af931835ceb12a357aff55..4ac5276dae775210d73ae943d183e5aa
import net.minecraft.util.SignatureValidator; import net.minecraft.util.SignatureValidator;
-public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) { -public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) {
+// Paper start +// Paper start - adventure; support signed messages
+public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask, @Nullable net.minecraft.network.chat.ChatDecorator.Result result) { +public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask, @Nullable net.minecraft.network.chat.ChatDecorator.Result result) {
+ public PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) { + public PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) {
+ this(link, signature, signedBody, unsignedContent, filterMask, null); + this(link, signature, signedBody, unsignedContent, filterMask, null);
@ -2493,7 +2493,7 @@ index 901c1aba1653ed70f4af931835ceb12a357aff55..4ac5276dae775210d73ae943d183e5aa
+ public AdventureView adventureView() { + public AdventureView adventureView() {
+ return new AdventureView(); + return new AdventureView();
+ } + }
+ // Paper end + // Paper end - adventure; support signed messages
public static final MapCodec<PlayerChatMessage> MAP_CODEC = RecordCodecBuilder.mapCodec((instance) -> { public static final MapCodec<PlayerChatMessage> MAP_CODEC = RecordCodecBuilder.mapCodec((instance) -> {
return instance.group(SignedMessageLink.CODEC.fieldOf("link").forGetter(PlayerChatMessage::link), MessageSignature.CODEC.optionalFieldOf("signature").forGetter((message) -> { return instance.group(SignedMessageLink.CODEC.fieldOf("link").forGetter(PlayerChatMessage::link), MessageSignature.CODEC.optionalFieldOf("signature").forGetter((message) -> {
return Optional.ofNullable(message.signature); return Optional.ofNullable(message.signature);
@ -2502,7 +2502,7 @@ index 901c1aba1653ed70f4af931835ceb12a357aff55..4ac5276dae775210d73ae943d183e5aa
public PlayerChatMessage withUnsignedContent(Component unsignedContent) { public PlayerChatMessage withUnsignedContent(Component unsignedContent) {
- Component component = !unsignedContent.equals(Component.literal(this.signedContent())) ? unsignedContent : null; - Component component = !unsignedContent.equals(Component.literal(this.signedContent())) ? unsignedContent : null;
+ Component component = !(unsignedContent instanceof io.papermc.paper.adventure.AdventureComponent advComponent ? advComponent.deepConverted() : unsignedContent).equals(Component.literal(this.signedContent())) ? unsignedContent : null; // Paper + Component component = !(unsignedContent instanceof io.papermc.paper.adventure.AdventureComponent advComponent ? advComponent.deepConverted() : unsignedContent).equals(Component.literal(this.signedContent())) ? unsignedContent : null; // Paper - adventure; convert adventure component wraps
return new PlayerChatMessage(this.link, this.signature, this.signedBody, component, this.filterMask); return new PlayerChatMessage(this.link, this.signature, this.signedBody, component, this.filterMask);
} }
@ -2648,7 +2648,7 @@ index a5578cbce2d1d39ba3315e53425d5323e6823a65..7a036c08fa67504d06c8f72a32c22814
@Override @Override
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 729849caf3e3cb542d5c4097a568c5fadeff0f6d..1eb0809addfd77303b94bb594701ee7f38483909 100644 index d4fb6d031acbb009fcb600718a16ac0b5437d88e..47f01de166a4048824f3075deb596084b7d42978 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -191,6 +191,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -191,6 +191,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot

Datei anzeigen

@ -605,19 +605,19 @@ index 0000000000000000000000000000000000000000..ae60bd96b5284d54676d8e7e4dd5d170
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 458c04786f7b56f3c006e1e717c0ac709fddb1a0..6c83df6290e4ec59c596f1b9e2f10f0a80004acd 100644 index c56c7293261ec2601ab02d051b37e820f023f0ff..faab5e8c952a2af6a286043617cded4e6ca5c3c6 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -186,6 +186,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -187,6 +187,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// Paper start this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration
+ io.papermc.paper.command.PaperCommands.registerCommands(this); + io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
// Paper end
this.setPvpAllowed(dedicatedserverproperties.pvp); this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 085844c5257c667838f637e98f32688b5e2ceaca..b7a7258321b5c312b9697ce40c1ea7bee469b3fc 100644 index 4e155510337d73cd65f722c1360d87d14312b874..cded844ac9fb2167fd0c751d47439d6597e34d05 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -939,6 +939,7 @@ public final class CraftServer implements Server { @@ -939,6 +939,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -698,17 +698,17 @@ index 0000000000000000000000000000000000000000..6aaed8e8bf8c721fc834da5c76ac72a4
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 6c83df6290e4ec59c596f1b9e2f10f0a80004acd..4b303d8acc663cfd3b86e37f4a3110d5335d07ad 100644 index faab5e8c952a2af6a286043617cded4e6ca5c3c6..813fd87df0dfed8fe46389db8333d1d9f409fbe4 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -187,6 +187,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -188,6 +188,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration
io.papermc.paper.command.PaperCommands.registerCommands(this); io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
+ com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); + com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
// Paper end
this.setPvpAllowed(dedicatedserverproperties.pvp); this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 1d066ce7dcf5f548c2a34d308d4422ab4fd02e5a..0fca20580d81c461e903c8cbd1cf090f5d5083c6 100644 index 1d066ce7dcf5f548c2a34d308d4422ab4fd02e5a..0fca20580d81c461e903c8cbd1cf090f5d5083c6 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java

Datei anzeigen

@ -712,7 +712,7 @@ index daedf825e68655492f5ab776bc206a5eb87c0170..7de24c39b460e43d27839b3821e67213
} catch (Exception exception) { } catch (Exception exception) {
label25: label25:
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1eb0809addfd77303b94bb594701ee7f38483909..206751253a02a5f144bbf7bfc5401577767e9030 100644 index 47f01de166a4048824f3075deb596084b7d42978..57e15d66bf59c23d9dc87aa811ff6c3c2084a4c4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -186,7 +186,7 @@ import org.bukkit.craftbukkit.Main; @@ -186,7 +186,7 @@ import org.bukkit.craftbukkit.Main;
@ -891,7 +891,7 @@ index 1eb0809addfd77303b94bb594701ee7f38483909..206751253a02a5f144bbf7bfc5401577
this.profiler.popPush("send chunks"); this.profiler.popPush("send chunks");
iterator = this.playerList.getPlayers().iterator(); iterator = this.playerList.getPlayers().iterator();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 4b303d8acc663cfd3b86e37f4a3110d5335d07ad..cb95818bfb5f0a9274b4e0f2530000bfca7ffc87 100644 index 813fd87df0dfed8fe46389db8333d1d9f409fbe4..dfb37ddb89c2f43d9f9a34a6b2d38616575eb39b 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -58,8 +58,9 @@ import org.apache.logging.log4j.Level; @@ -58,8 +58,9 @@ import org.apache.logging.log4j.Level;
@ -1123,7 +1123,7 @@ index 7cacfceed5ef9276a19123a8a9079579423d03ac..5cd680d2ed47aadb5e65a775d70bc662
gameprofilerfiller.pop(); gameprofilerfiller.pop();
gameprofilerfiller.pop(); gameprofilerfiller.pop();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index cb6fbb3a1512d69a3f1192c969c3d5c78c046cef..96b1e1669b4a425bc18e5c00da18a79f20fc3e9b 100644 index aa2c9b13b86130a613ed171a3c16f3639e7c82c6..d00b789d8deb0163726acbcb10edb0965ac9f326 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
@ -1472,7 +1472,7 @@ index b71b702471599fc8f1de42919ade8ee6a4e6247c..2e47008a8ff1bb56b752d4eb880173b9
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F); this.hurt(this.damageSources().drown(), 1.0F);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 9f8f9dea26e55f8785d3702c1e3d83f6f87358bb..6e3bdcea55490b23066ab90966698e59847cdffa 100644 index 32afa096f148ebb546963bae7c9c9b194cb1a99c..6dbc4c74b4d6b8e6c4763366e70ca9292b4a25d5 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -91,7 +91,6 @@ import org.bukkit.Bukkit; @@ -91,7 +91,6 @@ import org.bukkit.Bukkit;
@ -1485,7 +1485,7 @@ index 9f8f9dea26e55f8785d3702c1e3d83f6f87358bb..6e3bdcea55490b23066ab90966698e59
import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -166,7 +165,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -166,7 +165,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
// Paper end // Paper end - add paper world config
- public final SpigotTimings.WorldTimingsHandler timings; // Spigot - public final SpigotTimings.WorldTimingsHandler timings; // Spigot
+ public final co.aikar.timings.WorldTimingsHandler timings; // Paper + public final co.aikar.timings.WorldTimingsHandler timings; // Paper

Datei anzeigen

@ -209,14 +209,14 @@ index 0000000000000000000000000000000000000000..660b2ec6b63a4ceffee44ab11f54dfa7
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index b6d5e0962abb62a30c1561d3b1e970884b5b13dc..a267ab0b217573373d7b6a1f48cadab0f431da40 100644 index 0f516d126ce834adadd6a57a762e34c996403ab2..69e8a7551762ab6de03f43d823e2149f5f9eca70 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -189,6 +189,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -190,6 +190,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration
io.papermc.paper.command.PaperCommands.registerCommands(this); io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
+ com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now + com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
// Paper end
this.setPvpAllowed(dedicatedserverproperties.pvp); this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);

Datei anzeigen

@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 457b0f1f469436f6caa7473d91f906f1a61d6c74..2f04f10f5819be04b98ac0b52a2d7f4dfa525cea 100644 index 9d2ec082302a422e3135dc0ff6fedf86456b74b5..2defe6f950b8a5e1f039f61fa30343ccc7d4617a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -283,7 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -283,7 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -32,7 +32,7 @@ index 457b0f1f469436f6caa7473d91f906f1a61d6c74..2f04f10f5819be04b98ac0b52a2d7f4d
+ private static final int SAMPLE_INTERVAL = 20; // Paper + private static final int SAMPLE_INTERVAL = 20; // Paper
public final double[] recentTps = new double[ 3 ]; public final double[] recentTps = new double[ 3 ];
// Spigot end // Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
@@ -979,6 +979,57 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -979,6 +979,57 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
{ {
return ( avg * exp ) + ( tps * ( 1 - exp ) ); return ( avg * exp ) + ( tps * ( 1 - exp ) );
@ -103,7 +103,7 @@ index 457b0f1f469436f6caa7473d91f906f1a61d6c74..2f04f10f5819be04b98ac0b52a2d7f4d
@@ -1024,15 +1075,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1024,15 +1075,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// Spigot start // Spigot start
++MinecraftServer.currentTickLong; // Paper ++MinecraftServer.currentTickLong; // Paper - track current tick as a long
- if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 ) - if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 )
+ if ( ++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0 ) // Paper + if ( ++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0 ) // Paper
{ {
@ -141,7 +141,7 @@ index 457b0f1f469436f6caa7473d91f906f1a61d6c74..2f04f10f5819be04b98ac0b52a2d7f4d
this.startMetricsRecordingTick(); this.startMetricsRecordingTick();
this.profiler.push("tick"); this.profiler.push("tick");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1c8363ea23c76633b69e4b98b35ea4feb6c1d2ff..d491b3e7a6ec5ef2e2d7bf3fa014a4f501bff124 100644 index a0608611d17d2e4c05f04c9dc14b6a65e7f63f8d..e2da717c11f48573babe27d0dac1d679e8eb6964 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2573,6 +2573,17 @@ public final class CraftServer implements Server { @@ -2573,6 +2573,17 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Player Tab List and Title APIs
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 39940edf4aef21842c8abd77bec0d0f1e7e9c762..7dcd8d4e4886e1d35adbc604eafabccb5550f1b4 100644 index 53f033d2d887909f5f905c00122d1b09809e5e3c..b9dd91927cb259789ad71b2241024c5fa2586d57 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -545,6 +545,12 @@ public class FriendlyByteBuf extends ByteBuf { @@ -545,6 +545,12 @@ public class FriendlyByteBuf extends ByteBuf {
return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.localizedCodec(this.adventure$locale), text); return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.localizedCodec(this.adventure$locale), text);
// Paper end - adventure // Paper end - adventure; support writing adventure components directly and server-side translations
} }
+ // Paper start - deprecated Tab List & Title APIs + // Paper start - deprecated Tab List & Title APIs
+ @Deprecated + @Deprecated

Datei anzeigen

@ -206,7 +206,7 @@ index 0000000000000000000000000000000000000000..8f07539a82f449ad217e316a7513a170
+ +
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
index 6f429f69ac3ac11d9fa1f7c348e6aae8ac99a5e9..7e859d638181a0db412e4d724c35cbe624661b96 100644 index 2e757cd9b01ac7eba1e4723a6e21dcea9d062483..ca80cbe422d766b3d044a5b53ce40bb7f92558e4 100644
--- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java --- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -24,6 +24,7 @@ import net.kyori.adventure.text.TranslationArgument; @@ -24,6 +24,7 @@ import net.kyori.adventure.text.TranslationArgument;
@ -250,7 +250,7 @@ index 8323f135d6bf2e1f12525e05094ffa3f2420e7e1..a143ea1e58464a3122fbd8ccafe417bd
} }
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e91dd35a84dceae1ad9c5ede0565591e59d9d84f..721219807fd9abd12123cf0f3a0e3afd5839bf30 100644 index 16979931782eb60c0bdd419e0b8ec061c0d826fb..efb45a794f6f99fafc63202fe88ade8a722ba14b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -155,7 +155,7 @@ import org.slf4j.Logger; @@ -155,7 +155,7 @@ import org.slf4j.Logger;
@ -289,7 +289,7 @@ index e91dd35a84dceae1ad9c5ede0565591e59d9d84f..721219807fd9abd12123cf0f3a0e3afd
+ // Paper end + // Paper end
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end // CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
@@ -1178,7 +1182,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1178,7 +1182,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.spigotmc.WatchdogThread.doStop(); // Spigot org.spigotmc.WatchdogThread.doStop(); // Spigot
// CraftBukkit start - Restore terminal to original settings // CraftBukkit start - Restore terminal to original settings
@ -309,7 +309,7 @@ index e91dd35a84dceae1ad9c5ede0565591e59d9d84f..721219807fd9abd12123cf0f3a0e3afd
public KeyPair getKeyPair() { public KeyPair getKeyPair() {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 772d7c1e398538b8bbbd70aedaba05199d11b358..fc2a55735b22f5a25d009a7157624fb0cdc853c0 100644 index 1ee3e38703175707dec6493a1785b1bbc5170793..07c736fd35afb7f90d41d14a726ac476b0b6a2c0 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -98,6 +98,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -98,6 +98,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -387,7 +387,7 @@ index 8550245a088be78359b55fa0cc582df35dbbebed..ea7effdb4274c7e2c19d737a74b1fc58
this.bans = new UserBanList(PlayerList.USERBANLIST_FILE); this.bans = new UserBanList(PlayerList.USERBANLIST_FILE);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3be38200f46973dfaa0371337d5ed9544aa0aeaa..68d9ba337885ef9158d5f42154526596d8fefe07 100644 index 5e54e785cf91a6d5e295620df59b7fd5c17062e3..22656e27aeb2b6de8bb2be2d7db402a4a81fec87 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -42,7 +42,7 @@ import java.util.logging.Level; @@ -42,7 +42,7 @@ import java.util.logging.Level;

Datei anzeigen

@ -577,15 +577,15 @@ index 3a00e24d78acb99d226289ccb9ba419dfc607a45..209594863c2aa965055412adb7db009c
* Calculates distance between 2 entities * Calculates distance between 2 entities
* @param e1 * @param e1
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 360ecf561cde34b07929519a67485e0315e4676c..22f53d722f8e567554d2f7ed6c683e76cd74a1ef 100644 index 9d32d03ad59a6e2dfef2c157e621f9ef43098534..b60003f2542e469edf9e856873a1b325686ac31c 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -176,7 +176,7 @@ public class Main { @@ -176,7 +176,7 @@ public class Main {
} }
File file = (File) optionset.valueOf("universe"); // CraftBukkit File file = (File) optionset.valueOf("universe"); // CraftBukkit
- Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper - Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper - pass OptionSet to load paper config files
+ Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper + Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper - pass OptionSet to load paper config files; override authentication service
// CraftBukkit start // CraftBukkit start
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());

Datei anzeigen

@ -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. This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 584dca7c8aa5fc3bc73101482acd6ad892019a3d..06d9cafeeedb3020c5e2313d32c6fe9285f99925 100644 index b3666442b906c59aca50c230c3a6c8f2878a5bee..1a9faaecf50f3a17561c77cb262074c741ebfcc0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1075,6 +1075,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1075,6 +1075,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -21,19 +21,19 @@ index 584dca7c8aa5fc3bc73101482acd6ad892019a3d..06d9cafeeedb3020c5e2313d32c6fe92
long tickSection = Util.getNanos(), curTime, tickCount = 1; // Paper long tickSection = Util.getNanos(), curTime, tickCount = 1; // Paper
while (this.running) { while (this.running) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index fc2a55735b22f5a25d009a7157624fb0cdc853c0..adae2d7f9ced8ce6d2e15aafb8b53ef85e79b6d1 100644 index 07c736fd35afb7f90d41d14a726ac476b0b6a2c0..39a637f4fdbdc41a37873a92a9464020c25d57cf 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -197,6 +197,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -198,6 +198,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// Paper start this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration
+ org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); + org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
io.papermc.paper.command.PaperCommands.registerCommands(this); io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 146b21e3d3b1432d7b14cda4a9462d77b30e5fe2..f8499f4a70fbbaa99df0cc73aff6405bbbb135ad 100644 index debef627dda7b974e59c5656dbb3703d7d88b2e3..3eb6b2fa930ffe39bfb3b58e50f9f97cd5daad0a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -915,6 +915,7 @@ public final class CraftServer implements Server { @@ -915,6 +915,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal
public net.minecraft.world.entity.LivingEntity jumping public net.minecraft.world.entity.LivingEntity jumping
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 29a6c17103b443af83cf1506a0d1cfc328028270..feff680a737640f33f6efd9f0e2705e4a01ea7bb 100644 index b10097cd28f0dc360cda9b31e8184ed3a7003780..2d1aa3acd41615b1b2c9cf5751152a56f1f18ec5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -348,7 +348,7 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6
+ +
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7366bef851d283b30401c8be7057f01d703e486e..8c4fcb49c1cd90751bcc776a119f4d503b2bbf06 100644 index 3fdec0ff323ac94517f1ab9a13764a8959148127..9e4ab11521b853d0db55b382413c1f49cbff9e9e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -163,6 +163,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -163,6 +163,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -363,7 +363,7 @@ index 7366bef851d283b30401c8be7057f01d703e486e..8c4fcb49c1cd90751bcc776a119f4d50
+ // Paper end + // Paper end
public boolean populating; public boolean populating;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
// Paper start // Paper start - add paper world config
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 45f55c79a9d105f732054d61c4cf83eb5db49762..17a6327ab7b26dfab38881bbc0689b0b25f8f025 100644 index 45f55c79a9d105f732054d61c4cf83eb5db49762..17a6327ab7b26dfab38881bbc0689b0b25f8f025 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java

Datei anzeigen

@ -1104,15 +1104,15 @@ index be89e5b8c1ea7f85aef267a15986affa5fa1fd4b..43472855136f26b282d94fd241853d86
public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index feff680a737640f33f6efd9f0e2705e4a01ea7bb..bfbac715787bc75f77cfd3047f67613e56d7e64b 100644 index 2d1aa3acd41615b1b2c9cf5751152a56f1f18ec5..6d6ad6a33f3f8e4b8bc39fea00506daf7b31275c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -572,7 +572,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -572,7 +572,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess()))); // Paper - super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess()))); // Paper - create paper world configs
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - Async-Anti-Xray - Pass executor + super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
this.pvpMode = minecraftserver.isPvpAllowed(); this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession; this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
@ -1155,12 +1155,12 @@ index 5de5209e04d631bd6a50e28e8d3abebf148252c1..19b3f4fa7678a038bf25efc2a8b46dda
DebugPackets.sendPoiPacketsForChunk(world, chunkPos); DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 8c4fcb49c1cd90751bcc776a119f4d503b2bbf06..864b1985ba645b709e2cb5e7fd036e7664063ce5 100644 index 9e4ab11521b853d0db55b382413c1f49cbff9e9e..8782c443d6288cb1cadc181e7f2923cbcd3061d2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -178,6 +178,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -178,6 +178,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
// Paper end // Paper end - add paper world config
+ public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
public final co.aikar.timings.WorldTimingsHandler timings; // Paper public final co.aikar.timings.WorldTimingsHandler timings; // Paper
@ -1170,10 +1170,10 @@ index 8c4fcb49c1cd90751bcc776a119f4d503b2bbf06..864b1985ba645b709e2cb5e7fd036e76
public abstract ResourceKey<LevelStem> getTypeKey(); public abstract ResourceKey<LevelStem> getTypeKey();
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor + protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
this.generator = gen; this.generator = gen;
@@ -282,6 +283,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -282,6 +283,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper

Datei anzeigen

@ -71,7 +71,7 @@ index a9a0248b1bd1ac454064e977b61f9b7d80962ff8..059b1a0bf048af6a28c322f35da3d3cb
cause = cause.getCause(); cause = cause.getCause();
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2deb639d404943ef5b028c4ede59cab99b31a40f..08f7f287af32597d8a39f429013adec9266020bf 100644 index 961a4953be8561e31d8df3ce812d9ab6e3a573a5..011d9854731425cb5116db8cd726326c4a38fc06 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -297,7 +297,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -297,7 +297,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -84,8 +84,8 @@ index 2deb639d404943ef5b028c4ede59cab99b31a40f..08f7f287af32597d8a39f429013adec9
// Spigot start // Spigot start
public static final int TPS = 20; public static final int TPS = 20;
@@ -308,6 +308,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -308,6 +308,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
public static long currentTickLong = 0L; // Paper public static long currentTickLong = 0L; // Paper - track current tick as a long
+ public volatile Thread shutdownThread; // Paper + public volatile Thread shutdownThread; // Paper
+ public volatile boolean abnormalExit = false; // Paper + public volatile boolean abnormalExit = false; // Paper
@ -239,7 +239,7 @@ index 2deb639d404943ef5b028c4ede59cab99b31a40f..08f7f287af32597d8a39f429013adec9
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); 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 diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 109c7ff78d4c1f5496d294f52ecfd9df2070db1e..fe47a38137f7b7fa94c507e790eec4fb7303595f 100644 index 36312e6ec95324c16a5e70f3cc8c66127653b965..9ddcca2c17c15c5c7d88046aeae8b5588ad4612d 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/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 @@ -269,7 +269,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -296,7 +296,7 @@ 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 diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 864b1985ba645b709e2cb5e7fd036e7664063ce5..9c798dc5fc321697cea669d4656460e4971a92b5 100644 index 8782c443d6288cb1cadc181e7f2923cbcd3061d2..1bb5867bb2e99be1696c89ec47cd3aa0d655fdfb 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -913,6 +913,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -913,6 +913,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -525,7 +525,7 @@ index 93d3f29b08c79479c27d3f39e6c799c705e69902..38650109c1d2683a27da5788dc6013d8
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) { protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index 45b4f1c295eda2fcc5067a4b21de247218ef117f..d364bd57b1675c8b21d781c2bc16c3e65800455c 100644 index 2907536f8f9b4b9dccb96f8b4f19d75fa3c5b864..b5b228e67284baad3639b283595427a819bb1a44 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -47,7 +47,14 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -47,7 +47,14 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
@ -545,19 +545,19 @@ index 45b4f1c295eda2fcc5067a4b21de247218ef117f..d364bd57b1675c8b21d781c2bc16c3e6
throw new SkipPacketException(var13); throw new SkipPacketException(var13);
} }
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index fe47a38137f7b7fa94c507e790eec4fb7303595f..7f5ecea0ee78a534d7c56fa9e3ad2117b5192c0a 100644 index 9ddcca2c17c15c5c7d88046aeae8b5588ad4612d..c7696765ff6b1e27c108d2668c32abbbab35896c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -195,6 +195,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -194,6 +194,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands(); org.spigotmc.SpigotConfig.registerCommands();
// Spigot end // Spigot end
// Paper start
+ io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc. + io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Paper start - initialize global and world-defaults configuration
paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bd40d4056fbf237f2a3f6c7178bed699f9bdf389..2e04cf910a520b92ac43a5ff2d06d9d61402c3cb 100644 index 1c0d2aad70b3817913e93354ccc055b82ae321bc..51379dc93af2eaa3294179debe067d62627b60e1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -222,7 +222,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -222,7 +222,9 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -26,7 +26,7 @@ index 3384501f83d445f45aa8233e98c7597daa67b8ef..6875e15aac37d3566bf04f1a6ee79a21
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 75b7b3cf90d1d67203ae19dc3302f06a57470f92..e58c2844356c71973d81b460a21aab795b506d77 100644 index c772fa3b7a1276b0b41c45c6e0f5584b9c3a90cd..79732086bc4cdbca8364d78eb60d68c758055966 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -64,7 +64,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS @@ -64,7 +64,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@ -34,8 +34,8 @@ index 75b7b3cf90d1d67203ae19dc3302f06a57470f92..e58c2844356c71973d81b460a21aab79
private final CommandSigningContext signingContext; private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer; private final TaskChainer chatMessageChainer;
- public volatile CommandNode currentCommand; // CraftBukkit - public volatile CommandNode currentCommand; // CraftBukkit
+ public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper + public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper - make thread-safe
public boolean bypassSelectorPermissions = false; // Paper public boolean bypassSelectorPermissions = false; // Paper - add bypass for selector permissions
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
@@ -193,9 +193,11 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS @@ -193,9 +193,11 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 22f53d722f8e567554d2f7ed6c683e76cd74a1ef..49553615418bcbb6f3e4be6f38a9ecd0a650502b 100644 index b60003f2542e469edf9e856873a1b325686ac31c..6170ff19f44a93e99c6aece6ed456a6af912efbb 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -175,8 +175,17 @@ public class Main { @@ -175,8 +175,17 @@ public class Main {
@ -13,7 +13,7 @@ index 22f53d722f8e567554d2f7ed6c683e76cd74a1ef..49553615418bcbb6f3e4be6f38a9ecd0
} }
- File file = (File) optionset.valueOf("universe"); // CraftBukkit - File file = (File) optionset.valueOf("universe"); // CraftBukkit
- Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper - Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper - pass OptionSet to load paper config files; override authentication service
+ // Paper start - fix SPIGOT-5824 + // Paper start - fix SPIGOT-5824
+ File file; + File file;
+ File userCacheFile = new File(Services.USERID_CACHE_FILE); + File userCacheFile = new File(Services.USERID_CACHE_FILE);
@ -24,27 +24,27 @@ index 22f53d722f8e567554d2f7ed6c683e76cd74a1ef..49553615418bcbb6f3e4be6f38a9ecd0
+ file = new File(bukkitConfiguration.getString("settings.world-container", ".")); + file = new File(bukkitConfiguration.getString("settings.world-container", "."));
+ } + }
+ // Paper end - fix SPIGOT-5824 + // Paper end - fix SPIGOT-5824
+ Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper + Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper - pass OptionSet to load paper config files; override authentication service; fix world-container
// CraftBukkit start // CraftBukkit start
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java
index 92d1ad919c1b3e27af9cc74ada19f1e9c4f3471f..a5450eeeab5a6b0ab273810063806d11107d6b26 100644 index d200619b4aa820e273c26f2f6133589c727f8a0e..d89c624554ab08bd1b33a3f62b52aa57aaafb8b4 100644
--- a/src/main/java/net/minecraft/server/Services.java --- a/src/main/java/net/minecraft/server/Services.java
+++ b/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java
@@ -22,12 +22,12 @@ public record Services(MinecraftSessionService sessionService, ServicesKeySet se @@ -22,12 +22,12 @@ public record Services(MinecraftSessionService sessionService, ServicesKeySet se
return java.util.Objects.requireNonNull(this.paperConfigurations); return java.util.Objects.requireNonNull(this.paperConfigurations);
} }
// Paper end // Paper end - add paper configuration files
- private static final String USERID_CACHE_FILE = "usercache.json"; - private static final String USERID_CACHE_FILE = "usercache.json";
+ public static final String USERID_CACHE_FILE = "usercache.json"; // Paper - private -> public + public static final String USERID_CACHE_FILE = "usercache.json"; // Paper - private -> public
- public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, joptsimple.OptionSet optionSet) throws Exception { // Paper - public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, joptsimple.OptionSet optionSet) throws Exception { // Paper - add optionset to load paper config files
+ public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, File userCacheFile, joptsimple.OptionSet optionSet) throws Exception { // Paper + public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, File userCacheFile, joptsimple.OptionSet optionSet) throws Exception { // Paper - add optionset to load paper config files; add userCacheFile parameter
MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService(); MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService();
GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository(); GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository();
- GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, new File(rootDirectory, "usercache.json")); - GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, new File(rootDirectory, "usercache.json"));
+ GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, userCacheFile); // Paper + GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, userCacheFile); // Paper - use specified user cache file
// Paper start // Paper start - load paper config files from cli options
final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath(); final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath();
final java.nio.file.Path configDirPath = ((File) optionSet.valueOf("paper-settings-directory")).toPath(); final java.nio.file.Path configDirPath = ((File) optionSet.valueOf("paper-settings-directory")).toPath();

Datei anzeigen

@ -21,22 +21,22 @@ index a20d47f54f12dfc0a5f76dd969238e34c958b618..935dac757280731bfeb0a8f033cbe315
this.saveUserBanList(); this.saveUserBanList();
this.loadIpBanList(); this.loadIpBanList();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index ac918da8234553e4d88664b240feddc1fea8bd6b..e92708f60fec876c62e720420f133a9b28c6f66f 100644 index 4d76d64fad92510de5098613aa0a04e1bbf7bca5..d7a147cc29f9d6882326ddac29449e1b14ae9c96 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -198,6 +198,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -199,6 +199,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc. this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration
+ // Paper start - moved up to right after PlayerList creation but before file load/save + // Paper start - convert old users earlier after PlayerList creation but before file load/save
+ if (this.convertOldUsers()) { + if (this.convertOldUsers()) {
+ this.getProfileCache().save(false); // Paper + this.getProfileCache().save(false); // Paper
+ } + }
+ this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames + this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
+ // Paper end - moved up + // Paper end - convert old users earlier after PlayerList creation but before file load/save
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
io.papermc.paper.command.PaperCommands.registerCommands(this); io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
@@ -253,9 +259,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -253,9 +259,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
} }
@ -48,7 +48,7 @@ index ac918da8234553e4d88664b240feddc1fea8bd6b..e92708f60fec876c62e720420f133a9b
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false; return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index bf361396bc2ec5d5c7b45d425af990c037ba0694..c8f40d71619a53f85b71ef5af397bbfa65fd797f 100644 index 32f93ed20f5f2cec71850d7e0ce8a633fd5efc82..8a13160ff62a671a11740c456a2cbc3ccbac708f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -176,6 +176,7 @@ public abstract class PlayerList { @@ -176,6 +176,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -208,7 +208,7 @@ index 0000000000000000000000000000000000000000..dd9d77d7c7f1a5a130a1f4c15e5b1e68
+ public void setErrorIndex(final int errorIndex) {} + public void setErrorIndex(final int errorIndex) {}
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index e92708f60fec876c62e720420f133a9b28c6f66f..3cacbbc03a3207656b71a1a05d95dbb750815bab 100644 index d7a147cc29f9d6882326ddac29449e1b14ae9c96..5c455e4fba3e7b6064d869340667f48ed9cb3e9e 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -173,7 +173,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -173,7 +173,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -220,14 +220,14 @@ index e92708f60fec876c62e720420f133a9b28c6f66f..3cacbbc03a3207656b71a1a05d95dbb7
DedicatedServer.LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName()); DedicatedServer.LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName());
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@@ -205,6 +205,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -206,6 +206,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
// Paper end - moved up // Paper end - convert old users earlier after PlayerList creation but before file load/save
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
+ thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized + thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this); io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index 8f82041f0482df22a6a9ea38d50d56228131775d..12eeabafbad9da8796dc6fc383b732cf75bb7ddb 100644 index 8f82041f0482df22a6a9ea38d50d56228131775d..12eeabafbad9da8796dc6fc383b732cf75bb7ddb 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java

Datei anzeigen

@ -42,14 +42,14 @@ index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069ecce
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 3cacbbc03a3207656b71a1a05d95dbb750815bab..8f9ea1907ed4574cca8d362a0f207fb546cb6484 100644 index 5c455e4fba3e7b6064d869340667f48ed9cb3e9e..f9e39f557f04269769b869ff24127a6f312ddec3 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -209,6 +209,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -210,6 +210,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
io.papermc.paper.command.PaperCommands.registerCommands(this); io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
+ io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider + io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // Paper - init PaperBrigadierProvider
// Paper end
this.setPvpAllowed(dedicatedserverproperties.pvp); this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);

Datei anzeigen

@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case). load in that case).
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e00fe39fbcd4aa54eb498b91783b7e4dd021acc0..89396f956fc413f6ce53c2f66a85c395557aa883 100644 index 8b2f72be4304ebab84fc46e6c4c0984abd8e8905..dbfd4a642e862f46a8b4fd1f3fc52c13ecf74284 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -229,7 +229,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -229,7 +229,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -21,7 +21,7 @@ index e00fe39fbcd4aa54eb498b91783b7e4dd021acc0..89396f956fc413f6ce53c2f66a85c395
@Override @Override
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index da6995bcecfb16567b8a7c13b19d08ef3e5dc5d2..06446b61b79c24bb1df194706a587597a31e5a49 100644 index 761d01c993b60a11c749e172c3ee3067c055b582..35ca44c88497e0b07f43ba7bf092360365b1c53a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -204,6 +204,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -204,6 +204,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -37,7 +37,7 @@ index da6995bcecfb16567b8a7c13b19d08ef3e5dc5d2..06446b61b79c24bb1df194706a587597
+ +
public abstract ResourceKey<LevelStem> getTypeKey(); public abstract ResourceKey<LevelStem> getTypeKey();
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
index 0d5ae91a9b43df7b412968ab5faf5498c09169f9..744160405680babbb83c99abcbe2dc89bf312398 100644 index 0d5ae91a9b43df7b412968ab5faf5498c09169f9..744160405680babbb83c99abcbe2dc89bf312398 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java --- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java

Datei anzeigen

@ -29,16 +29,19 @@ index b44c596194f3e9fdd29f3eef1065612f46e7cd66..666533627e772e5e85ba04e65dd2b376
} }
entityhuman.awardStat(Stats.ITEM_USED.get(item)); // SPIGOT-7236 - award stat entityhuman.awardStat(Stats.ITEM_USED.get(item)); // SPIGOT-7236 - award stat
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 3a6615df0e9e0043cebe35268509b882893725fb..d5890f295350ae5fb6e4844c90f6ab8e3a5f5516 100644 index 7a4c21beaa4004f72cbfe75e567cafb3279a1c94..b8bf9eaae60040a3ba3d395712aa91940a71bea2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1898,4 +1898,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1898,4 +1898,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return null; return null;
} }
// Paper end - optimize redstone (Alternate Current) // Paper end - optimize redstone (Alternate Current)
+ // Paper start - notify observers even if grow failed + // Paper start - notify observers even if grow failed
+ public void checkCapturedTreeStateForObserverNotify(final BlockPos pos, final CraftBlockState craftBlockState) { + public void checkCapturedTreeStateForObserverNotify(final BlockPos pos, final CraftBlockState craftBlockState) {
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) { // notify observers if the block state is the same and the Y level equals the original y level (for mega trees) + // notify observers if the block state is the same and the Y level equals the original y level (for mega trees)
+ // blocks at the same Y level with the same state can be assumed to be saplings which trigger observers regardless of if the
+ // tree grew or not
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) { // Paper - Fix silent equipment change
+ this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512); + this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512);
+ } + }
+ } + }

Datei anzeigen

@ -46,22 +46,6 @@ index 8e9469fec42f7b6a132cf173f6f5a95777a29b3b..a383c0c8b5c89ef1eef7d18edc3a09f7
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.reassessWeaponGoal(); this.reassessWeaponGoal();
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index d5890f295350ae5fb6e4844c90f6ab8e3a5f5516..990bb65f784a2ac52e131d1ed146c2cd6dc19dce 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1900,7 +1900,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end - optimize redstone (Alternate Current)
// Paper start - notify observers even if grow failed
public void checkCapturedTreeStateForObserverNotify(final BlockPos pos, final CraftBlockState craftBlockState) {
- if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) { // notify observers if the block state is the same and the Y level equals the original y level (for mega trees)
+ // notify observers if the block state is the same and the Y level equals the original y level (for mega trees)
+ // blocks at the same Y level with the same state can be assumed to be saplings which trigger observers regardless of if the
+ // tree grew or not
+ if (craftBlockState.getPosition().getY() == pos.getY() && this.getBlockState(craftBlockState.getPosition()) == craftBlockState.getHandle()) { // Paper - Fix silent equipment change
this.notifyAndUpdatePhysics(craftBlockState.getPosition(), null, craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getHandle(), craftBlockState.getFlag(), 512);
}
}
diff --git a/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java b/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java diff --git a/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java b/src/test/java/io/papermc/paper/entity/EntitySetItemSlotSilentOverrideTest.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..81947843d1f2f7dc6f59d7b52f327d60b17d0dcc index 0000000000000000000000000000000000000000..81947843d1f2f7dc6f59d7b52f327d60b17d0dcc