Skip to content

Commit

Permalink
reduce risk of notable property issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 25, 2019
1 parent 50c69cf commit 6fe3ae0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
Expand Up @@ -1578,6 +1578,10 @@ public String getAttribute(Attribute attribute) {
}

public void applyProperty(Mechanism mechanism) {
if (NotableManager.isExactSavedObject(this)) {
dB.echoError("Cannot apply properties to noted objects.");
return;
}
adjust(mechanism);
}

Expand Down
Expand Up @@ -2130,6 +2130,10 @@ else if (slot > getInventory().getSize() - 1) {
private ArrayList<Mechanism> mechanisms = new ArrayList<Mechanism>();

public void applyProperty(Mechanism mechanism) {
if (NotableManager.isExactSavedObject(this)) {
dB.echoError("Cannot apply properties to noted objects.");
return;
}
if (idType == null) {
mechanisms.add(mechanism);
}
Expand Down
Expand Up @@ -1064,6 +1064,10 @@ public String getAttribute(Attribute attribute) {


public void applyProperty(Mechanism mechanism) {
if (NotableManager.isExactSavedObject(this)) {
dB.echoError("Cannot apply properties to noted objects.");
return;
}
adjust(mechanism);
}

Expand Down
Expand Up @@ -55,6 +55,15 @@ public static boolean isSaved(Notable object) {
}


public static boolean isExactSavedObject(Notable object) {
String id = reverseObjects.get(object);
if (id == null) {
return false;
}
// Reference equality
return notableObjects.get(id) == object;
}

public static Notable getSavedObject(String id) {
if (notableObjects.containsKey(CoreUtilities.toLowerCase(id))) {
return notableObjects.get(CoreUtilities.toLowerCase(id));
Expand Down

0 comments on commit 6fe3ae0

Please sign in to comment.