Skip to content

Commit

Permalink
lock down configs
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Apr 8, 2024
1 parent 60e532e commit 79584a1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
53 changes: 30 additions & 23 deletions src/main/java/minetweaker/mc1710/MineTweakerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,34 @@

public class MineTweakerConfig {
private MineTweakerConfig() { }
public static boolean handleDesktopPackets = false, handleLoadScripts = true, sendLoadScripts = true,
sendScriptsOnReloading = true, loadScriptsBeforeConnection = false, antiStuck = true;
static File file;

public static void load() {
Configuration config = new Configuration(file, "1");
config.load();
handleDesktopPackets = config.getBoolean("handleDesktopPackets",
"network", false, "Handle OpenBrowser and CopyClipboard packets? Insecure.");
handleLoadScripts = config.getBoolean("handleLoadScripts", "network", true,
"Proccess LoadScripts packet on client? Insecure, takes time, but update scripts on the fly...");

sendLoadScripts = config.getBoolean("sendLoadScripts",
"network", true, "Send scripts to players on logging in");
sendScriptsOnReloading = config.getBoolean("sendScriptsOnReloading",
"network", true, "Send scripts to players on command \"mt reload\"");

loadScriptsBeforeConnection = config.getBoolean("loadScriptsBeforeConnection",
"core", false, "Load scripts before connect to server? Save time and traffic. Requires server with disabled sendLoadScripts.");
antiStuck = config.getBoolean("antiStuck",
"core", false, "Do not reload scripts when relogging, saves time. Usable when playing on one server/singleplayer...");
config.save();
}

/**
* Handle OpenBrowser and CopyClipboard packets? Insecure.
*/
public static final boolean handleDesktopPackets = false;

/**
* Process LoadScripts packet on client? Insecure, takes time, but update scripts on the fly...
*/
public static final boolean handleLoadScripts = true;

/**
* Send scripts to players on logging in
*/
public static final boolean sendLoadScripts = true;

/**
* Send scripts to players on command "mt reload"
*/
public static final boolean sendScriptsOnReloading = true;

/**
* Load scripts before connect to server? Save time and traffic. Requires server with disabled sendLoadScripts.
*/
public static final boolean loadScriptsBeforeConnection = false;

/**
* Do not reload scripts when relogging, saves time. Usable when playing on one server/singleplayer...
*/
public static final boolean antiStuck = false;
}
2 changes: 0 additions & 2 deletions src/main/java/minetweaker/mc1710/MineTweakerMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ public void onIMCEvent(FMLInterModComms.IMCEvent event) {

@EventHandler
public void onLoad(FMLPreInitializationEvent ev) {
MineTweakerConfig.file = new File(ev.getModConfigurationDirectory(), MODID + ".cfg");
MineTweakerConfig.load();
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
}
Expand Down

0 comments on commit 79584a1

Please sign in to comment.