Added Enderchests.

This commit is contained in:
Brianna O'Keefe 2019-02-27 15:32:46 -05:00
parent 03ebe22352
commit 856803764e
3 changed files with 67 additions and 1 deletions

View File

@ -30,12 +30,14 @@ public class CommandManager implements CommandExecutor {
instance.getCommand("ToggleChat").setExecutor(this);
instance.getCommand("RandomPlayer").setExecutor(this);
instance.getCommand("Vanish").setExecutor(this);
instance.getCommand("ViewEnderChest").setExecutor(this);
AbstractCommand commandUltimateModeration = addCommand(new CommandUltimateModeration());
addCommand(new CommandClearChat());
addCommand(new CommandToggleChat());
addCommand(new CommandRandomPlayer());
addCommand(new CommandVanish());
addCommand(new CommandViewEnderChest());
addCommand(new CommandSettings(commandUltimateModeration));
addCommand(new CommandReload(commandUltimateModeration));

View File

@ -0,0 +1,59 @@
package com.songoda.ultimatemoderation.command.commands;
import com.songoda.ultimatemoderation.UltimateModeration;
import com.songoda.ultimatemoderation.command.AbstractCommand;
import com.songoda.ultimatemoderation.utils.Methods;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.List;
public class CommandViewEnderChest extends AbstractCommand {
public CommandViewEnderChest() {
super(true, true,"ViewEnderChest");
}
@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.getEnderChest());
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.viewenderchest";
}
@Override
public String getSyntax() {
return "/ViewEnderChest <player>";
}
@Override
public String getDescription() {
return "Allows you to see inside of a players enderchest.\n";
}
}

View File

@ -29,4 +29,9 @@ commands:
description: Vanish
default: false
aliases: [v]
usage: /v
usage: /v
ViewEnderChest:
description: ViewEnderChest
default: false
aliases: [vec]
usage: /vec