mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Fix /invsee (#79)
This commit is contained in:
parent
650f732dd4
commit
bd44173a14
@ -9,10 +9,9 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = " Look into another player's inventory, optionally take items out.", usage = "/<command> <player> [offhand | armor]", aliases = "inv,insee")
|
||||
@CommandParameters(description = "Look into another player's inventory, optionally take items out.", usage = "/<command> <player> [offhand | armor]", aliases = "inv,insee")
|
||||
public class Command_invsee extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -38,11 +37,16 @@ public class Command_invsee extends FreedomCommand
|
||||
|
||||
if (plugin.al.isAdmin(player) && !plugin.al.isAdmin(playerSender))
|
||||
{
|
||||
msg("You can't spy on admins!");
|
||||
msg("You cannot spy on administrators.");
|
||||
return true;
|
||||
|
||||
}
|
||||
if(args.length >= 2)
|
||||
|
||||
Inventory inv;
|
||||
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
if (args[1].equals("offhand"))
|
||||
{
|
||||
@ -57,7 +61,7 @@ public class Command_invsee extends FreedomCommand
|
||||
playerSender.openInventory(inventory);
|
||||
return true;
|
||||
}
|
||||
if (args[1].equals("armor"))
|
||||
else if (args[1].equals("armor"))
|
||||
{
|
||||
Inventory inventory = server.createInventory(null, 9, player.getName() + "'s armor");
|
||||
inventory.setContents(player.getInventory().getArmorContents());
|
||||
@ -65,11 +69,44 @@ public class Command_invsee extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
}
|
||||
inv = player.getInventory();
|
||||
playerSender.closeInventory();
|
||||
playerSender.openInventory(inv);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
if (args[1].equals("offhand"))
|
||||
{
|
||||
ItemStack offhand = player.getInventory().getItemInOffHand();
|
||||
if (offhand == null)
|
||||
{
|
||||
msg("That player has nothing in their offhand.");
|
||||
return true;
|
||||
}
|
||||
Inventory inventory = server.createInventory(null, 9, player.getName() + "'s offhand");
|
||||
inventory.setItem(1, offhand);
|
||||
playerSender.openInventory(inventory);
|
||||
return true;
|
||||
}
|
||||
else if (args[1].equals("armor"))
|
||||
{
|
||||
Inventory inventory = server.createInventory(null, 9, player.getName() + "'s armor");
|
||||
inventory.setContents(player.getInventory().getArmorContents());
|
||||
playerSender.openInventory(inventory);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
inv = player.getInventory();
|
||||
playerSender.closeInventory();
|
||||
FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
|
||||
fPlayer.setInvSee(true);
|
||||
Inventory playerInv = player.getInventory();
|
||||
playerSender.openInventory(playerInv);
|
||||
playerSender.openInventory(inv);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user