This commit is contained in:
Iaccidentally 2013-01-16 21:23:17 -05:00
commit 19ccdf2193
3 changed files with 39 additions and 6 deletions

View File

@ -7,6 +7,9 @@ import java.util.List;
import java.util.Locale;
import java.util.regex.Pattern;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Builder;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
@ -94,13 +97,43 @@ public class MetaItemStack
meta.setTitle(title);
stack.setItemMeta(meta);
}
else if (split.length > 1 && split[0].equalsIgnoreCase("power") && stack.getType() == Material.FIREWORK)
{
final int power = Integer.parseInt(split[1]);
final FireworkMeta meta = (FireworkMeta)stack.getItemMeta();
meta.setPower(power);
stack.setItemMeta(meta);
}
// else if (split.length > 1 && split[0].equalsIgnoreCase("effect") && stack.getType() == Material.FIREWORK)
// {
// //TODO: Add validation messages
// final FireworkMeta meta = (FireworkMeta)stack.getItemMeta();
// Builder builder = FireworkEffect.builder();
//
// String[] effectData = split[1].toUpperCase(Locale.ENGLISH).split("\\|");
//
// builder.with(FireworkEffect.Type.valueOf(effectData[0]));
//
// String[] primaryColorStrings = effectData[1].split(",");
// List<Color> primaryColors = new ArrayList<Color>();
//
// for (String primaryColorString : primaryColorStrings) {
// primaryColors.add(DyeColor.valueOf(primaryColorString).getFireworkColor());
// }
//
// builder.withColor(primaryColors);
//
// final FireworkEffect effect = builder.build();
// meta.addEffect(effect);
// stack.setItemMeta(meta);
// }
else if (split.length > 1 && (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour"))
&& (stack.getType() == Material.LEATHER_BOOTS
|| stack.getType() == Material.LEATHER_CHESTPLATE
|| stack.getType() == Material.LEATHER_HELMET
|| stack.getType() == Material.LEATHER_LEGGINGS))
{
final String[] color = split[1].split("\\|");
final String[] color = split[1].split(",");
if (color.length == 3)
{
final int red = Util.isInt(color[0]) ? Integer.parseInt(color[0]) : 0;

View File

@ -25,26 +25,26 @@ public class Commandbook extends EssentialsCommand
{
BookMeta bmeta = (BookMeta)item.getItemMeta();
if (args[0].equalsIgnoreCase("author"))
if (args.length > 1 && args[0].equalsIgnoreCase("author"))
{
if (user.isAuthorized("essentals.book.author"))
{
bmeta.setAuthor(args[1]);
item.setItemMeta(bmeta);
user.sendMessage(_("bookAuthorSet", args[1]));
user.sendMessage(_("bookAuthorSet", getFinalArg(args, 1)));
}
else
{
throw new Exception(_("denyChangeAuthor"));
}
}
else if (args[0].equalsIgnoreCase("title"))
else if (args.length > 1 && args[0].equalsIgnoreCase("title"))
{
if (user.isAuthorized("essentials.book.title") && (isAuthor(bmeta, player) || user.isAuthorized("essentials.book.others")))
{
bmeta.setTitle(args[1]);
item.setItemMeta(bmeta);
user.sendMessage(_("bookTitleSet", args[1]));
user.sendMessage(_("bookTitleSet", getFinalArg(args, 1)));
}
else
{

View File

@ -222,7 +222,7 @@ kits:
items:
- 278 1 efficiency:1 durability:1 fortune:1 name:&4Gigadrill lore:The_drill_that_&npierces|the_heavens
- 277 1 digspeed:3 name:Dwarf lore:Diggy|Diggy|Hole
- 298 1 color:255|255|255 name:Top_Hat lore:Good_day,_Good_day
- 298 1 color:255,255,255 name:Top_Hat lore:Good_day,_Good_day
- 279:780 1
notch:
delay: 6000