package de.iani.treasurechest.commands;
import de.iani.cubesideutils.bukkit.commands.SubCommand;
import de.iani.cubesideutils.bukkit.commands.exceptions.DisallowsCommandBlockException;
import de.iani.cubesideutils.bukkit.commands.exceptions.IllegalSyntaxException;
import de.iani.cubesideutils.bukkit.commands.exceptions.InternalCommandException;
import de.iani.cubesideutils.bukkit.commands.exceptions.NoPermissionException;
import de.iani.cubesideutils.bukkit.commands.exceptions.RequiresPlayerException;
import de.iani.cubesideutils.commands.ArgsParser;
import de.iani.treasurechest.Permissions;
import de.iani.treasurechest.TreasureChest;
import java.util.Collection;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class HelpCommand extends SubCommand {
private TreasureChest plugin;
public HelpCommand(TreasureChest plugin) {
this.plugin = plugin;
}
@Override
public String getRequiredPermission() {
return null;
}
@Override
public boolean requiresPlayer() {
return false;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String alias, String commandString, ArgsParser args) throws DisallowsCommandBlockException, RequiresPlayerException, NoPermissionException, IllegalSyntaxException, InternalCommandException {
plugin.sendMessage(sender, ChatColor.GREEN + "Commands");
if (sender instanceof Player && sender.hasPermission(Permissions.SET_CHEST)) {
plugin.sendMessage(sender, "/" + alias + " setchest");
plugin.sendMessage(sender, ChatColor.GREEN + " Set the treasure chest location to the location you are looking at.");
}
if (sender instanceof Player && sender.hasPermission(Permissions.CREATE)) {
plugin.sendMessage(sender, "/" + alias + " create");
plugin.sendMessage(sender, ChatColor.GREEN + " Creates a price with the item in hand as display item.");
plugin.sendMessage(sender, "/" + alias + " additem");
plugin.sendMessage(sender, ChatColor.GREEN + " Adds the item in hand to the price.");
plugin.sendMessage(sender, "/" + alias + " addmoney <amount>");
plugin.sendMessage(sender, ChatColor.GREEN + " Adds money to a price.");
}
if (sender instanceof Player && sender.hasPermission(Permissions.GIVE)) {
plugin.sendMessage(sender, "/" + alias + " give <player>");
plugin.sendMessage(sender, ChatColor.GREEN + " Gives a price to a player.");
}
if (sender.hasPermission(Permissions.LIST)) {
plugin.sendMessage(sender, "/" + alias + " list <player>");
plugin.sendMessage(sender, ChatColor.GREEN + " Gives price for a player.");
}
if (sender.hasPermission(Permissions.REMOVE)) {
plugin.sendMessage(sender, "/" + alias + " remove <player> <id>");
plugin.sendMessage(sender, ChatColor.GREEN + " Removes a price from a players chest.");
}
return true;
}
@Override
public Collection<String> onTabComplete(CommandSender sender, Command command, String alias, ArgsParser args) {
return List.of();
}
}