mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-06-29 18:41:43 +00:00
Un-deletes deleted things.
This commit is contained in:
parent
631e0bbd0a
commit
37029e6b5d
16 changed files with 29 additions and 8 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue