Using updated config

This commit is contained in:
2026-03-05 23:45:03 +01:00
parent daf71b0e8c
commit e8671640e3
67 changed files with 487 additions and 1127 deletions
@@ -13,6 +13,7 @@ import java.util.Map;
public class ConfigManager {
private static final ObjectMapper MAPPER = new ObjectMapper();
private static File configFile;
// SINGLE ROOT TREE
private static final Map<String, Property<?>> ROOT = new LinkedHashMap<>();
@@ -23,13 +24,21 @@ public class ConfigManager {
private final String[] path;
private File configFile;
/**
* Creates a root namespace
*/
public ConfigManager(File configFile, String namespace) {
this.configFile = configFile;
ConfigManager.configFile = configFile;
this.currentMap = new LinkedHashMap<>();
this.path = new String[] { namespace };
ROOT.put(namespace, Property.namespace(currentMap));
}
/**
* Creates a root namespace
*/
public ConfigManager(String namespace) {
this.currentMap = new LinkedHashMap<>();
this.path = new String[] { namespace };
@@ -40,7 +49,6 @@ public class ConfigManager {
* Creates a sub-namespace inside a parent
*/
public ConfigManager(ConfigManager parent, String namespace) {
this.configFile = parent.configFile;
this.currentMap = new LinkedHashMap<>();
this.path = new String[parent.path.length + 1];
@@ -80,7 +88,7 @@ public class ConfigManager {
/**
* Save entire config
*/
public void save() {
public static void save() {
ObjectNode rootJson = MAPPER.createObjectNode();
saveRecursive(rootJson, ROOT);
@@ -271,15 +271,14 @@ public class Property<T> {
// ---------- Keybindings (no SaturnClient) ----------
public boolean isKeyPressed(long windowHandle, boolean screenOpen) {
public boolean isKeyPressed() {
return (Integer) value != -1 &&
MinecraftProvider.PROVIDER.isKeyPressed((Integer) value) && !screenOpen;
MinecraftProvider.PROVIDER.isKeyPressed((Integer) value);
}
public boolean wasKeyPressed(long windowHandle, boolean screenOpen) {
boolean pressed = isKeyPressed(windowHandle, screenOpen);
public boolean wasKeyPressed() {
boolean pressed = isKeyPressed();
boolean result = pressed && !wasPressedLastTick;