Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 37 additions & 27 deletions src/main/java/dev/toolkitmc/guiapi/config/GuiApiConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class GuiApiConfig {
private boolean debugMode = false;
private boolean allowCloseOnMove = true;
private boolean allowDelayedActions = true;
private boolean allowStatusEffects = true; // 1. New Config
private boolean allowStatusEffects = true; // 1. New Config
private boolean logCommands = false; // 2. New Config
private int defaultTickRate = 20; // 3. New Config

Expand All @@ -41,8 +41,10 @@ public final class GuiApiConfig {
private boolean enableCloseSound = true; // 7. New Config

private String chatPrefix = "§8[§6GuiAPI§8] §f"; // 8. New Config
private int soundVolume = 100; // 9. New Config
private String commandExecuteMode = "CHAT"; // 10. New Config
private int soundVolume = 100; // 9. New Config
private String commandExecuteMode = "CHAT"; // 10. New Config

private boolean enableNoneAction = false; // 11. Experimental

private GuiApiConfig() {}

Expand Down Expand Up @@ -92,6 +94,8 @@ public void load() {
soundVolume = Math.clamp(obj.get("sound_volume").getAsInt(), 0, 100);
if (obj.has("command_execute_mode"))
commandExecuteMode = obj.get("command_execute_mode").getAsString();
if (obj.has("enable_none_action"))
enableNoneAction = obj.get("enable_none_action").getAsBoolean();

} catch (IOException e) {
GuiApiMod.LOGGER.error("[GuiAPI] Failed to load config: {}", e.getMessage());
Expand All @@ -112,11 +116,12 @@ public void save() {
obj.addProperty("default_tick_rate", defaultTickRate);
obj.addProperty("enable_button_glint", enableButtonGlint);
obj.addProperty("show_item_ids_developer", showItemIdsDeveloper);
obj.addProperty("mute_click_errors", muteClickErrors);
obj.addProperty("enable_close_sound", enableCloseSound);
obj.addProperty("mute_click_errors", muteClickErrors);
obj.addProperty("enable_close_sound", enableCloseSound);
obj.addProperty("chat_prefix", chatPrefix);
obj.addProperty("sound_volume", soundVolume);
obj.addProperty("command_execute_mode", commandExecuteMode);
obj.addProperty("enable_none_action", enableNoneAction);
try {
Files.writeString(CONFIG_PATH, GSON.toJson(obj));
} catch (IOException e) {
Expand All @@ -126,14 +131,16 @@ public void save() {

// ── Getters / Setters ────────────────────────────────────────────────────

public boolean isAllowConsoleRunWith() { return allowConsoleRunWith; }
public boolean isLogUnknownItems() { return logUnknownItems; }
public boolean isLogUnknownSounds() { return logUnknownSounds; }
public int getPermissionLevel() { return permissionLevel; }

public boolean isAllowConsoleRunWith() { return allowConsoleRunWith; }
public void setAllowConsoleRunWith(boolean v) { allowConsoleRunWith = v; }

public boolean isLogUnknownItems() { return logUnknownItems; }
public void setLogUnknownItems(boolean v) { logUnknownItems = v; }

public boolean isLogUnknownSounds() { return logUnknownSounds; }
public void setLogUnknownSounds(boolean v) { logUnknownSounds = v; }

public int getPermissionLevel() { return permissionLevel; }
public void setPermissionLevel(int v) { permissionLevel = Math.clamp(v, 0, 4); }

public boolean isDebugMode() { return debugMode; }
Expand All @@ -142,36 +149,39 @@ public void save() {
public boolean isAllowCloseOnMove() { return allowCloseOnMove; }
public void setAllowCloseOnMove(boolean v) { allowCloseOnMove = v; }

public boolean isAllowDelayedActions() { return allowDelayedActions; }
public void setAllowDelayedActions(boolean v) { allowDelayedActions = v; }
public boolean isAllowDelayedActions() { return allowDelayedActions; }
public void setAllowDelayedActions(boolean v) { allowDelayedActions = v; }

public boolean isAllowStatusEffects() { return allowStatusEffects; }
public void setAllowStatusEffects(boolean v) { allowStatusEffects = v; }

public boolean isLogCommands() { return logCommands; }
public void setLogCommands(boolean v) { logCommands = v; }

public int getDefaultTickRate() { return defaultTickRate; }
public int getDefaultTickRate() { return defaultTickRate; }
public void setDefaultTickRate(int v) { defaultTickRate = v; }

public boolean isEnableButtonGlint() { return enableButtonGlint; }
public void setEnableButtonGlint(boolean v) { enableButtonGlint = v; }
public boolean isEnableButtonGlint() { return enableButtonGlint; }
public void setEnableButtonGlint(boolean v) { enableButtonGlint = v; }

public boolean isShowItemIdsDeveloper() { return showItemIdsDeveloper; }
public void setShowItemIdsDeveloper(boolean v) { showItemIdsDeveloper = v; }

public boolean isShowItemIdsDeveloper() { return showItemIdsDeveloper; }
public void setShowItemIdsDeveloper(boolean v) { showItemIdsDeveloper = v; }
public boolean isMuteClickErrors() { return muteClickErrors; }
public void setMuteClickErrors(boolean v) { muteClickErrors = v; }

public boolean isMuteClickErrors() { return muteClickErrors; }
public void setMuteClickErrors(boolean v) { muteClickErrors = v; }
public boolean isEnableCloseSound() { return enableCloseSound; }
public void setEnableCloseSound(boolean v) { enableCloseSound = v; }

public boolean isEnableCloseSound() { return enableCloseSound; }
public void setEnableCloseSound(boolean v) { enableCloseSound = v; }
public String getChatPrefix() { return chatPrefix; }
public void setChatPrefix(String v) { chatPrefix = v; }

public String getChatPrefix() { return chatPrefix; }
public void setChatPrefix(String v) { chatPrefix = v; }
public int getSoundVolume() { return soundVolume; }
public void setSoundVolume(int v) { soundVolume = Math.clamp(v, 0, 100); }

public int getSoundVolume() { return soundVolume; }
public void setSoundVolume(int v) { soundVolume = Math.clamp(v, 0, 100); }
public String getCommandExecuteMode() { return commandExecuteMode; }
public void setCommandExecuteMode(String v) { commandExecuteMode = v; }

public String getCommandExecuteMode() { return commandExecuteMode; }
public void setCommandExecuteMode(String v) { commandExecuteMode = v; }
public boolean isEnableNoneAction() { return enableNoneAction; }
public void setEnableNoneAction(boolean v) { enableNoneAction = v; }
}
Loading