mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-03 22:26:19 +00:00
142 lines
11 KiB
Diff
142 lines
11 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Wed, 23 Nov 2022 21:05:47 +0100
|
|
Subject: [PATCH] Gale configuration
|
|
|
|
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Paper config files"
|
|
By: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
As part of: Paper (https://github.com/PaperMC/Paper)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index d6dcb6d146d89a8fb96e7c669e5deb802223abd6..84f4f0c87f904a31f3f972e9fb1da8a01474dfca 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -300,6 +300,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public volatile boolean abnormalExit; // Paper - Improved watchdog support
|
|
public volatile Thread shutdownThread; // Paper - Improved watchdog support
|
|
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
|
+ public final org.galemc.gale.configuration.GaleConfigurations galeConfigurations; // Gale - Gale configuration
|
|
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
|
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
|
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
|
@@ -471,6 +472,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
|
// CraftBukkit end
|
|
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
|
|
+ this.galeConfigurations = services.galeConfigurations(); // Gale - Gale configuration
|
|
}
|
|
|
|
private void readScoreboard(DimensionDataStorage dataStorage) {
|
|
diff --git a/net/minecraft/server/Services.java b/net/minecraft/server/Services.java
|
|
index 015e3ff8d856a7722def4448d8c68792cc3a32a2..e7c3d84d64cc62989c01019b71c499ae39ea3a41 100644
|
|
--- a/net/minecraft/server/Services.java
|
|
+++ b/net/minecraft/server/Services.java
|
|
@@ -11,13 +11,13 @@ import net.minecraft.server.players.GameProfileCache;
|
|
import net.minecraft.util.SignatureValidator;
|
|
|
|
public record Services(
|
|
- MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations // Paper - add paper configuration files
|
|
+ MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations, @javax.annotation.Nullable org.galemc.gale.configuration.GaleConfigurations galeConfigurations // Paper - add paper configuration files // Gale - Gale configuration
|
|
) {
|
|
public static final String USERID_CACHE_FILE = "usercache.json";
|
|
|
|
// Paper start - add paper configuration files
|
|
public Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) {
|
|
- this(sessionService, servicesKeySet, profileRepository, profileCache, null);
|
|
+ this(sessionService, servicesKeySet, profileRepository, profileCache, null, null); // Gale - Gale configuration
|
|
}
|
|
|
|
@Override
|
|
@@ -25,6 +25,12 @@ public record Services(
|
|
return java.util.Objects.requireNonNull(this.paperConfigurations);
|
|
}
|
|
// Paper end - add paper configuration files
|
|
+ // Gale start - Gale configuration
|
|
+ @Override
|
|
+ public org.galemc.gale.configuration.GaleConfigurations galeConfigurations() {
|
|
+ return java.util.Objects.requireNonNull(this.galeConfigurations);
|
|
+ }
|
|
+ // Gale end - Gale configuration
|
|
|
|
public static Services create(YggdrasilAuthenticationService authenticationService, File profileRepository, File userCacheFile, joptsimple.OptionSet optionSet) throws Exception { // Paper - add optionset to load paper config files; add userCacheFile parameter
|
|
MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService();
|
|
@@ -34,7 +40,10 @@ public record Services(
|
|
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();
|
|
io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(legacyConfigPath, configDirPath, profileRepository.toPath(), (File) optionSet.valueOf("spigot-settings"));
|
|
- return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache, paperConfigurations);
|
|
+ // Gale start - Gale configuration
|
|
+ org.galemc.gale.configuration.GaleConfigurations galeConfigurations = org.galemc.gale.configuration.GaleConfigurations.setup(configDirPath);
|
|
+ return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache, paperConfigurations, galeConfigurations);
|
|
+ // Gale end - Gale configuration
|
|
// Paper end - load paper config files from cli options
|
|
}
|
|
|
|
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 5fea5e2e9fc10d348fa3e65cd354ef6a4a717a4d..92a6376d4a242f4ca276cf8232f083d9734f5ee9 100644
|
|
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -171,6 +171,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
|
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
|
// Paper end - initialize global and world-defaults configuration
|
|
+ // Gale start - Gale configuration
|
|
+ galeConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
|
+ galeConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
|
+ // Gale end - Gale configuration
|
|
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
|
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
|
if (this.convertOldUsers()) {
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index dda8d38ef61672cc714d9e5a475f9b0412ed5ff9..b4c983216cd839d793a09e327bb2f15ab90cbff8 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -583,7 +583,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit
|
|
) {
|
|
// CraftBukkit start
|
|
- super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
|
|
+ super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), spigotConfig -> server.galeConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs; Async-Anti-Xray: Pass executor // Gale - Gale configuration
|
|
this.pvpMode = server.isPvpAllowed();
|
|
this.levelStorageAccess = levelStorageAccess;
|
|
this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getOrCreate(levelStorageAccess.levelDirectory.path().toFile());
|
|
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
|
index c41df4b1fff1f65532256e835dc30fadbb4f8c8b..4b96e512905aca3b69408145054c0658ee932eed 100644
|
|
--- a/net/minecraft/world/level/Level.java
|
|
+++ b/net/minecraft/world/level/Level.java
|
|
@@ -159,6 +159,12 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
|
return this.paperConfig;
|
|
}
|
|
// Paper end - add paper world config
|
|
+ // Gale start - Gale configuration
|
|
+ private final org.galemc.gale.configuration.GaleWorldConfiguration galeConfig;
|
|
+ public org.galemc.gale.configuration.GaleWorldConfiguration galeConfig() {
|
|
+ return this.galeConfig;
|
|
+ }
|
|
+ // Gale end - Gale configuration
|
|
|
|
public static @Nullable BlockPos lastPhysicsProblem; // Spigot
|
|
private int tileTickPosition;
|
|
@@ -827,6 +833,8 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
|
org.bukkit.World.Environment environment, // Paper
|
|
java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Spigot - create per world config
|
|
io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, // Paper - create paper world config
|
|
+ java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Gale - Gale configuration
|
|
+ org.galemc.gale.configuration.GaleWorldConfiguration> galeWorldConfigCreator, // Gale - Gale configuration
|
|
java.util.concurrent.Executor executor // Paper - Anti-Xray
|
|
) {
|
|
// Paper start - getblock optimisations - cache world height/sections
|
|
@@ -840,6 +848,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
|
// Paper end - getblock optimisations - cache world height/sections
|
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot
|
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
|
+ this.galeConfig = galeWorldConfigCreator.apply(this.spigotConfig); // Gale - Gale configuration
|
|
this.generator = generator;
|
|
this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment);
|
|
|