diff --git a/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java b/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java index 16936886..4545d463 100644 --- a/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java +++ b/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java @@ -475,6 +475,14 @@ public static class Advanced { @Config.LangKey("config.nomilabs.advanced.language_modify_option") public LanguageModifyOption languageModifyOption = LanguageModifyOption.LABS; + @Config.Comment({ "Whether to enable Substitutions for the Server Properties MOTD.", + "Substitutions: {version} for the Modpack Formatted Version (from 'nomilabs-version.cfg'), {mode} for the Modpack Formatted Mode (from LabsModeHelper & the PackMode Mod).", + "Note: Only the First Substitution in the String is Replaced!", + "[default: false]" }) + @Config.RequiresMcRestart + @Config.LangKey("config.nomilabs.advanced.server_motd_substitutions") + public boolean serverMotdSubstitutions = false; + public static class WindowOverrides { @Config.Comment({ "Override for the Minecraft Window Title.", diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/DedicatedServerMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/DedicatedServerMixin.java index a7d752e0..83120f60 100644 --- a/src/main/java/com/nomiceu/nomilabs/mixin/DedicatedServerMixin.java +++ b/src/main/java/com/nomiceu/nomilabs/mixin/DedicatedServerMixin.java @@ -14,12 +14,15 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.nomiceu.nomilabs.NomiLabs; +import com.nomiceu.nomilabs.config.LabsConfig; +import com.nomiceu.nomilabs.config.LabsVersionConfig; import com.nomiceu.nomilabs.mixinhelper.DifficultySettableServer; import com.nomiceu.nomilabs.util.LabsDifficultyHelper; import com.nomiceu.nomilabs.util.LabsModeHelper; @@ -34,6 +37,8 @@ *
* Allows for support of calling `setDifficultyForAllWorldsAndSave`, changing difficulty and saving to * `server.properties` on the fly. + *
+ * Also replaces {mode} and {server} with Labs Values if config says so.
*/
@Mixin(DedicatedServer.class)
public abstract class DedicatedServerMixin extends MinecraftServer implements DifficultySettableServer {
@@ -56,6 +61,17 @@ public void getLockedDifficulty(CallbackInfoReturnable