From d27f57afd41a5431f33e1d30a2dfdb8076086629 Mon Sep 17 00:00:00 2001 From: podium868909 <150333826+podium868909@users.noreply.github.com> Date: Sun, 8 Dec 2024 10:27:35 +0000 Subject: [PATCH] new config option for autohost to force resource pack to be optional (#162) * Added ModOverride config option for autohost, allowing the resourcepack to be forced as optional * oops renamed modOverride to mod_override --------- Co-authored-by: podium868909 --- .../autohost/api/ResourcePackDataProvider.java | 8 +++++--- .../pb4/polymer/autohost/impl/AutoHostConfig.java | 13 ++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/api/ResourcePackDataProvider.java b/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/api/ResourcePackDataProvider.java index 6a03fcb1..5b6c81b2 100644 --- a/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/api/ResourcePackDataProvider.java +++ b/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/api/ResourcePackDataProvider.java @@ -32,10 +32,12 @@ static void register(Identifier identifier, Supplier getProperties(ClientConnection connection); static MinecraftServer.ServerResourcePackProperties createProperties(@Nullable UUID uuid, String address, @Nullable String hash) { - return new MinecraftServer.ServerResourcePackProperties(uuid != null - ? uuid : UUID.nameUUIDFromBytes(address.getBytes(StandardCharsets.UTF_8)), + return new MinecraftServer.ServerResourcePackProperties( + uuid != null ? uuid : UUID.nameUUIDFromBytes(address.getBytes(StandardCharsets.UTF_8)), address, hash != null ? hash : "", - AutoHost.config.require || PolymerResourcePackUtils.isRequired(), AutoHost.message); + AutoHost.config.require || (AutoHost.config.modOverride && PolymerResourcePackUtils.isRequired()), + AutoHost.message + ); } } diff --git a/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/impl/AutoHostConfig.java b/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/impl/AutoHostConfig.java index f08fe028..5038465b 100644 --- a/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/impl/AutoHostConfig.java +++ b/polymer-autohost/src/main/java/eu/pb4/polymer/autohost/impl/AutoHostConfig.java @@ -18,14 +18,17 @@ public class AutoHostConfig { public String _c2 = "Marks resource pack as required"; @SerializedName("required") public boolean require = false; - public String _c3 = "Type of resource pack provider. Default: 'polymer:automatic'"; + public String _c3 = "Mods may override the above setting and make the resource pack required, set this to false to disable that."; + @SerializedName("mod_override") + public boolean modOverride = true; + public String _c4 = "Type of resource pack provider. Default: 'polymer:automatic'"; public String type = "polymer:automatic"; - public String _c4 = "Configuration of type, see provider's source for more details"; + public String _c5 = "Configuration of type, see provider's source for more details"; @SerializedName("settings") public JsonElement providerSettings = new JsonObject(); - public String _c5 = "Message sent to clients before pack is loaded"; + public String _c6 = "Message sent to clients before pack is loaded"; public JsonElement message = new JsonPrimitive("This server uses resource pack to enhance gameplay with custom textures and models. It might be unplayable without them."); - public String _c6 = "Disconnect message in case of failure"; + public String _c7 = "Disconnect message in case of failure"; @SerializedName("disconnect_message") public JsonElement disconnectMessage = new JsonPrimitive("Couldn't apply server resourcepack!"); @@ -39,4 +42,4 @@ public static class ExternalResourcePack { public String url; public String hash; } -} +} \ No newline at end of file