v2.5.0: fixed custom item notes not properly assigning ID

This commit is contained in:
Evan Debenham
2024-07-05 12:22:28 -04:00
parent a0225ad4a3
commit 02728ae770
2 changed files with 9 additions and 2 deletions

View File

@@ -365,7 +365,7 @@ public class Notes {
protected CustomType type;
protected int ID;
protected int ID = -1;
protected Class itemClass;
protected String title;
@@ -393,6 +393,12 @@ public class Notes {
body = desc;
}
public void assignID(){
if (ID == -1) {
ID = nextCustomID++;
}
}
public int ID(){
return ID;
}
@@ -575,7 +581,7 @@ public class Notes {
}
public static boolean add( CustomRecord rec ){
rec.ID = nextCustomID++;
rec.assignID();
if (!records.contains(rec)){
boolean result = records.add(rec);
Collections.sort(records, comparator);

View File

@@ -167,6 +167,7 @@ public class CustomNoteButton extends IconButton {
public void onSelect( Item item ) {
if (item != null){
Notes.CustomRecord custom = new Notes.CustomRecord(item, "", "");
custom.assignID();
if (item instanceof EquipableItem){
((EquipableItem) item).customNoteID = custom.ID();
}