lol whos the idiot who made this embarassing command

This commit is contained in:
Telesphoreo 2020-10-29 20:47:23 -05:00
parent 7d93050ff9
commit e1e046b16b
2 changed files with 22 additions and 56 deletions

View File

@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -12,7 +13,6 @@ import org.bukkit.inventory.ItemStack;
@CommandParameters(description = "Look into another player's inventory, or optionally take items out.", usage = "/<command> <player> [offhand | armor]", aliases = "inv,insee") @CommandParameters(description = "Look into another player's inventory, or 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)
{ {
@ -31,81 +31,48 @@ public class Command_invsee extends FreedomCommand
if (playerSender == player) if (playerSender == player)
{ {
msg("You cannot invsee yourself."); msg("You cannot run this command on yourself.", ChatColor.RED);
return true; return true;
} }
if (plugin.sl.isStaff(player) && !plugin.sl.isStaff(playerSender)) if (plugin.sl.isStaff(player) && !plugin.sl.isStaff(playerSender))
{ {
msg("You cannot spy on staff members."); msg("You cannot see the inventory of staff members.", ChatColor.RED);
return true; return true;
} }
Inventory inv; Inventory inv;
if (args.length > 1)
if (plugin.sl.isStaff(player))
{ {
if (args.length > 1) if (args[1].equals("offhand"))
{ {
if (args[1].equals("offhand")) ItemStack offhand = player.getInventory().getItemInOffHand();
if (offhand == null)
{ {
ItemStack offhand = player.getInventory().getItemInOffHand(); msg("That player has nothing in their offhand.");
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;
}
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();
playerSender.openInventory(inv);
return true;
} }
inv = player.getInventory();
playerSender.closeInventory();
if (!plugin.sl.isStaff(player)) if (!plugin.sl.isStaff(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 fPlayer = plugin.pl.getPlayer(playerSender);
fPlayer.setInvSee(true); fPlayer.setInvSee(true);
playerSender.openInventory(inv);
return true;
} }
playerSender.openInventory(inv);
return true; return true;
} }
} }

View File

@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
@CommandParameters(description = "Change your login message", usage = "/<command> [message]") @CommandParameters(description = "Change your login message", usage = "/<command> [message]")
public class Command_loginmessage extends FreedomCommand public class Command_loginmessage extends FreedomCommand
{ {
@Override @Override
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {