Skip to content

Commit

Permalink
only show test plugin toggle if it is enabled in the config
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn committed Aug 10, 2024
1 parent be05829 commit d457f0e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 25 deletions.
5 changes: 0 additions & 5 deletions platform/fabric/src/main/resources/waila_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,5 @@
"initializer": "mcp.mobius.waila.plugin.trenergy.WailaPluginTeamRebornEnergy",
"side" : "*",
"required" : ["team_reborn_energy"]
},

"waila:test" : {
"initializer" : "mcp.mobius.waila.plugin.test.WailaPluginTest",
"defaultEnabled": false
}
}
9 changes: 2 additions & 7 deletions platform/forge/src/main/resources/waila_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"required" : ["minecraft"]
},

"waila:harvest" : {
"waila:harvest": {
"initializer": "mcp.mobius.waila.plugin.harvest.WailaPluginHarvest",
"side" : "*",
"required" : []
Expand All @@ -23,14 +23,9 @@
"required" : []
},

"waila:forge" : {
"waila:forge" : {
"initializer": "mcp.mobius.waila.plugin.forge.WailaPluginForge",
"side" : "*",
"required" : ["forge"]
},

"waila:test" : {
"initializer" : "mcp.mobius.waila.plugin.test.WailaPluginTest",
"defaultEnabled": false
}
}
9 changes: 2 additions & 7 deletions platform/neo/src/main/resources/waila_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"required" : ["minecraft"]
},

"waila:harvest" : {
"waila:harvest": {
"initializer": "mcp.mobius.waila.plugin.harvest.WailaPluginHarvest",
"side" : "*",
"required" : []
Expand All @@ -23,14 +23,9 @@
"required" : []
},

"waila:neo" : {
"waila:neo" : {
"initializer": "mcp.mobius.waila.plugin.neo.WailaPluginNeo",
"side" : "*",
"required" : ["neoforge"]
},

"waila:test" : {
"initializer" : "mcp.mobius.waila.plugin.test.WailaPluginTest",
"defaultEnabled": false
}
}
5 changes: 0 additions & 5 deletions platform/quilt/src/main/resources/waila_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,5 @@
"initializer": "mcp.mobius.waila.plugin.trenergy.WailaPluginTeamRebornEnergy",
"side" : "*",
"required" : ["team_reborn_energy"]
},

"waila:test" : {
"initializer" : "mcp.mobius.waila.plugin.test.WailaPluginTest",
"defaultEnabled": false
}
}
10 changes: 9 additions & 1 deletion src/main/java/mcp/mobius/waila/config/WailaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ interface Nested {}
private final General general = new General();
private final Overlay overlay = new Overlay();

@IJsonConfig.Comment("Text Formatter")
@IJsonConfig.Comment("Text formatters")
private final Formatter formatter = new Formatter();

@IJsonConfig.Comment("Debug options, restart the game to apply")
public final Debug debug = new Debug();

@IJsonConfig.Comment("Internal value, DO NOT TOUCH!")
private int configVersion = 0;

Expand Down Expand Up @@ -469,4 +472,9 @@ public Component registryName(Object registryName) {

}

public static class Debug implements Nested {
@IJsonConfig.Comment("Show test plugin on plugin toggle screen")
public boolean showTestPluginToggle = false;
}

}
6 changes: 6 additions & 0 deletions src/main/java/mcp/mobius/waila/plugin/PluginLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
import lol.bai.badpackets.api.PacketSender;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.api.WailaConstants;
import mcp.mobius.waila.api.__internal__.Internals;
import mcp.mobius.waila.config.JsonConfig;
import mcp.mobius.waila.config.PluginConfig;
import mcp.mobius.waila.config.WailaConfig;
import mcp.mobius.waila.mcless.version.VersionRanges;
import mcp.mobius.waila.network.common.s2c.BlacklistSyncCommonS2CPacket;
import mcp.mobius.waila.network.common.s2c.ConfigSyncCommonS2CPacket;
Expand Down Expand Up @@ -141,6 +143,10 @@ public final void loadPlugins() {
if (!gathered) {
gathered = true;
gatherPlugins();

if (Waila.CONFIG.get().debug.showTestPluginToggle) {
PluginInfo.register(WailaConstants.MOD_ID, Waila.id("test").toString(), IPluginInfo.Side.BOTH, "mcp.mobius.waila.plugin.test.WailaPluginTest", List.of(), false, false);
}
}

PluginInfo.saveToggleConfig();
Expand Down

0 comments on commit d457f0e

Please sign in to comment.