From 10ac4a36f1ec7104f5a3dad2d56040381246cf51 Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Sun, 13 Mar 2016 03:25:35 -0700 Subject: [PATCH] Color can be null????? --- .../denizen/objects/properties/item/ItemPotion.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemPotion.java b/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemPotion.java index f732dca473..930650161e 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemPotion.java +++ b/src/main/java/net/aufdemrand/denizen/objects/properties/item/ItemPotion.java @@ -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(); @@ -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 // ]> @@ -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); }