mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 20:09:49 +00:00
Merge upstream dev: name-based storage, UUID/DisplayName, toggle system
Resolved conflicts in AbstractDataAbilities, DataAbilities, PlayerAbilityData to integrate both toggle system (upstream) and chain delay tracking (local). ChainedAbility now has UUID and DisplayName fields matching Ability pattern. ChainedAbilityController rewritten: saves in abilities/chained/, dual-index by name and UUID, legacy migration from chained_abilities/ directory. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
commit
0311dc5806
14 files changed
+628
-148
No files matched your search
@@ -22,7 +22,9 @@ public class ChainedAbility implements IChainedAbility, IAbilityAction {
|
||||
// CONFIGURATION (saved to NBT)
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
private String name = "";
|
||||
private String id = ""; // UUID (stable persistent reference)
|
||||
private String name = ""; // Unique file key / identifier
|
||||
private String displayName = ""; // Cosmetic name (falls back to name when empty)
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
@@ -60,6 +62,14 @@ public class ChainedAbility implements IChainedAbility, IAbilityAction {
|
||||
// GETTERS / SETTERS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id != null ? id : "";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -68,6 +78,22 @@ public class ChainedAbility implements IChainedAbility, IAbilityAction {
|
||||
this.name = name != null ? name : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the display name for this chained ability.
|
||||
* Returns displayName if set, otherwise falls back to name.
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return (displayName != null && !displayName.isEmpty()) ? displayName : name;
|
||||
}
|
||||
|
||||
public String getRawDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName != null ? displayName : "";
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
@@ -288,7 +314,9 @@ public class ChainedAbility implements IChainedAbility, IAbilityAction {
|
||||
|
||||
public NBTTagCompound writeNBT() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("Id", id);
|
||||
nbt.setString("Name", name);
|
||||
nbt.setString("DisplayName", displayName);
|
||||
nbt.setBoolean("Enabled", enabled);
|
||||
nbt.setInteger("Weight", weight);
|
||||
nbt.setBoolean("WindUpAll", windUpAll);
|
||||
@@ -315,7 +343,9 @@ public class ChainedAbility implements IChainedAbility, IAbilityAction {
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
id = nbt.getString("Id");
|
||||
name = nbt.getString("Name");
|
||||
displayName = nbt.getString("DisplayName");
|
||||
enabled = !nbt.hasKey("Enabled") || nbt.getBoolean("Enabled");
|
||||
weight = nbt.hasKey("Weight") ? nbt.getInteger("Weight") : 10;
|
||||
windUpAll = !nbt.hasKey("WindUpAll") || nbt.getBoolean("WindUpAll");
|
||||
|
||||
Reference in new issue
Block a user