Command related patches

This commit is contained in:
AlphaKR93
2025-02-24 01:53:56 +09:00
parent 637b0ef8cb
commit 55fbffae38
24 changed files with 1029 additions and 402 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/Services.java
+++ b/net/minecraft/server/Services.java
@@ -6,26 +_,42 @@
@@ -6,35 +_,55 @@
import com.mojang.authlib.yggdrasil.ServicesKeyType;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import java.io.File;
@@ -47,11 +47,14 @@
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();
GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository();
@@ -34,7 +_,11 @@
final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath();
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 legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath(); // Plazma - Remove legacy paper config transformation
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"));
- 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);
+ io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(configDirPath, profileRepository.toPath(), (File) optionSet.valueOf("spigot-settings")); // Plazma - Remove legacy paper config transformation
+
+ // Plazma start - Configurable Plazma
+ final org.plazmamc.plazma.configurations.PlazmaConfigurations plazmaConfigurations = org.plazmamc.plazma.configurations.PlazmaConfigurations.create(optionSet);

View File

@@ -0,0 +1,24 @@
--- a/net/minecraft/server/commands/TickCommand.java
+++ b/net/minecraft/server/commands/TickCommand.java
@@ -21,6 +_,8 @@
dispatcher.register(
Commands.literal("tick")
.requires(commandSourceStack -> commandSourceStack.hasPermission(3))
+ .executes(context -> toggleFreeze(context.getSource()))
+ .then(Commands.literal("toggle").executes(context -> toggleFreeze(context.getSource())))
.then(Commands.literal("query").executes(commandContext -> tickQuery(commandContext.getSource())))
.then(
Commands.literal("rate")
@@ -113,6 +_,12 @@
source.sendSuccess(() -> Component.translatable("commands.tick.status.sprinting"), true);
return 1;
}
+
+ // Plazma start - /tick toggle
+ private static int toggleFreeze(final CommandSourceStack source) {
+ return setFreeze(source, !source.getServer().tickRateManager().isFrozen());
+ }
+ // Plazma end - /tick toggle
private static int setFreeze(CommandSourceStack source, boolean frozen) {
ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager();

View File

@@ -140,7 +140,7 @@
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()) {
@@ -234,15 +_,7 @@
@@ -234,16 +_,8 @@
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
@@ -153,10 +153,12 @@
- }
- org.purpurmc.purpur.PurpurConfig.registerCommands();
- */// Purpur end - Purpur config files // Purpur - Configurable void damage height and damage
- com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
+ // noinspection ResultOfMethodCallIgnored // Plazma - For preloading
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
+ com.destroystokyo.paper.VersionHistoryManager.initialize(options); // Paper - load version history now // Plazma - Add options to modify the configuration files
this.setPvpAllowed(properties.pvp);
this.setFlightAllowed(properties.allowFlight);
@@ -287,8 +_,7 @@
LOGGER.warn("**** FAILED TO BIND TO PORT!");
LOGGER.warn("The exception was: {}", var10.toString());