TF-EssentialsX/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java

41 lines
930 B
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import org.bukkit.Server;
2013-01-01 18:39:23 +00:00
import org.bukkit.inventory.Inventory;
public class Commandinvsee extends EssentialsCommand
{
public Commandinvsee()
{
super("invsee");
}
2013-01-01 18:39:23 +00:00
2013-01-01 19:34:32 +00:00
//This method has a hidden param, which if given will display the equip slots. #easteregg
@Override
2011-11-18 12:06:59 +00:00
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
2013-01-01 18:39:23 +00:00
final User invUser = getPlayer(server, args, 0);
2013-01-01 18:39:23 +00:00
Inventory inv;
2013-01-01 19:34:32 +00:00
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip"))
2013-01-01 18:39:23 +00:00
{
2013-01-01 19:34:32 +00:00
inv = server.createInventory(invUser, 9, "Equipped");
2013-01-01 18:39:23 +00:00
inv.setContents(invUser.getInventory().getArmorContents());
}
else
{
inv = invUser.getInventory();
}
user.openInventory(inv);
user.setInvSee(true);
}
}