diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index e6ac632d4..d2c4b84ef 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -327,7 +327,7 @@ public class MetaItemStack return; } - if (split[0].equalsIgnoreCase("effect")) + if (split[0].equalsIgnoreCase("effect") || (allowShortName && split[0].equalsIgnoreCase("e"))) { pEffectType = Potions.getByName(split[1]); if (pEffectType != null) @@ -345,11 +345,11 @@ public class MetaItemStack } else { - user.sendMessage("Invalid potion effect"); + user.sendMessage(_("invalidPotionEffect", split[1])); canceledEffect = true; } } - else if (split[0].equalsIgnoreCase("power")) + else if (split[0].equalsIgnoreCase("power") || (allowShortName && split[0].equalsIgnoreCase("p"))) { if (Util.isInt(split[1])) { @@ -357,7 +357,7 @@ public class MetaItemStack power = Integer.parseInt(split[1]); } } - else if (split[0].equalsIgnoreCase("duration") || split[0].equalsIgnoreCase("dur")) + else if (split[0].equalsIgnoreCase("duration") || (allowShortName && split[0].equalsIgnoreCase("d"))) { if (Util.isInt(split[1])) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java index 212c5e1eb..ff246ba59 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java @@ -14,6 +14,7 @@ import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -47,14 +48,21 @@ public class Commandpotion extends EssentialsCommand if (stack.getType() == Material.POTION) { + PotionMeta pmeta = (PotionMeta)stack.getItemMeta(); if (args.length > 0) { if (args[0].equalsIgnoreCase("clear")) { - PotionMeta pmeta = (PotionMeta)stack.getItemMeta(); pmeta.clearCustomEffects(); stack.setItemMeta(pmeta); } + else if (args[0].equalsIgnoreCase("apply") && user.isAuthorized("essentials.potion.apply")) + { + for(PotionEffect effect : pmeta.getCustomEffects()) + { + effect.apply(user); + } + } else { final MetaItemStack mStack = new MetaItemStack(stack); @@ -64,12 +72,12 @@ public class Commandpotion extends EssentialsCommand } if (mStack.completePotion()) { - PotionMeta pmeta = (PotionMeta)mStack.getItemStack().getItemMeta(); + pmeta = (PotionMeta)mStack.getItemStack().getItemMeta(); stack.setItemMeta(pmeta); } else { - user.sendMessage("Invalid potion"); + user.sendMessage("invalidPotion"); throw new NotEnoughArgumentsException(); } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 953c4c093..29470cbe4 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 3499482bc..0bf86588e 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -503,3 +503,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 391e415c9..632890f99 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index f6af8c9d6..8fb540f49 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 953c4c093..29470cbe4 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 00ffc2ed0..93151901b 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 14f6a76af..5515c59d8 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index b18b2a688..f879729c4 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index d9fd3f723..350738fba 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index c8ff0493b..b3dd767a7 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 743bbb90a..1dd52af2a 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 4fae721ef..acb4e3d81 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 240db04b2..257b60331 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -500,3 +500,4 @@ bed=\u00a7obed\u00a7r invalidPotionEffect=\u00a74You do not have permissions to apply potion effect \u00a7c{0} \u00a74to this potion potions=\u00a76Potions:\u00a7r {0} holdPotion=\u00a74You must be holding a potion to apply effects to it +invalidPotion=\u00a74Invalid Potion diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 216103e1b..3330da4ee 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -268,7 +268,7 @@ commands: aliases: [pong,echo,echo,eping,epong] potion: description: Adds custom potion effects to a potion. - usage: / effect: power: duration: + usage: / power: duration:> aliases: [epotion,elixer,eelixer] powertool: description: Assigns a command to the item in hand.