Skip to content
Draft
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
82 changes: 82 additions & 0 deletions src/main/java/com/hyperfactions/config/CoreConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,88 @@ protected JsonObject toJson() {
public boolean isAdminRequiresOp() { return adminRequiresOp; }
public boolean isAllowWithoutPermissionMod() { return allowWithoutPermissionMod; }

// === Setters (Config GUI) ===

// Faction
public void setMaxMembers(int value) { this.maxMembers = value; needsSave = true; }
public void setMaxNameLength(int value) { this.maxNameLength = value; needsSave = true; }
public void setMinNameLength(int value) { this.minNameLength = value; needsSave = true; }
public void setAllowColors(boolean value) { this.allowColors = value; needsSave = true; }

// Power
public void setMaxPlayerPower(double value) { this.maxPlayerPower = value; needsSave = true; }
public void setStartingPower(double value) { this.startingPower = value; needsSave = true; }
public void setPowerPerClaim(double value) { this.powerPerClaim = value; needsSave = true; }
public void setDeathPenalty(double value) { this.deathPenalty = value; needsSave = true; }
public void setKillReward(double value) { this.killReward = value; needsSave = true; }
public void setRegenPerMinute(double value) { this.regenPerMinute = value; needsSave = true; }
public void setRegenWhenOffline(boolean value) { this.regenWhenOffline = value; needsSave = true; }

// Claims
public void setMaxClaims(int value) { this.maxClaims = value; needsSave = true; }
public void setOnlyAdjacent(boolean value) { this.onlyAdjacent = value; needsSave = true; }
public void setPreventDisconnect(boolean value) { this.preventDisconnect = value; needsSave = true; }
public void setDecayEnabled(boolean value) { this.decayEnabled = value; needsSave = true; }
public void setDecayDaysInactive(int value) { this.decayDaysInactive = value; needsSave = true; }
public void setWorldWhitelist(@NotNull List<String> value) { this.worldWhitelist = new ArrayList<>(value); needsSave = true; }
public void setWorldBlacklist(@NotNull List<String> value) { this.worldBlacklist = new ArrayList<>(value); needsSave = true; }

// Combat
public void setTagDurationSeconds(int value) { this.tagDurationSeconds = value; needsSave = true; }
public void setAllyDamage(boolean value) { this.allyDamage = value; needsSave = true; }
public void setFactionDamage(boolean value) { this.factionDamage = value; needsSave = true; }
public void setTaggedLogoutPenalty(boolean value) { this.taggedLogoutPenalty = value; needsSave = true; }
public void setLogoutPowerLoss(double value) { this.logoutPowerLoss = value; needsSave = true; }
public void setNeutralAttackPenalty(double value) { this.neutralAttackPenalty = value; needsSave = true; }

// Spawn Protection
public void setSpawnProtectionEnabled(boolean value) { this.spawnProtectionEnabled = value; needsSave = true; }
public void setSpawnProtectionDurationSeconds(int value) { this.spawnProtectionDurationSeconds = value; needsSave = true; }
public void setSpawnProtectionBreakOnAttack(boolean value) { this.spawnProtectionBreakOnAttack = value; needsSave = true; }
public void setSpawnProtectionBreakOnMove(boolean value) { this.spawnProtectionBreakOnMove = value; needsSave = true; }

// Relations
public void setMaxAllies(int value) { this.maxAllies = value; needsSave = true; }
public void setMaxEnemies(int value) { this.maxEnemies = value; needsSave = true; }

// Invites
public void setInviteExpirationMinutes(int value) { this.inviteExpirationMinutes = value; needsSave = true; }
public void setJoinRequestExpirationHours(int value) { this.joinRequestExpirationHours = value; needsSave = true; }

// Stuck
public void setStuckWarmupSeconds(int value) { this.stuckWarmupSeconds = value; needsSave = true; }
public void setStuckCooldownSeconds(int value) { this.stuckCooldownSeconds = value; needsSave = true; }

// Teleport
public void setWarmupSeconds(int value) { this.warmupSeconds = value; needsSave = true; }
public void setCooldownSeconds(int value) { this.cooldownSeconds = value; needsSave = true; }
public void setCancelOnMove(boolean value) { this.cancelOnMove = value; needsSave = true; }
public void setCancelOnDamage(boolean value) { this.cancelOnDamage = value; needsSave = true; }

// Updates
public void setUpdateCheckEnabled(boolean value) { this.updateCheckEnabled = value; needsSave = true; }
public void setReleaseChannel(@NotNull String value) { this.releaseChannel = value; needsSave = true; }

// Auto-save
public void setAutoSaveEnabled(boolean value) { this.autoSaveEnabled = value; needsSave = true; }
public void setAutoSaveIntervalMinutes(int value) { this.autoSaveIntervalMinutes = value; needsSave = true; }

// Messages
public void setPrefixText(@NotNull String value) { this.prefixText = value; needsSave = true; }
public void setPrefixColor(@NotNull String value) { this.prefixColor = value; needsSave = true; }
public void setPrefixBracketColor(@NotNull String value) { this.prefixBracketColor = value; needsSave = true; }
public void setPrimaryColor(@NotNull String value) { this.primaryColor = value; needsSave = true; }

// GUI
public void setGuiTitle(@NotNull String value) { this.guiTitle = value; needsSave = true; }

// Territory Notifications
public void setTerritoryNotificationsEnabled(boolean value) { this.territoryNotificationsEnabled = value; needsSave = true; }

// Permissions
public void setAdminRequiresOp(boolean value) { this.adminRequiresOp = value; needsSave = true; }
public void setAllowWithoutPermissionMod(boolean value) { this.allowWithoutPermissionMod = value; needsSave = true; }

// === Utility Methods ===

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/hyperfactions/config/ModuleConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public boolean isEnabled() {
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
needsSave = true;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,15 @@ public boolean isAllianceFormed() {
public boolean isAllianceBroken() {
return allianceBroken;
}

// === Setters (Config GUI) ===

public void setEnabled(boolean value) { this.enabled = value; needsSave = true; }
public void setFactionCreated(boolean value) { this.factionCreated = value; needsSave = true; }
public void setFactionDisbanded(boolean value) { this.factionDisbanded = value; needsSave = true; }
public void setLeadershipTransfer(boolean value) { this.leadershipTransfer = value; needsSave = true; }
public void setOverclaim(boolean value) { this.overclaim = value; needsSave = true; }
public void setWarDeclared(boolean value) { this.warDeclared = value; needsSave = true; }
public void setAllianceFormed(boolean value) { this.allianceFormed = value; needsSave = true; }
public void setAllianceBroken(boolean value) { this.allianceBroken = value; needsSave = true; }
}
10 changes: 10 additions & 0 deletions src/main/java/com/hyperfactions/config/modules/BackupConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ public int getShutdownRetention() {
return shutdownRetention;
}

// === Setters (Config GUI) ===

public void setEnabled(boolean value) { this.enabled = value; needsSave = true; }
public void setHourlyRetention(int value) { this.hourlyRetention = value; needsSave = true; }
public void setDailyRetention(int value) { this.dailyRetention = value; needsSave = true; }
public void setWeeklyRetention(int value) { this.weeklyRetention = value; needsSave = true; }
public void setManualRetention(int value) { this.manualRetention = value; needsSave = true; }
public void setOnShutdown(boolean value) { this.onShutdown = value; needsSave = true; }
public void setShutdownRetention(int value) { this.shutdownRetention = value; needsSave = true; }

// === Validation ===

@Override
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/hyperfactions/config/modules/ChatConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,29 @@ public int getHistoryCleanupIntervalMinutes() {
return historyCleanupIntervalMinutes;
}

// === Setters (Config GUI) ===

public void setFormat(@NotNull String value) { this.format = value; needsSave = true; }
public void setTagDisplay(@NotNull String value) { this.tagDisplay = value; needsSave = true; }
public void setTagFormat(@NotNull String value) { this.tagFormat = value; needsSave = true; }
public void setNoFactionTag(@NotNull String value) { this.noFactionTag = value; needsSave = true; }
public void setNoFactionTagColor(@NotNull String value) { this.noFactionTagColor = value; needsSave = true; }
public void setPriority(@NotNull String value) { this.priority = value; needsSave = true; }
public void setRelationColorOwn(@NotNull String value) { this.relationColorOwn = value; needsSave = true; }
public void setRelationColorAlly(@NotNull String value) { this.relationColorAlly = value; needsSave = true; }
public void setRelationColorNeutral(@NotNull String value) { this.relationColorNeutral = value; needsSave = true; }
public void setRelationColorEnemy(@NotNull String value) { this.relationColorEnemy = value; needsSave = true; }
public void setFactionChatColor(@NotNull String value) { this.factionChatColor = value; needsSave = true; }
public void setFactionChatPrefix(@NotNull String value) { this.factionChatPrefix = value; needsSave = true; }
public void setAllyChatColor(@NotNull String value) { this.allyChatColor = value; needsSave = true; }
public void setAllyChatPrefix(@NotNull String value) { this.allyChatPrefix = value; needsSave = true; }
public void setSenderNameColor(@NotNull String value) { this.senderNameColor = value; needsSave = true; }
public void setMessageColor(@NotNull String value) { this.messageColor = value; needsSave = true; }
public void setHistoryEnabled(boolean value) { this.historyEnabled = value; needsSave = true; }
public void setHistoryMaxMessages(int value) { this.historyMaxMessages = value; needsSave = true; }
public void setHistoryRetentionDays(int value) { this.historyRetentionDays = value; needsSave = true; }
public void setHistoryCleanupIntervalMinutes(int value) { this.historyCleanupIntervalMinutes = value; needsSave = true; }

// === Validation ===

@Override
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/hyperfactions/config/modules/DebugConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ public boolean isSpawning() {

// === Setters (for runtime toggle) ===

public void setLogToConsole(boolean value) {
this.logToConsole = value;
needsSave = true;
applyToLogger();
}

public void setEnabledByDefault(boolean value) {
this.enabledByDefault = value;
needsSave = true;
}

/**
* Sets power debug state and applies to Logger.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ public String formatWithName(double amount) {
return String.format("%.2f %s", amount, name);
}

// === Setters (Config GUI) ===

public void setEnabled(boolean value) { this.enabled = value; needsSave = true; }
public void setCurrencyName(@NotNull String value) { this.currencyName = value; needsSave = true; }
public void setCurrencyNamePlural(@NotNull String value) { this.currencyNamePlural = value; needsSave = true; }
public void setCurrencySymbol(@NotNull String value) { this.currencySymbol = value; needsSave = true; }
public void setStartingBalance(double value) { this.startingBalance = value; needsSave = true; }

// === Validation ===

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,26 @@ public FactionPermissions getEffectiveFactionPermissions(@NotNull FactionPermiss
public boolean isPermissionLocked(@NotNull String permissionName) {
return locks.getOrDefault(permissionName, false);
}

// === Setters (Config GUI) ===

public void setDefault(@NotNull String flagName, boolean value) {
defaults.put(flagName, value);
needsSave = true;
}

public void setLock(@NotNull String flagName, boolean value) {
locks.put(flagName, value);
needsSave = true;
}

@NotNull
public Map<String, Boolean> getDefaults() {
return defaults;
}

@NotNull
public Map<String, Boolean> getLocks() {
return locks;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,15 @@ public boolean isProtectInWilderness() {
public boolean isAnnounceDeathLocation() {
return announceDeathLocation;
}

// === Setters (Config GUI) ===

public void setEnabled(boolean value) { this.enabled = value; needsSave = true; }
public void setProtectInOwnTerritory(boolean value) { this.protectInOwnTerritory = value; needsSave = true; }
public void setFactionMembersCanAccess(boolean value) { this.factionMembersCanAccess = value; needsSave = true; }
public void setAlliesCanAccess(boolean value) { this.alliesCanAccess = value; needsSave = true; }
public void setProtectInSafeZone(boolean value) { this.protectInSafeZone = value; needsSave = true; }
public void setProtectInWarZone(boolean value) { this.protectInWarZone = value; needsSave = true; }
public void setProtectInWilderness(boolean value) { this.protectInWilderness = value; needsSave = true; }
public void setAnnounceDeathLocation(boolean value) { this.announceDeathLocation = value; needsSave = true; }
}
13 changes: 13 additions & 0 deletions src/main/java/com/hyperfactions/config/modules/WorldMapConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,17 @@ public boolean isShowFactionTags() {
public int getFactionWideRefreshThreshold() {
return factionWideRefreshThreshold;
}

// === Setters (Config GUI) ===

public void setEnabled(boolean value) { this.enabled = value; needsSave = true; }
public void setShowFactionTags(boolean value) { this.showFactionTags = value; needsSave = true; }
public void setAutoFallbackOnError(boolean value) { this.autoFallbackOnError = value; needsSave = true; }
public void setFactionWideRefreshThreshold(int value) { this.factionWideRefreshThreshold = value; needsSave = true; }
public void setProximityChunkRadius(int value) { this.proximityChunkRadius = value; needsSave = true; }
public void setProximityBatchIntervalTicks(int value) { this.proximityBatchIntervalTicks = value; needsSave = true; }
public void setProximityMaxChunksPerBatch(int value) { this.proximityMaxChunksPerBatch = value; needsSave = true; }
public void setIncrementalBatchIntervalTicks(int value) { this.incrementalBatchIntervalTicks = value; needsSave = true; }
public void setIncrementalMaxChunksPerBatch(int value) { this.incrementalMaxChunksPerBatch = value; needsSave = true; }
public void setDebouncedDelaySeconds(int value) { this.debouncedDelaySeconds = value; needsSave = true; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.jetbrains.annotations.Nullable;

/**
* Event data for the Admin Config page (placeholder).
* Event data for the Admin Config page.
*/
public class AdminConfigData implements AdminNavAwareData {

Expand All @@ -16,19 +16,59 @@ public class AdminConfigData implements AdminNavAwareData {
/** Admin nav bar target (for navigation) */
public String adminNavBar;

/** Tab to switch to */
public String tab;

/** Config key being modified */
public String key;

/** Value from UI controls */
public String value;

/** List item identifier (for array add/remove) */
public String listItem;

/** Role selector (for permissions matrix) */
public String role;

/** Codec for serialization/deserialization */
public static final BuilderCodec<AdminConfigData> CODEC = BuilderCodec
.builder(AdminConfigData.class, AdminConfigData::new)
.addField(
new KeyedCodec<>("Button", Codec.STRING),
(data, value) -> data.button = value,
(data, v) -> data.button = v,
data -> data.button
)
.addField(
new KeyedCodec<>("AdminNavBar", Codec.STRING),
(data, value) -> data.adminNavBar = value,
(data, v) -> data.adminNavBar = v,
data -> data.adminNavBar
)
.addField(
new KeyedCodec<>("Tab", Codec.STRING),
(data, v) -> data.tab = v,
data -> data.tab
)
.addField(
new KeyedCodec<>("Key", Codec.STRING),
(data, v) -> data.key = v,
data -> data.key
)
.addField(
new KeyedCodec<>("Value", Codec.STRING),
(data, v) -> data.value = v,
data -> data.value
)
.addField(
new KeyedCodec<>("ListItem", Codec.STRING),
(data, v) -> data.listItem = v,
data -> data.listItem
)
.addField(
new KeyedCodec<>("Role", Codec.STRING),
(data, v) -> data.role = v,
data -> data.role
)
.build();

public AdminConfigData() {
Expand Down
Loading