Skip to content

Commit

Permalink
Color can be null?????
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 13, 2016
1 parent 1e5fe11 commit 10ac4a3
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -53,8 +53,10 @@ public String getPropertyString() {
.append(pot.getAmplifier()).append(",")
.append(pot.getDuration()).append(",")
.append(pot.isAmbient()).append(",")
.append(pot.hasParticles()).append(",")
.append(new dColor(pot.getColor()).identify().replace(",", "&comma"));
.append(pot.hasParticles()).append(",");
if (pot.getColor() != null) {
sb.append(new dColor(pot.getColor()).identify().replace(",", "&comma"));
}
effects.add(sb.toString());
}
return effects.identify();
Expand Down Expand Up @@ -232,7 +234,7 @@ public void adjust(Mechanism mechanism) {
// @input dList
// @description
// Sets the potion's potion effect(s).
// Input is a formed like: Effect,Upgraded,Extended|Type,Amplifier,Duration,Ambient,Particles,Color|...
// Input is a formed like: Effect,Upgraded,Extended|Type,Amplifier,Duration,Ambient,Particles(,Color)|...
// For example: SPEED,true,false|SPEED,2,200,false,true,red
// @tags
// <i@item.potion_effect[<#>]>
Expand All @@ -255,7 +257,7 @@ public void adjust(Mechanism mechanism) {
String[] d2 = data.get(i).split(",");
meta.addCustomEffect(new PotionEffect(PotionEffectType.getByName(d2[0].toUpperCase()),
new Element(d2[2]).asInt(), new Element(d2[1]).asInt(), new Element(d2[3]).asBoolean(),
new Element(d2[4]).asBoolean(), dColor.valueOf(d2[5].replace("&comma", ",")).getColor()), false);
new Element(d2[4]).asBoolean(), d2.length >= 5 ? dColor.valueOf(d2[5].replace("&comma", ",")).getColor(): null), false);
}
item.getItemStack().setItemMeta(meta);
}
Expand Down

0 comments on commit 10ac4a3

Please sign in to comment.