summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-01-21 23:38:03 +0000
committerKHobbits <rob@khobbits.co.uk>2013-01-21 23:38:03 +0000
commit378eaaaf1fdcfac15398dc286b22df7871669a45 (patch)
tree535e2e2f5f979e8095e2adfe42cb427ae914af47
parent51a55318d09a0da4481eddc52bd97d37e7f2b834 (diff)
downloadEssentials-378eaaaf1fdcfac15398dc286b22df7871669a45.tar
Essentials-378eaaaf1fdcfac15398dc286b22df7871669a45.tar.gz
Essentials-378eaaaf1fdcfac15398dc286b22df7871669a45.tar.lz
Essentials-378eaaaf1fdcfac15398dc286b22df7871669a45.tar.xz
Essentials-378eaaaf1fdcfac15398dc286b22df7871669a45.zip
Small patch to allow multiple firework effects to be defined in kits.
-rw-r--r--Essentials/src/com/earth2me/essentials/MetaItemStack.java15
-rw-r--r--Essentials/src/config.yml1
2 files changed, 13 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java
index c28e16671..958fb34f4 100644
--- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java
+++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java
@@ -10,6 +10,7 @@ import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Firework;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.*;
@@ -140,7 +141,7 @@ public class MetaItemStack
else if (split.length > 1 && split[0].equalsIgnoreCase("power") && stack.getType() == Material.FIREWORK)
{
final int power = Util.isInt(split[1]) ? Integer.parseInt(split[1]) : 0;
- final FireworkMeta meta = (FireworkMeta)stack.getItemMeta();
+ final FireworkMeta meta = (FireworkMeta)stack.getItemMeta();
meta.setPower(power > 3 ? 4 : power);
stack.setItemMeta(meta);
}
@@ -179,7 +180,6 @@ public class MetaItemStack
{
if (stack.getType() == Material.FIREWORK)
{
- FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
final String[] split = splitPattern.split(string, 2);
if (split.length < 2)
@@ -189,6 +189,15 @@ public class MetaItemStack
if (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour") || (allowShortName && split[0].equalsIgnoreCase("c")))
{
+ if (validFirework)
+ {
+ FireworkEffect effect = builder.build();
+ FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
+ fmeta.addEffect(effect);
+ stack.setItemMeta(fmeta);
+ builder = FireworkEffect.builder();
+ }
+
List<Color> primaryColors = new ArrayList<Color>();
String[] colors = split[1].split(",");
for (String color : colors)
@@ -202,7 +211,7 @@ public class MetaItemStack
{
user.sendMessage(_("fireworkSyntax"));
throw new Exception(_("invalidFireworkFormat", split[1], split[0]));
-
+
}
}
builder.withColor(primaryColors);
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index bdd154838..87afc3ac2 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -237,6 +237,7 @@ kits:
items:
- 401 1 name:Angry_Creeper color:red fade:green type:creeper power:1
- 401 1 name:StarryNight color:yellow,orange fade:blue type:star effect:trail,twinkle power:1
+ - 401 2 name:SolarWind color:yellow,orange fade:red shape:large effect:twinkle color:yellow,orange fade:red shape:ball effect:trail color:red,purple fade:pink shape:star effect:trail power:1
# Essentials Sign Control
# See http://wiki.ess3.net/wiki/Sign_Tutorial for instructions on how to use these.