2017-10-13 18:35:11 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
|
|
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
|
|
|
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
|
|
|
@CommandParameters(description = " Look into another player's inventory, optionally take items out.", usage = "/<command> <player>", 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)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (args.length != 1)
|
|
|
|
{
|
|
|
|
msg("You need to specify a player.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Player player = getPlayer(args[0]);
|
|
|
|
|
|
|
|
if (player == null)
|
|
|
|
{
|
|
|
|
msg("This player is not online.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (playerSender == player)
|
|
|
|
{
|
|
|
|
msg("You cannot invsee yourself.");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plugin.al.isAdmin(player) && !plugin.al.isAdmin(playerSender))
|
|
|
|
{
|
|
|
|
msg("You can't spy on admins!");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
playerSender.closeInventory();
|
|
|
|
FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
|
2017-12-23 04:07:36 +00:00
|
|
|
fPlayer.setInvSee(true);
|
2017-10-13 18:35:11 +00:00
|
|
|
Inventory playerInv = player.getInventory();
|
|
|
|
playerSender.openInventory(playerInv);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|