Un-deletes deleted things.

This commit is contained in:
GunfighterJ 2013-02-08 17:13:36 -06:00
parent 631e0bbd0a
commit 37029e6b5d
16 changed files with 29 additions and 8 deletions

View File

@ -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]))
{

View File

@ -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();
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -268,7 +268,7 @@ commands:
aliases: [pong,echo,echo,eping,epong]
potion:
description: Adds custom potion effects to a potion.
usage: /<command> effect:<effect> power:<power> duration:<duration>
usage: /<command> <clear|apply|effect:<effect> power:<power> duration:<duration>>
aliases: [epotion,elixer,eelixer]
powertool:
description: Assigns a command to the item in hand.