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;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
@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
|
public class Command_invsee extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
@ -38,38 +37,76 @@ public class Command_invsee extends FreedomCommand
|
|||||||
|
|
||||||
if (plugin.al.isAdmin(player) && !plugin.al.isAdmin(playerSender))
|
if (plugin.al.isAdmin(player) && !plugin.al.isAdmin(playerSender))
|
||||||
{
|
{
|
||||||
msg("You can't spy on admins!");
|
msg("You cannot spy on administrators.");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
if(args.length >= 2)
|
|
||||||
|
Inventory inv;
|
||||||
|
|
||||||
|
if (plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
if (args[1].equals("offhand"))
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
ItemStack offhand = player.getInventory().getItemInOffHand();
|
if (args[1].equals("offhand"))
|
||||||
if (offhand == null)
|
|
||||||
{
|
{
|
||||||
msg("That player has nothing in their 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;
|
return true;
|
||||||
}
|
}
|
||||||
Inventory inventory = server.createInventory(null, 9, player.getName() + "'s offhand");
|
|
||||||
inventory.setItem(1, offhand);
|
|
||||||
playerSender.openInventory(inventory);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
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();
|
||||||
|
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);
|
||||||
|
playerSender.openInventory(inv);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
playerSender.closeInventory();
|
|
||||||
FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
|
|
||||||
fPlayer.setInvSee(true);
|
|
||||||
Inventory playerInv = player.getInventory();
|
|
||||||
playerSender.openInventory(playerInv);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user