v2.5.0: fixed custom item notes not properly assigning ID
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user