Skip to content

Commit

Permalink
Apply a stupid bandaid to the taking of potions
Browse files Browse the repository at this point in the history
They refuse to take properly ... so cheat hard instead of fixing the
broken potion system >.>
  • Loading branch information
mcmonkey4eva committed Jan 11, 2015
1 parent af3852f commit bc3451e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ public boolean removeItem(dItem item, int amount) {
is = is.clone();
int count = is.getAmount();
is.setAmount(1);
String newItem = CoreUtilities.toLowerCase(new dItem(is).getFullString());
// Note: this double-parsing is intentional, as part of a hotfix for a larger issue
String newItem = CoreUtilities.toLowerCase(dItem.valueOf(new dItem(is).getFullString()).getFullString());
if (myItem.equals(newItem)) {
if (count <= amount) {
inventory.setItem(i, null);
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/net/aufdemrand/denizen/objects/dItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,10 @@ else if (isItemscript()) {
}

// Else, return the material name
return "i@" + dMaterial.getMaterialFrom(item.getType(),
item.getData().getData()).identify().replace("m@", "") + PropertyParser.getPropertiesString(this);
if (item.getDurability() >= 16 || item.getDurability() < 0) {
return "i@" + getMaterial().realName() + "," + item.getDurability() + PropertyParser.getPropertiesString(this);
}
return "i@" + getMaterial().identify().replace("m@", "") + PropertyParser.getPropertiesString(this);
}


Expand Down Expand Up @@ -507,7 +509,7 @@ public String identifyMaterial() {
}

public String getFullString() {
return "i@" + (isItemscript() ? getScriptName(): getMaterial().name()) + "," + item.getDurability() + PropertyParser.getPropertiesString(this);
return "i@" + (isItemscript() ? getScriptName(): getMaterial().realName()) + "," + item.getDurability() + PropertyParser.getPropertiesString(this);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public void adjust(Mechanism mechanism) {
if (!pot.getType().isInstant())
pot.setHasExtendedDuration(data2.asBoolean());
pot.setSplash(data3.asBoolean());
item.setDurability((short)0);
pot.apply(item.getItemStack());
}
}
Expand Down

0 comments on commit bc3451e

Please sign in to comment.