From 74d02cbabf978515de7fc8d9a82e2f4040ff4280 Mon Sep 17 00:00:00 2001 From: Thom van den Akker Date: Mon, 19 Aug 2024 15:11:03 +0200 Subject: [PATCH 1/3] Do not run needless patreon auth checks --- .../api/configuration/ServerConfiguration.java | 2 ++ .../core/client/gui/townhall/WindowMainPage.java | 10 ++++++++-- .../assets/minecolonies/lang/manual_en_us.json | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java b/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java index 3d216a13864..4225287b561 100755 --- a/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java +++ b/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java @@ -18,6 +18,7 @@ public class ServerConfiguration extends AbstractConfiguration * ------------------- ######## Gameplay settings ######## ------------------- * * --------------------------------------------------------------------------- */ + public final ForgeConfigSpec.BooleanValue doPatreonCheck; public final ForgeConfigSpec.IntValue initialCitizenAmount; public final ForgeConfigSpec.BooleanValue allowInfiniteSupplyChests; public final ForgeConfigSpec.BooleanValue allowInfiniteColonies; @@ -129,6 +130,7 @@ protected ServerConfiguration(final ForgeConfigSpec.Builder builder) { createCategory(builder, "gameplay"); + doPatreonCheck = defineBoolean(builder, "dopatreoncheck", false); initialCitizenAmount = defineInteger(builder, "initialcitizenamount", 4, 1, 10); allowInfiniteSupplyChests = defineBoolean(builder, "allowinfinitesupplychests", false); allowInfiniteColonies = defineBoolean(builder, "allowinfinitecolonies", false); diff --git a/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java b/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java index 6e8aaea8bdf..820bcd3c3e4 100644 --- a/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java +++ b/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java @@ -9,11 +9,15 @@ import com.ldtteam.blockui.views.DropDownList; import com.ldtteam.structurize.client.gui.WindowSwitchPack; import com.ldtteam.structurize.storage.StructurePacks; +import com.minecolonies.api.MinecoloniesAPIProxy; import com.minecolonies.core.Network; import com.minecolonies.core.client.gui.WindowBannerPicker; import com.minecolonies.core.client.gui.map.WindowColonyMap; import com.minecolonies.core.colony.buildings.workerbuildings.BuildingTownHall; -import com.minecolonies.core.network.messages.server.colony.*; +import com.minecolonies.core.network.messages.server.colony.ColonyNameStyleMessage; +import com.minecolonies.core.network.messages.server.colony.ColonyStructureStyleMessage; +import com.minecolonies.core.network.messages.server.colony.ColonyTextureStyleMessage; +import com.minecolonies.core.network.messages.server.colony.TeamColonyColorChangeMessage; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.Minecraft; @@ -311,7 +315,9 @@ public void onUpdate() */ public void checkFeatureUnlock() { - if (!building.getColony().getPermissions().getOwner().equals(Minecraft.getInstance().player.getUUID())) + if (!MinecoloniesAPIProxy.getInstance().getConfig().getServer().doPatreonCheck.get() + || isFeatureUnlocked.get() + || !building.getColony().getPermissions().getOwner().equals(Minecraft.getInstance().player.getUUID())) { return; } diff --git a/src/main/resources/assets/minecolonies/lang/manual_en_us.json b/src/main/resources/assets/minecolonies/lang/manual_en_us.json index 96441c23650..e82ad9e2192 100644 --- a/src/main/resources/assets/minecolonies/lang/manual_en_us.json +++ b/src/main/resources/assets/minecolonies/lang/manual_en_us.json @@ -93,6 +93,7 @@ "com.minecolonies.coremod.gui.workerhuts.togglerestrictionon": "Restriction (on)", "com.minecolonies.coremod.gui.workerhuts.togglerestrictionoff": "Restriction (off)", + "minecolonies.config.dopatreoncheck": "Enable the Patreon feature unlocks check", "minecolonies.config.initialcitizenamount": "Initital Citizen Count", "minecolonies.config.initialcitizenamount.comment": "Amount of initial citizens.", "minecolonies.config.builderplaceconstructiontape": "Construction Tape Placement", From 0e4db3bd035173fffd42705f2a93c04ed0ec699a Mon Sep 17 00:00:00 2001 From: Thom van den Akker Date: Mon, 19 Aug 2024 15:12:01 +0200 Subject: [PATCH 2/3] Update --- src/main/resources/assets/minecolonies/lang/manual_en_us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/minecolonies/lang/manual_en_us.json b/src/main/resources/assets/minecolonies/lang/manual_en_us.json index e82ad9e2192..8da68e4cbe5 100644 --- a/src/main/resources/assets/minecolonies/lang/manual_en_us.json +++ b/src/main/resources/assets/minecolonies/lang/manual_en_us.json @@ -93,7 +93,7 @@ "com.minecolonies.coremod.gui.workerhuts.togglerestrictionon": "Restriction (on)", "com.minecolonies.coremod.gui.workerhuts.togglerestrictionoff": "Restriction (off)", - "minecolonies.config.dopatreoncheck": "Enable the Patreon feature unlocks check", + "minecolonies.config.dopatreoncheck": "Enable the Patreon feature unlocks check", "minecolonies.config.initialcitizenamount": "Initital Citizen Count", "minecolonies.config.initialcitizenamount.comment": "Amount of initial citizens.", "minecolonies.config.builderplaceconstructiontape": "Construction Tape Placement", From 25ab483744c87c4f992c5f6409b2b601ed356c55 Mon Sep 17 00:00:00 2001 From: Thom van den Akker Date: Mon, 19 Aug 2024 15:49:18 +0200 Subject: [PATCH 3/3] Remove config --- .../minecolonies/api/configuration/ServerConfiguration.java | 2 -- .../core/client/gui/townhall/WindowMainPage.java | 5 +---- .../resources/assets/minecolonies/lang/manual_en_us.json | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java b/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java index 4225287b561..3d216a13864 100755 --- a/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java +++ b/src/main/java/com/minecolonies/api/configuration/ServerConfiguration.java @@ -18,7 +18,6 @@ public class ServerConfiguration extends AbstractConfiguration * ------------------- ######## Gameplay settings ######## ------------------- * * --------------------------------------------------------------------------- */ - public final ForgeConfigSpec.BooleanValue doPatreonCheck; public final ForgeConfigSpec.IntValue initialCitizenAmount; public final ForgeConfigSpec.BooleanValue allowInfiniteSupplyChests; public final ForgeConfigSpec.BooleanValue allowInfiniteColonies; @@ -130,7 +129,6 @@ protected ServerConfiguration(final ForgeConfigSpec.Builder builder) { createCategory(builder, "gameplay"); - doPatreonCheck = defineBoolean(builder, "dopatreoncheck", false); initialCitizenAmount = defineInteger(builder, "initialcitizenamount", 4, 1, 10); allowInfiniteSupplyChests = defineBoolean(builder, "allowinfinitesupplychests", false); allowInfiniteColonies = defineBoolean(builder, "allowinfinitecolonies", false); diff --git a/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java b/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java index 820bcd3c3e4..deb65ccd624 100644 --- a/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java +++ b/src/main/java/com/minecolonies/core/client/gui/townhall/WindowMainPage.java @@ -9,7 +9,6 @@ import com.ldtteam.blockui.views.DropDownList; import com.ldtteam.structurize.client.gui.WindowSwitchPack; import com.ldtteam.structurize.storage.StructurePacks; -import com.minecolonies.api.MinecoloniesAPIProxy; import com.minecolonies.core.Network; import com.minecolonies.core.client.gui.WindowBannerPicker; import com.minecolonies.core.client.gui.map.WindowColonyMap; @@ -315,9 +314,7 @@ public void onUpdate() */ public void checkFeatureUnlock() { - if (!MinecoloniesAPIProxy.getInstance().getConfig().getServer().doPatreonCheck.get() - || isFeatureUnlocked.get() - || !building.getColony().getPermissions().getOwner().equals(Minecraft.getInstance().player.getUUID())) + if (isFeatureUnlocked.get() || !building.getColony().getPermissions().getOwner().equals(Minecraft.getInstance().player.getUUID())) { return; } diff --git a/src/main/resources/assets/minecolonies/lang/manual_en_us.json b/src/main/resources/assets/minecolonies/lang/manual_en_us.json index 8da68e4cbe5..96441c23650 100644 --- a/src/main/resources/assets/minecolonies/lang/manual_en_us.json +++ b/src/main/resources/assets/minecolonies/lang/manual_en_us.json @@ -93,7 +93,6 @@ "com.minecolonies.coremod.gui.workerhuts.togglerestrictionon": "Restriction (on)", "com.minecolonies.coremod.gui.workerhuts.togglerestrictionoff": "Restriction (off)", - "minecolonies.config.dopatreoncheck": "Enable the Patreon feature unlocks check", "minecolonies.config.initialcitizenamount": "Initital Citizen Count", "minecolonies.config.initialcitizenamount.comment": "Amount of initial citizens.", "minecolonies.config.builderplaceconstructiontape": "Construction Tape Placement",