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

34 lines
1.1 KiB
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;
2015-04-15 04:06:16 +00:00
public class Commandinvsee extends EssentialsCommand {
public Commandinvsee() {
super("invsee");
}
2015-04-15 04:06:16 +00:00
//This method has a hidden param, which if given will display the equip slots. #easteregg
@Override
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
2015-04-15 04:06:16 +00:00
final User invUser = getPlayer(server, user, args, 0);
Inventory inv;
2013-01-01 18:39:23 +00:00
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip")) {
2015-04-15 04:06:16 +00:00
inv = server.createInventory(invUser.getBase(), 9, "Equipped");
inv.setContents(invUser.getBase().getInventory().getArmorContents());
} else {
inv = invUser.getBase().getInventory();
}
user.getBase().closeInventory();
user.getBase().openInventory(inv);
user.setInvSee(true);
}
}