From 9cef107bc348b75bf363bb90a4cbdbef54ca0e02 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Mon, 21 Jan 2013 13:39:52 +0000 Subject: Fix a couple of param issues. --- Essentials/src/com/earth2me/essentials/MetaItemStack.java | 5 +++++ Essentials/src/com/earth2me/essentials/commands/Commandbook.java | 5 ++++- Essentials/src/com/earth2me/essentials/commands/Commandfirework.java | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index aabc2db1b..5eadc3935 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -175,6 +175,11 @@ public class MetaItemStack FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); final String[] split = splitPattern.split(string, 2); + if (split.length < 2) + { + return; + } + if (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour") || (allowShortName && split[0].equalsIgnoreCase("c"))) { List primaryColors = new ArrayList(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbook.java b/Essentials/src/com/earth2me/essentials/commands/Commandbook.java index 79fd5fefe..1bfca2e1d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbook.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbook.java @@ -69,7 +69,10 @@ public class Commandbook extends EssentialsCommand else if (item.getType() == Material.BOOK_AND_QUILL) { BookMeta bmeta = (BookMeta)item.getItemMeta(); - bmeta.setAuthor(player); + if (!user.isAuthorized("essentals.book.author")) + { + bmeta.setAuthor(player); + } ItemStack newItem = new ItemStack(Material.WRITTEN_BOOK, item.getAmount()); newItem.setItemMeta(bmeta); user.setItemInHand(newItem); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java index 567836420..c1f553fae 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java @@ -45,7 +45,7 @@ public class Commandfirework extends EssentialsCommand { if (args.length > 0) { - final ItemStack stack = user.getItemInHand(); + final ItemStack stack = user.getItemInHand(); if (stack.getType() == Material.FIREWORK) { if (args.length > 0) @@ -65,7 +65,8 @@ public class Commandfirework extends EssentialsCommand { final String[] split = splitPattern.split(arg, 2); mStack.addFireworkMeta(user, true, arg, ess); - if (split[0].equalsIgnoreCase("fire") && user.isAuthorized("essentials.firework.fire")) + + if (split.length > 1 && split[0].equalsIgnoreCase("fire") && user.isAuthorized("essentials.firework.fire")) { fire = true; try -- cgit v1.2.3