mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 20:29:20 +00:00
![Trent Hensler](/assets/img/avatar_default.png)
Handling this with armor and without NMS isn't clean. Advise using OpenInv if players want extended capability.
This reverts commit 6eb63fd3fd
.
33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
package com.earth2me.essentials.commands;
|
|
|
|
import com.earth2me.essentials.User;
|
|
import org.bukkit.Server;
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
|
|
public class Commandinvsee extends EssentialsCommand {
|
|
public Commandinvsee() {
|
|
super("invsee");
|
|
}
|
|
|
|
//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();
|
|
}
|
|
|
|
final User invUser = getPlayer(server, user, args, 0);
|
|
Inventory inv;
|
|
|
|
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip")) {
|
|
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);
|
|
}
|
|
}
|