mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 23:07:40 +01:00
41 lines
3.1 KiB
Diff
41 lines
3.1 KiB
Diff
--- a/net/minecraft/server/Services.java
|
|
+++ b/net/minecraft/server/Services.java
|
|
@@ -10,16 +10,32 @@
|
|
import net.minecraft.server.players.GameProfileCache;
|
|
import net.minecraft.util.SignatureValidator;
|
|
|
|
+
|
|
public record Services(
|
|
- MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache
|
|
+ MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations // Paper - add paper configuration files
|
|
) {
|
|
- private 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);
|
|
+ }
|
|
|
|
- public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory) {
|
|
+ @Override
|
|
+ public io.papermc.paper.configuration.PaperConfigurations paperConfigurations() {
|
|
+ return java.util.Objects.requireNonNull(this.paperConfigurations);
|
|
+ }
|
|
+ // Paper end - add paper configuration files
|
|
+ public static final String USERID_CACHE_FILE = "usercache.json"; // Paper - private -> public
|
|
+
|
|
+ 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();
|
|
GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository();
|
|
- GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, new File(rootDirectory, "usercache.json"));
|
|
- return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache);
|
|
+ GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, userCacheFile); // Paper - use specified user cache file
|
|
+ // 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 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"));
|
|
+ return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache, paperConfigurations);
|
|
+ // Paper end - load paper config files from cli options
|
|
}
|
|
|
|
@Nullable
|