Added invsee.

This commit is contained in:
Brianna O'Keefe 2019-02-27 15:59:54 -05:00
parent 856803764e
commit 8fc1b1fe59
3 changed files with 64 additions and 1 deletions

View File

@ -31,6 +31,7 @@ public class CommandManager implements CommandExecutor {
instance.getCommand("RandomPlayer").setExecutor(this);
instance.getCommand("Vanish").setExecutor(this);
instance.getCommand("ViewEnderChest").setExecutor(this);
instance.getCommand("InvSee").setExecutor(this);
AbstractCommand commandUltimateModeration = addCommand(new CommandUltimateModeration());
addCommand(new CommandClearChat());
@ -38,6 +39,7 @@ public class CommandManager implements CommandExecutor {
addCommand(new CommandRandomPlayer());
addCommand(new CommandVanish());
addCommand(new CommandViewEnderChest());
addCommand(new CommandInvSee());
addCommand(new CommandSettings(commandUltimateModeration));
addCommand(new CommandReload(commandUltimateModeration));

View File

@ -0,0 +1,56 @@
package com.songoda.ultimatemoderation.command.commands;
import com.songoda.ultimatemoderation.UltimateModeration;
import com.songoda.ultimatemoderation.command.AbstractCommand;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.List;
public class CommandInvSee extends AbstractCommand {
public CommandInvSee() {
super(true, true,"Inv1See");
}
@Override
protected ReturnType runCommand(UltimateModeration instance, CommandSender sender, String... args) {
if (args.length != 1)
return ReturnType.SYNTAX_ERROR;
Player player = Bukkit.getPlayer(args[0]);
if (player == null) {
sender.sendMessage(instance.getReferences().getPrefix() + "That player does not exist or is not online.");
return ReturnType.FAILURE;
}
((Player)sender).openInventory(player.getInventory());
return ReturnType.SUCCESS;
}
@Override
protected List<String> onTab(UltimateModeration instance, CommandSender sender, String... args) {
return null;
}
private boolean isForced(String[] args) {
return args.length != 0 && args[0].equals("force");
}
@Override
public String getPermissionNode() {
return "um.invsee";
}
@Override
public String getSyntax() {
return "/InvSee <player>";
}
@Override
public String getDescription() {
return "Allows you to see inside of a players inventory.\n";
}
}

View File

@ -34,4 +34,9 @@ commands:
description: ViewEnderChest
default: false
aliases: [vec]
usage: /vec
usage: /vec
usage: /v
InvSee:
description: InvSee
default: false
usage: /invsee