Use command descriptions from translations

This commit is contained in:
Hannes Greule 2020-08-20 23:09:31 +02:00
parent e1e7cd1479
commit 55211907f2
74 changed files with 54 additions and 112 deletions

View File

@ -48,7 +48,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "add", @CommandDeclaration(command = "add",
description = "Allow a user to build in a plot while the plot owner is online.",
usage = "/plot add <player | *>", usage = "/plot add <player | *>",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
permission = "plots.add", permission = "plots.add",

View File

@ -44,7 +44,6 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "alias", @CommandDeclaration(command = "alias",
permission = "plots.alias", permission = "plots.alias",
description = "Set the plot name",
usage = "/plot alias <set | remove> <alias>", usage = "/plot alias <set | remove> <alias>",
aliases = {"setalias", "sa", "name", "rename", "setname", "seta", "nameplot"}, aliases = {"setalias", "sa", "name", "rename", "setname", "seta", "nameplot"},
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,

View File

@ -93,7 +93,6 @@ import java.util.UUID;
permission = "plots.area", permission = "plots.area",
category = CommandCategory.ADMINISTRATION, category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
description = "Create a new PlotArea",
aliases = "world", aliases = "world",
usage = "/plot area <create | info | list | tp | regen>", usage = "/plot area <create | info | list | tp | regen>",
confirmation = true) confirmation = true)

View File

@ -63,7 +63,6 @@ import java.util.Set;
permission = "plots.auto", permission = "plots.auto",
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
description = "Claim the nearest plot",
aliases = "a", aliases = "a",
usage = "/plot auto [length, width]") usage = "/plot auto [length, width]")
public class Auto extends SubCommand { public class Auto extends SubCommand {

View File

@ -57,7 +57,6 @@ import java.util.stream.Stream;
@CommandDeclaration(command = "backup", @CommandDeclaration(command = "backup",
usage = "/plot backup <save | list | load>", usage = "/plot backup <save | list | load>",
description = "Manage plot backups",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
permission = "plots.backup") permission = "plots.backup")
@ -123,7 +122,6 @@ public final class Backup extends Command {
@CommandDeclaration(command = "save", @CommandDeclaration(command = "save",
usage = "/plot backup save", usage = "/plot backup save",
description = "Create a plot backup",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
permission = "plots.backup.save") permission = "plots.backup.save")
@ -174,7 +172,6 @@ public final class Backup extends Command {
@CommandDeclaration(command = "list", @CommandDeclaration(command = "list",
usage = "/plot backup list", usage = "/plot backup list",
description = "List available plot backups",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
permission = "plots.backup.list") permission = "plots.backup.list")
@ -241,7 +238,6 @@ public final class Backup extends Command {
@CommandDeclaration(command = "load", @CommandDeclaration(command = "load",
usage = "/plot backup load <#>", usage = "/plot backup load <#>",
description = "Restore a plot backup",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
permission = "plots.backup.load") permission = "plots.backup.load")

View File

@ -40,7 +40,6 @@ import java.util.stream.Collectors;
@CommandDeclaration(command = "setbiome", @CommandDeclaration(command = "setbiome",
permission = "plots.set.biome", permission = "plots.set.biome",
description = "Set the plot biome",
usage = "/plot biome [biome]", usage = "/plot biome [biome]",
aliases = {"biome", "sb", "setb", "b"}, aliases = {"biome", "sb", "setb", "b"},
category = CommandCategory.APPEARANCE, category = CommandCategory.APPEARANCE,

View File

@ -46,7 +46,6 @@ import java.util.Set;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "buy", @CommandDeclaration(command = "buy",
description = "Buy the plot you are standing on",
usage = "/plot buy", usage = "/plot buy",
permission = "plots.buy", permission = "plots.buy",
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,

View File

@ -47,7 +47,6 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
@CommandDeclaration(command = "caps", @CommandDeclaration(command = "caps",
category = CommandCategory.INFO, category = CommandCategory.INFO,
description = "Show plot entity caps",
usage = "/plot caps") usage = "/plot caps")
public class Caps extends SubCommand { public class Caps extends SubCommand {

View File

@ -29,7 +29,6 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@CommandDeclaration(command = "chat", @CommandDeclaration(command = "chat",
description = "Toggles plot chat on or off",
usage = "/plot chat", usage = "/plot chat",
permission = "plots.chat", permission = "plots.chat",
category = CommandCategory.CHAT, category = CommandCategory.CHAT,

View File

@ -55,7 +55,6 @@ import javax.annotation.Nullable;
@CommandDeclaration( @CommandDeclaration(
command = "claim", command = "claim",
aliases = "c", aliases = "c",
description = "Claim the current plot you're standing on",
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
requiredType = RequiredType.PLAYER, permission = "plots.claim", requiredType = RequiredType.PLAYER, permission = "plots.claim",
usage = "/plot claim") usage = "/plot claim")

View File

@ -47,7 +47,6 @@ import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "clear", @CommandDeclaration(command = "clear",
description = "Clear the plot you stand on",
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.clear", permission = "plots.clear",
category = CommandCategory.APPEARANCE, category = CommandCategory.APPEARANCE,

View File

@ -53,8 +53,7 @@ import java.util.concurrent.TimeoutException;
aliases = "clusters", aliases = "clusters",
category = CommandCategory.ADMINISTRATION, category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.cluster", permission = "plots.cluster")
description = "Manage a plot cluster")
public class Cluster extends SubCommand { public class Cluster extends SubCommand {
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(PlotPlayer<?> player, String[] args) {

View File

@ -71,7 +71,7 @@ public abstract class Command {
private List<String> aliases; private List<String> aliases;
private RequiredType required; private RequiredType required;
private String usage; private String usage;
private String description; private Caption description;
private String permission; private String permission;
private boolean confirmation; private boolean confirmation;
private CommandCategory category; private CommandCategory category;
@ -171,7 +171,7 @@ public abstract class Command {
return this.aliases; return this.aliases;
} }
public String getDescription() { public Caption getDescription() {
return this.description; return this.description;
} }
@ -198,7 +198,21 @@ public abstract class Command {
aliasOptions.addAll(Arrays.asList(declaration.aliases())); aliasOptions.addAll(Arrays.asList(declaration.aliases()));
this.aliases = aliasOptions; this.aliases = aliasOptions;
this.description = declaration.description(); if (declaration.description().isEmpty()) {
Command parent = getParent();
// we're collecting the "path" of the command
List<String> path = new ArrayList<>();
path.add(this.id);
while (parent != null && !parent.equals(MainCommand.getInstance())) {
path.add(parent.getId());
parent = parent.getParent();
}
Collections.reverse(path);
String descriptionKey = String.join(".", path);
this.description = TranslatableCaption.of(String.format("commands.description.%s", descriptionKey));
} else {
this.description = StaticCaption.of(declaration.description());
}
this.usage = declaration.usage(); this.usage = declaration.usage();
this.confirmation = declaration.confirmation(); this.confirmation = declaration.confirmation();
@ -335,7 +349,7 @@ public abstract class Command {
String[] allArgs = setArgs.toArray(new String[0]); String[] allArgs = setArgs.toArray(new String[0]);
int best = 0; int best = 0;
for (Command current : commands) { for (Command current : commands) {
int match = getMatch(allArgs, current); int match = getMatch(allArgs, current, player);
if (match > best) { if (match > best) {
cmd = current; cmd = current;
} }
@ -385,12 +399,12 @@ public abstract class Command {
return true; return true;
} }
public int getMatch(String[] args, Command cmd) { public int getMatch(String[] args, Command cmd, PlotPlayer<?> player) {
String perm = cmd.getPermission(); String perm = cmd.getPermission();
HashSet<String> desc = new HashSet<>(); HashSet<String> desc = new HashSet<>();
int count = cmd.getAliases().stream().filter(alias -> alias.startsWith(args[0])) int count = cmd.getAliases().stream().filter(alias -> alias.startsWith(args[0]))
.mapToInt(alias -> 5).sum(); .mapToInt(alias -> 5).sum();
Collections.addAll(desc, cmd.getDescription().split(" ")); Collections.addAll(desc, cmd.getDescription().getComponent(player).split(" "));
for (String arg : args) { for (String arg : args) {
if (perm.startsWith(arg)) { if (perm.startsWith(arg)) {
count++; count++;

View File

@ -41,7 +41,6 @@ import java.util.Locale;
@CommandDeclaration(command = "comment", @CommandDeclaration(command = "comment",
aliases = {"msg"}, aliases = {"msg"},
description = "Comment on a plot",
category = CommandCategory.CHAT, category = CommandCategory.CHAT,
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
permission = "plots.comment") permission = "plots.comment")

View File

@ -51,7 +51,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
@CommandDeclaration(command = "condense", @CommandDeclaration(command = "condense",
permission = "plots.admin", permission = "plots.admin",
usage = "/plot condense <area> <start|stop|info> [radius]", usage = "/plot condense <area> <start|stop|info> [radius]",
description = "Condense a plotworld",
category = CommandCategory.ADMINISTRATION, category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.CONSOLE) requiredType = RequiredType.CONSOLE)
public class Condense extends SubCommand { public class Condense extends SubCommand {

View File

@ -32,7 +32,6 @@ import com.plotsquared.core.util.task.TaskManager;
@CommandDeclaration(command = "confirm", @CommandDeclaration(command = "confirm",
permission = "plots.use", permission = "plots.use",
description = "Confirm an action",
category = CommandCategory.INFO) category = CommandCategory.INFO)
public class Confirm extends SubCommand { public class Confirm extends SubCommand {

View File

@ -42,7 +42,6 @@ import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@CommandDeclaration(command = "continue", @CommandDeclaration(command = "continue",
description = "Continue a plot that was previously marked as done",
permission = "plots.continue", permission = "plots.continue",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -37,7 +37,6 @@ import net.kyori.adventure.text.minimessage.Template;
permission = "plots.copy", permission = "plots.copy",
aliases = {"copypaste"}, aliases = {"copypaste"},
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
description = "Copy a plot",
usage = "/plot copy <X;Z>", usage = "/plot copy <X;Z>",
requiredType = RequiredType.NONE) requiredType = RequiredType.NONE)
public class Copy extends SubCommand { public class Copy extends SubCommand {

View File

@ -41,7 +41,6 @@ import javax.annotation.Nonnull;
category = CommandCategory.ADMINISTRATION, category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
permission = "plots.createroadschematic", permission = "plots.createroadschematic",
description = "Add a road schematic to your world using the roads around your current plot",
usage = "/plot createroadschematic") usage = "/plot createroadschematic")
public class CreateRoadSchematic extends SubCommand { public class CreateRoadSchematic extends SubCommand {

View File

@ -62,7 +62,6 @@ import java.util.Map.Entry;
aliases = {"convert"}, aliases = {"convert"},
category = CommandCategory.ADMINISTRATION, category = CommandCategory.ADMINISTRATION,
permission = "plots.database", permission = "plots.database",
description = "Convert/Backup Storage",
requiredType = RequiredType.CONSOLE, requiredType = RequiredType.CONSOLE,
usage = "/plot database [area] <sqlite | mysql | import>") usage = "/plot database [area] <sqlite | mysql | import>")
public class DatabaseCommand extends SubCommand { public class DatabaseCommand extends SubCommand {

View File

@ -55,7 +55,6 @@ import java.util.Set;
@CommandDeclaration(command = "debug", @CommandDeclaration(command = "debug",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
description = "Show debug information",
usage = "/plot debug [msg]", usage = "/plot debug [msg]",
permission = "plots.admin") permission = "plots.admin")
public class Debug extends SubCommand { public class Debug extends SubCommand {

View File

@ -33,7 +33,6 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "debugallowunsafe", @CommandDeclaration(command = "debugallowunsafe",
description = "Allow unsafe actions until toggled off",
usage = "/plot debugallowunsafe", usage = "/plot debugallowunsafe",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,

View File

@ -89,7 +89,6 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "debugexec", @CommandDeclaration(command = "debugexec",
permission = "plots.admin", permission = "plots.admin",
description = "Mutli-purpose debug command",
aliases = {"exec", "$"}, aliases = {"exec", "$"},
category = CommandCategory.DEBUG) category = CommandCategory.DEBUG)
public class DebugExec extends SubCommand { public class DebugExec extends SubCommand {

View File

@ -45,7 +45,6 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "debugimportworlds", @CommandDeclaration(command = "debugimportworlds",
permission = "plots.admin", permission = "plots.admin",
description = "Import worlds by player name",
requiredType = RequiredType.CONSOLE, requiredType = RequiredType.CONSOLE,
category = CommandCategory.TELEPORT) category = CommandCategory.TELEPORT)
public class DebugImportWorlds extends Command { public class DebugImportWorlds extends Command {

View File

@ -31,7 +31,6 @@ import com.plotsquared.core.player.PlotPlayer;
@CommandDeclaration(command = "debugloadtest", @CommandDeclaration(command = "debugloadtest",
permission = "plots.debugloadtest", permission = "plots.debugloadtest",
description = "This debug command will force the reload of all plots in the DB",
usage = "/plot debugloadtest", usage = "/plot debugloadtest",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
requiredType = RequiredType.CONSOLE) requiredType = RequiredType.CONSOLE)

View File

@ -56,7 +56,6 @@ import java.util.stream.Collectors;
@CommandDeclaration(command = "debugpaste", @CommandDeclaration(command = "debugpaste",
aliases = "dp", aliases = "dp",
usage = "/plot debugpaste", usage = "/plot debugpaste",
description = "Upload settings.yml, worlds.yml, your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste",
permission = "plots.debugpaste", permission = "plots.debugpaste",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
confirmation = true, confirmation = true,

View File

@ -43,7 +43,6 @@ import java.util.Arrays;
@CommandDeclaration(command = "debugroadregen", @CommandDeclaration(command = "debugroadregen",
usage = DebugRoadRegen.USAGE, usage = DebugRoadRegen.USAGE,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
description = "Regenerate roads in the plot or region the user is, based on the road schematic",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
permission = "plots.debugroadregen") permission = "plots.debugroadregen")
public class DebugRoadRegen extends SubCommand { public class DebugRoadRegen extends SubCommand {

View File

@ -37,8 +37,7 @@ import java.util.List;
permission = "plots.debugsavetest", permission = "plots.debugsavetest",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
requiredType = RequiredType.CONSOLE, requiredType = RequiredType.CONSOLE,
usage = "/plot debugsavetest", usage = "/plot debugsavetest")
description = "This command will force the recreation of all plots in the DB")
public class DebugSaveTest extends SubCommand { public class DebugSaveTest extends SubCommand {
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {

View File

@ -47,7 +47,6 @@ import javax.annotation.Nullable;
@CommandDeclaration(command = "delete", @CommandDeclaration(command = "delete",
permission = "plots.delete", permission = "plots.delete",
description = "Delete the plot you stand on",
usage = "/plot delete", usage = "/plot delete",
aliases = {"dispose", "del"}, aliases = {"dispose", "del"},
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,

View File

@ -50,7 +50,6 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "deny", @CommandDeclaration(command = "deny",
aliases = {"d", "ban"}, aliases = {"d", "ban"},
description = "Deny a user from entering a plot",
usage = "/plot deny <player | *>", usage = "/plot deny <player | *>",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -40,7 +40,6 @@ import javax.annotation.Nonnull;
@CommandDeclaration(command = "setdescription", @CommandDeclaration(command = "setdescription",
permission = "plots.set.desc", permission = "plots.set.desc",
description = "Set the plot description",
usage = "/plot desc <description>", usage = "/plot desc <description>",
aliases = {"desc", "setdesc", "setd", "description"}, aliases = {"desc", "setdesc", "setd", "description"},
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,

View File

@ -32,7 +32,6 @@ import javax.annotation.Nonnull;
@CommandDeclaration(command = "dislike", @CommandDeclaration(command = "dislike",
permission = "plots.dislike", permission = "plots.dislike",
description = "Dislike the plot",
usage = "/plot dislike [next|purge]", usage = "/plot dislike [next|purge]",
category = CommandCategory.INFO, category = CommandCategory.INFO,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -49,7 +49,6 @@ import javax.annotation.Nonnull;
@CommandDeclaration(command = "done", @CommandDeclaration(command = "done",
aliases = {"submit"}, aliases = {"submit"},
description = "Mark a plot as done",
permission = "plots.done", permission = "plots.done",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE) requiredType = RequiredType.NONE)

View File

@ -50,7 +50,6 @@ import java.net.URL;
aliases = {"dl"}, aliases = {"dl"},
category = CommandCategory.SCHEMATIC, category = CommandCategory.SCHEMATIC,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
description = "Download your plot",
permission = "plots.download") permission = "plots.download")
public class Download extends SubCommand { public class Download extends SubCommand {

View File

@ -71,7 +71,6 @@ import java.util.stream.Stream;
@CommandDeclaration(command = "flag", @CommandDeclaration(command = "flag",
aliases = {"f", "flag"}, aliases = {"f", "flag"},
usage = "/plot flag <set | remove | add | list | info> <flag> <value>", usage = "/plot flag <set | remove | add | list | info> <flag> <value>",
description = "Manage plot flags",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.flag") permission = "plots.flag")
@ -282,7 +281,6 @@ public final class FlagCommand extends Command {
@CommandDeclaration(command = "set", @CommandDeclaration(command = "set",
aliases = {"s", "set"}, aliases = {"s", "set"},
usage = "/plot flag set <flag> <value>", usage = "/plot flag set <flag> <value>",
description = "Set a plot flag",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.set.flag") permission = "plots.set.flag")
@ -335,7 +333,6 @@ public final class FlagCommand extends Command {
@CommandDeclaration(command = "add", @CommandDeclaration(command = "add",
aliases = {"a", "add"}, aliases = {"a", "add"},
usage = "/plot flag add <flag> <value>", usage = "/plot flag add <flag> <value>",
description = "Add a plot flag value",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.flag.add") permission = "plots.flag.add")
@ -399,7 +396,6 @@ public final class FlagCommand extends Command {
@CommandDeclaration(command = "remove", @CommandDeclaration(command = "remove",
aliases = {"r", "remove", "delete"}, aliases = {"r", "remove", "delete"},
usage = "/plot flag remove <flag> [values]", usage = "/plot flag remove <flag> [values]",
description = "Remove a flag",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.flag.remove") permission = "plots.flag.remove")
@ -503,7 +499,6 @@ public final class FlagCommand extends Command {
@CommandDeclaration(command = "list", @CommandDeclaration(command = "list",
aliases = {"l", "list", "flags"}, aliases = {"l", "list", "flags"},
usage = "/plot flag list", usage = "/plot flag list",
description = "List all available plot flags",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.flag.list") permission = "plots.flag.list")
@ -543,7 +538,6 @@ public final class FlagCommand extends Command {
@CommandDeclaration(command = "info", @CommandDeclaration(command = "info",
aliases = {"i", "info"}, aliases = {"i", "info"},
usage = "/plot flag info <flag>", usage = "/plot flag info <flag>",
description = "View information about a flag",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.flag.info") permission = "plots.flag.info")

View File

@ -53,7 +53,6 @@ import java.util.stream.Stream;
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
usage = "/plot grant <check | add> [player]", usage = "/plot grant <check | add> [player]",
permission = "plots.grant", permission = "plots.grant",
description = "Manage plot grants.",
requiredType = RequiredType.NONE) requiredType = RequiredType.NONE)
public class Grant extends Command { public class Grant extends Command {

View File

@ -39,7 +39,6 @@ import net.kyori.adventure.text.minimessage.Template;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "help", @CommandDeclaration(command = "help",
description = "Get this help menu",
aliases = "?", aliases = "?",
category = CommandCategory.INFO, category = CommandCategory.INFO,
usage = "help [category|#]", usage = "help [category|#]",

View File

@ -50,7 +50,6 @@ import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "home", @CommandDeclaration(command = "home",
description = "Teleport to your plot(s)",
permission = "plots.home", permission = "plots.home",
usage = "/plot home [<page> | <alias> | <area;x;y> | <area> <x;y> | <area> <page>]", usage = "/plot home [<page> | <alias> | <area;x;y> | <area> <x;y> | <area> <page>]",
aliases = {"h"}, aliases = {"h"},

View File

@ -44,7 +44,6 @@ import net.kyori.adventure.text.minimessage.Template;
import java.util.List; import java.util.List;
@CommandDeclaration(command = "inbox", @CommandDeclaration(command = "inbox",
description = "Review the comments for a plot",
usage = "/plot inbox [inbox] [delete <index> | clear | page]", usage = "/plot inbox [inbox] [delete <index> | clear | page]",
permission = "plots.inbox", permission = "plots.inbox",
category = CommandCategory.CHAT, category = CommandCategory.CHAT,

View File

@ -38,7 +38,6 @@ import net.kyori.adventure.text.minimessage.Template;
@CommandDeclaration(command = "info", @CommandDeclaration(command = "info",
aliases = "i", aliases = "i",
description = "Display plot info",
usage = "/plot info <id> [-f to force info]", usage = "/plot info <id> [-f to force info]",
category = CommandCategory.INFO) category = CommandCategory.INFO)
public class Info extends SubCommand { public class Info extends SubCommand {

View File

@ -50,7 +50,6 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "kick", @CommandDeclaration(command = "kick",
aliases = "k", aliases = "k",
description = "Kick a player from your plot",
permission = "plots.kick", permission = "plots.kick",
usage = "/plot kick <player | *>", usage = "/plot kick <player | *>",
category = CommandCategory.TELEPORT, category = CommandCategory.TELEPORT,

View File

@ -39,7 +39,6 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "leave", @CommandDeclaration(command = "leave",
description = "Removes self from being trusted or a member of the plot",
permission = "plots.leave", permission = "plots.leave",
usage = "/plot leave", usage = "/plot leave",
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,

View File

@ -50,7 +50,6 @@ import java.util.UUID;
@CommandDeclaration(command = "like", @CommandDeclaration(command = "like",
permission = "plots.like", permission = "plots.like",
description = "Like the plot",
usage = "/plot like [next | purge]", usage = "/plot like [next | purge]",
category = CommandCategory.INFO, category = CommandCategory.INFO,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -72,7 +72,6 @@ import java.util.stream.Collectors;
@CommandDeclaration(command = "list", @CommandDeclaration(command = "list",
aliases = {"l", "find", "search"}, aliases = {"l", "find", "search"},
description = "List plots",
permission = "plots.list", permission = "plots.list",
category = CommandCategory.INFO, category = CommandCategory.INFO,
usage = "/plot list <forsale | mine | shared | world | top | all | unowned | player | world | done | fuzzy <search...>> [#]") usage = "/plot list <forsale | mine | shared | world | top | all | unowned | player | world | done | fuzzy <search...>> [#]")

View File

@ -54,7 +54,6 @@ import java.util.List;
aliases = "restore", aliases = "restore",
category = CommandCategory.SCHEMATIC, category = CommandCategory.SCHEMATIC,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
description = "Load your plot",
permission = "plots.load", permission = "plots.load",
usage = "/plot load") usage = "/plot load")
public class Load extends SubCommand { public class Load extends SubCommand {

View File

@ -27,13 +27,13 @@ package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.PlotMergeEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
@ -50,7 +50,6 @@ import java.util.UUID;
@CommandDeclaration(command = "merge", @CommandDeclaration(command = "merge",
aliases = "m", aliases = "m",
description = "Merge the plot you are standing on with another plot",
permission = "plots.merge", permission = "plots.merge",
usage = "/plot merge <all | n | e | s | w> [removeroads]", usage = "/plot merge <all | n | e | s | w> [removeroads]",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,

View File

@ -36,7 +36,6 @@ import com.plotsquared.core.plot.Plot;
*/ */
@CommandDeclaration(command = "middle", @CommandDeclaration(command = "middle",
aliases = {"center", "centre"}, aliases = {"center", "centre"},
description = "Teleports you to the center of the plot",
usage = "/plot middle", usage = "/plot middle",
category = CommandCategory.TELEPORT, category = CommandCategory.TELEPORT,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -43,7 +43,6 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(usage = "/plot move <X;Z>", @CommandDeclaration(usage = "/plot move <X;Z>",
command = "move", command = "move",
description = "Move a plot",
permission = "plots.move", permission = "plots.move",
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -48,7 +48,6 @@ import java.util.Locale;
@CommandDeclaration(command = "music", @CommandDeclaration(command = "music",
permission = "plots.music", permission = "plots.music",
description = "Play music in your plot",
usage = "/plot music", usage = "/plot music",
category = CommandCategory.APPEARANCE, category = CommandCategory.APPEARANCE,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -37,7 +37,6 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "near", @CommandDeclaration(command = "near",
aliases = "n", aliases = "n",
description = "Display nearby players",
usage = "/plot near", usage = "/plot near",
category = CommandCategory.INFO, category = CommandCategory.INFO,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -49,7 +49,6 @@ import java.util.function.Consumer;
@CommandDeclaration(command = "setowner", @CommandDeclaration(command = "setowner",
permission = "plots.set.owner", permission = "plots.set.owner",
description = "Set the plot owner",
usage = "/plot setowner <player>", usage = "/plot setowner <player>",
aliases = {"owner", "so", "seto"}, aliases = {"owner", "so", "seto"},
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,

View File

@ -34,7 +34,6 @@ import net.kyori.adventure.text.minimessage.Template;
@CommandDeclaration(command = "plugin", @CommandDeclaration(command = "plugin",
permission = "plots.use", permission = "plots.use",
description = "Show plugin information",
usage = "/plot plugin", usage = "/plot plugin",
aliases = "version", aliases = "version",
category = CommandCategory.INFO) category = CommandCategory.INFO)

View File

@ -54,7 +54,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
@CommandDeclaration(usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true | false] clear:[true | false]", @CommandDeclaration(usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true | false] clear:[true | false]",
command = "purge", command = "purge",
permission = "plots.admin", permission = "plots.admin",
description = "Purge all plots for a world",
category = CommandCategory.ADMINISTRATION, category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.CONSOLE, requiredType = RequiredType.CONSOLE,
confirmation = true) confirmation = true)

View File

@ -54,7 +54,6 @@ import java.util.UUID;
@CommandDeclaration(command = "rate", @CommandDeclaration(command = "rate",
permission = "plots.rate", permission = "plots.rate",
description = "Rate the plot",
usage = "/plot rate [# | next | purge]", usage = "/plot rate [# | next | purge]",
aliases = "rt", aliases = "rt",
category = CommandCategory.INFO, category = CommandCategory.INFO,

View File

@ -38,7 +38,6 @@ import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@CommandDeclaration(command = "regenallroads", @CommandDeclaration(command = "regenallroads",
description = "Regenerate all roads in the map using the set road schematic",
aliases = {"rgar"}, aliases = {"rgar"},
usage = "/plot regenallroads <world> [height]", usage = "/plot regenallroads <world> [height]",
category = CommandCategory.ADMINISTRATION, category = CommandCategory.ADMINISTRATION,

View File

@ -33,7 +33,6 @@ import com.plotsquared.core.util.task.RunnableVal3;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "relight", @CommandDeclaration(command = "relight",
description = "Relight your plot",
usage = "/plot relight", usage = "/plot relight",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -44,7 +44,6 @@ import java.util.Objects;
@CommandDeclaration(command = "reload", @CommandDeclaration(command = "reload",
aliases = "rl", aliases = "rl",
permission = "plots.admin.command.reload", permission = "plots.admin.command.reload",
description = "Reload translations and world settings",
usage = "/plot reload", usage = "/plot reload",
category = CommandCategory.ADMINISTRATION) category = CommandCategory.ADMINISTRATION)
public class Reload extends SubCommand { public class Reload extends SubCommand {

View File

@ -46,7 +46,6 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "remove", @CommandDeclaration(command = "remove",
aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"}, aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"},
description = "Remove a player from a plot",
usage = "/plot remove <player | *>", usage = "/plot remove <player | *>",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,

View File

@ -47,7 +47,6 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "save", @CommandDeclaration(command = "save",
description = "Save your plot",
category = CommandCategory.SCHEMATIC, category = CommandCategory.SCHEMATIC,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.save") permission = "plots.save")

View File

@ -52,7 +52,6 @@ import java.util.UUID;
@CommandDeclaration(command = "schematic", @CommandDeclaration(command = "schematic",
permission = "plots.schematic", permission = "plots.schematic",
description = "Schematic command",
aliases = {"sch", "schem"}, aliases = {"sch", "schem"},
category = CommandCategory.SCHEMATIC, category = CommandCategory.SCHEMATIC,
usage = "/plot schematic <save | saveall | paste>") usage = "/plot schematic <save | saveall | paste>")

View File

@ -58,7 +58,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@CommandDeclaration(command = "set", @CommandDeclaration(command = "set",
description = "Set a plot value",
aliases = {"s"}, aliases = {"s"},
usage = "/plot set <biome | alias | home | flag> <value...>", usage = "/plot set <biome | alias | home | flag> <value...>",
permission = "plots.set", permission = "plots.set",

View File

@ -34,7 +34,6 @@ import net.kyori.adventure.text.minimessage.Template;
@CommandDeclaration(command = "sethome", @CommandDeclaration(command = "sethome",
permission = "plots.set.home", permission = "plots.set.home",
description = "Set the plot home to your current position",
usage = "/plot sethome [none]", usage = "/plot sethome [none]",
aliases = {"sh", "seth"}, aliases = {"sh", "seth"},
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,

View File

@ -47,7 +47,6 @@ import java.util.Map.Entry;
@CommandDeclaration(command = "setup", @CommandDeclaration(command = "setup",
permission = "plots.admin.command.setup", permission = "plots.admin.command.setup",
description = "Setup wizard for plot worlds",
usage = "/plot setup", usage = "/plot setup",
aliases = {"create"}, aliases = {"create"},
category = CommandCategory.ADMINISTRATION) category = CommandCategory.ADMINISTRATION)

View File

@ -39,7 +39,6 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(usage = "/plot swap <X;Z>", @CommandDeclaration(usage = "/plot swap <X;Z>",
command = "swap", command = "swap",
description = "Swap two plots",
aliases = {"switch"}, aliases = {"switch"},
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -42,7 +42,6 @@ import java.util.stream.Stream;
@CommandDeclaration(command = "target", @CommandDeclaration(command = "target",
usage = "/plot target <<X;Z> | nearest>", usage = "/plot target <<X;Z> | nearest>",
description = "Target a plot with your compass",
permission = "plots.target", permission = "plots.target",
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
category = CommandCategory.INFO) category = CommandCategory.INFO)
@ -61,7 +60,7 @@ public class Target extends SubCommand {
if (args.length == 0) { if (args.length == 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot target <<X;Z> | nearest>") Template.of("value", "/plot target <<plot> | nearest>")
); );
return false; return false;
} }

View File

@ -65,7 +65,6 @@ import java.util.zip.ZipOutputStream;
@CommandDeclaration(command = "template", @CommandDeclaration(command = "template",
permission = "plots.admin", permission = "plots.admin",
description = "Create or use a world template",
usage = "/plot template [import | export] <world> <template>", usage = "/plot template [import | export] <world> <template>",
category = CommandCategory.ADMINISTRATION) category = CommandCategory.ADMINISTRATION)
public class Template extends SubCommand { public class Template extends SubCommand {

View File

@ -35,7 +35,6 @@ import net.kyori.adventure.text.minimessage.Template;
aliases = {"attribute"}, aliases = {"attribute"},
permission = "plots.use", permission = "plots.use",
usage = "/plot toggle <chat | chatspy | clear-confirmation | time | titles | worldedit>", usage = "/plot toggle <chat | chatspy | clear-confirmation | time | titles | worldedit>",
description = "Toggle per user settings",
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
category = CommandCategory.SETTINGS) category = CommandCategory.SETTINGS)
public class Toggle extends Command { public class Toggle extends Command {
@ -45,8 +44,7 @@ public class Toggle extends Command {
@CommandDeclaration(command = "chatspy", @CommandDeclaration(command = "chatspy",
aliases = {"spy"}, aliases = {"spy"},
permission = "plots.admin.command.chat", permission = "plots.admin.command.chat")
description = "Toggle plot chat spy")
public void chatspy(Command command, PlotPlayer<?> player, String[] args, public void chatspy(Command command, PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -65,8 +63,7 @@ public class Toggle extends Command {
@CommandDeclaration(command = "worldedit", @CommandDeclaration(command = "worldedit",
aliases = {"we", "wea"}, aliases = {"we", "wea"},
permission = "plots.worldedit.bypass", permission = "plots.worldedit.bypass")
description = "Toggle worldedit area restrictions")
public void worldedit(Command command, PlotPlayer<?> player, String[] args, public void worldedit(Command command, PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -84,8 +81,7 @@ public class Toggle extends Command {
} }
@CommandDeclaration(command = "chat", @CommandDeclaration(command = "chat",
permission = "plots.toggle.chat", permission = "plots.toggle.chat")
description = "Toggle plot chat")
public void chat(Command command, PlotPlayer<?> player, String[] args, public void chat(Command command, PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -103,8 +99,7 @@ public class Toggle extends Command {
} }
@CommandDeclaration(command = "clear-confirmation", @CommandDeclaration(command = "clear-confirmation",
permission = "plots.admin.command.autoclear", permission = "plots.admin.command.autoclear")
description = "Toggle autoclear confirmation")
public void clearConfirmation(Command command, PlotPlayer<?> player, String[] args, public void clearConfirmation(Command command, PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -122,8 +117,7 @@ public class Toggle extends Command {
} }
@CommandDeclaration(command = "titles", @CommandDeclaration(command = "titles",
permission = "plots.toggle.titles", permission = "plots.toggle.titles")
description = "Toggle plot title messages")
public void titles(Command command, PlotPlayer<?> player, String[] args, public void titles(Command command, PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -141,8 +135,7 @@ public class Toggle extends Command {
} }
@CommandDeclaration(command = "time", @CommandDeclaration(command = "time",
permission = "plots.toggle.time", permission = "plots.toggle.time")
description = "Toggle plot time settings")
public void time(Command command, PlotPlayer<?> player, String[] args, public void time(Command command, PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
@ -160,8 +153,7 @@ public class Toggle extends Command {
} }
@CommandDeclaration(command = "debug", @CommandDeclaration(command = "debug",
permission = "plots.toggle.debug", permission = "plots.toggle.debug")
description = "Toggle plot debugging")
public void debug(Command command, PlotPlayer<?> player, String[] args, public void debug(Command command, PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {

View File

@ -57,7 +57,6 @@ import java.util.Set;
@CommandDeclaration(command = "trim", @CommandDeclaration(command = "trim",
permission = "plots.admin", permission = "plots.admin",
description = "Delete unmodified portions of your plotworld",
usage = "/plot trim <world> [regenerate]", usage = "/plot trim <world> [regenerate]",
requiredType = RequiredType.CONSOLE, requiredType = RequiredType.CONSOLE,
category = CommandCategory.ADMINISTRATION) category = CommandCategory.ADMINISTRATION)

View File

@ -52,7 +52,6 @@ import java.util.concurrent.TimeoutException;
aliases = {"t"}, aliases = {"t"},
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
usage = "/plot trust <player | *>", usage = "/plot trust <player | *>",
description = "Allow a user to build in a plot and use WorldEdit while the plot owner is offline.",
category = CommandCategory.SETTINGS) category = CommandCategory.SETTINGS)
public class Trust extends Command { public class Trust extends Command {

View File

@ -43,7 +43,6 @@ import javax.annotation.Nonnull;
@CommandDeclaration(command = "unlink", @CommandDeclaration(command = "unlink",
aliases = {"u", "unmerge"}, aliases = {"u", "unmerge"},
description = "Unlink a mega-plot",
usage = "/plot unlink [createroads]", usage = "/plot unlink [createroads]",
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,

View File

@ -57,7 +57,6 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "visit", @CommandDeclaration(command = "visit",
permission = "plots.visit", permission = "plots.visit",
description = "Visit someones plot",
usage = "/plot visit <player> | <alias> | <plot> [area]|[#] [#]", usage = "/plot visit <player> | <alias> | <plot> [area]|[#] [#]",
aliases = {"v", "tp", "teleport", "goto", "warp"}, aliases = {"v", "tp", "teleport", "goto", "warp"},
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,

View File

@ -29,7 +29,6 @@ import com.plotsquared.core.player.PlotPlayer;
@CommandDeclaration(command = "weanywhere", @CommandDeclaration(command = "weanywhere",
permission = "plots.worldedit.bypass", permission = "plots.worldedit.bypass",
description = "Force bypass of WorldEdit restrictions",
aliases = {"wea"}, aliases = {"wea"},
usage = "/plot weanywhere", usage = "/plot weanywhere",
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,

View File

@ -27,6 +27,7 @@ package com.plotsquared.core.util.helpmenu;
import com.plotsquared.core.command.Argument; import com.plotsquared.core.command.Argument;
import com.plotsquared.core.command.Command; import com.plotsquared.core.command.Command;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
@ -37,21 +38,22 @@ public class HelpObject {
static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build(); static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private final String _rendered; private final String rendered;
public HelpObject(final Command command, final String label, final PlotPlayer<?> audience) { public HelpObject(final Command command, final String label, final PlotPlayer<?> audience) {
_rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_item").getComponent(audience), rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_item").getComponent(audience),
Template.of("usage", command.getUsage().replaceAll("\\{label\\}", label)), Template.of("usage", command.getUsage().replace("{label}", label)),
Template.of("alias", command.getAliases().isEmpty() ? StringMan.join(command.getAliases(), "|") : ""), Template.of("alias", command.getAliases().isEmpty() ? "" : StringMan.join(command.getAliases(), " | ")),
Template.of("desc", command.getDescription()), Template.of("arguments", buildArgumentList(command.getRequiredArguments())), Templates.of(audience, "desc", command.getDescription()),
Template.of("arguments", buildArgumentList(command.getRequiredArguments())),
Template.of("label", label))); Template.of("label", label)));
} }
@Override public String toString() { @Override public String toString() {
return _rendered; return rendered;
} }
private String buildArgumentList(final Argument[] arguments) { private String buildArgumentList(final Argument<?>[] arguments) {
if (arguments == null) { if (arguments == null) {
return ""; return "";
} }

View File

@ -455,7 +455,7 @@
"help.help_page_header": "\n<gold>Category: </gold><gray><category>,</gray><gold> Page: </gold><gray><current></gray><dark_gray>/</dark_gray><gray><max></gray>\n", "help.help_page_header": "\n<gold>Category: </gold><gray><category>,</gray><gold> Page: </gold><gray><current></gray><dark_gray>/</dark_gray><gray><max></gray>\n",
"help.help_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Help </gold><dark_gray><strikethrough>---------<reset>", "help.help_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Help </gold><dark_gray><strikethrough>---------<reset>",
"help.help_info_item": "<gold>/plot help <gray><category> </gray><dark_gray>- </dark_gray><gray><category_desc></gray>", "help.help_info_item": "<gold>/plot help <gray><category> </gray><dark_gray>- </dark_gray><gray><category_desc></gray>",
"help.help_item": "<gold><usage> <gray>[</gray><gold><alias></gray>]</gray>\n <dark_gray>- </dark_gray><gray><desc></gray>\n", "help.help_item": "<gold><usage> <gray>[<gold><alias></gold>]</gray>\n <dark_gray>- </dark_gray><gray><desc></gray>\n",
"help.help_display_all_commands": "<prefix><gray>Display all commands.</gray>", "help.help_display_all_commands": "<prefix><gray>Display all commands.</gray>",
"help.direction": "<prefix><gold>Current direction: </gold><gray><dir></gray>", "help.direction": "<prefix><gold>Current direction: </gold><gray><dir></gray>",
@ -686,7 +686,12 @@
"commands.description.dislike": "<gray>Dislike the plot.</gray>", "commands.description.dislike": "<gray>Dislike the plot.</gray>",
"commands.description.done": "<gray>Continue a plot that was previously marked as done.</gray>", "commands.description.done": "<gray>Continue a plot that was previously marked as done.</gray>",
"commands.description.download": "<gray>Download your plot.</gray>", "commands.description.download": "<gray>Download your plot.</gray>",
"commands.description.flags": "<gray>Manage plot flags.</gray>", "commands.description.flag": "<gray>Manage plot flags.</gray>",
"commands.description.flag.set": "<gray>Set a plot flag.</gray>",
"commands.description.flag.add": "<gray>Add a plot flag value.</gray>",
"commands.description.flag.remove": "<gray>Remove a flag.</gray>",
"commands.description.flag.list": "<gray>List all available plot flags.</gray>",
"commands.description.flag.info": "<gray>View information about a flag.</gray>",
"commands.description.grant": "<gray>Manage plot grants.</gray>", "commands.description.grant": "<gray>Manage plot grants.</gray>",
"commands.description.help": "<gray>Get this help menu.</gray>", "commands.description.help": "<gray>Get this help menu.</gray>",
"commands.description.home": "<gray>Teleport to your plot(s).</gray>", "commands.description.home": "<gray>Teleport to your plot(s).</gray>",
@ -719,6 +724,13 @@
"commands.description.target": "<gray>Target a plot with your compass.</gray>", "commands.description.target": "<gray>Target a plot with your compass.</gray>",
"commands.description.template": "<gray>Create or use a world template.</gray>", "commands.description.template": "<gray>Create or use a world template.</gray>",
"commands.description.toggle": "<gray>Toggle per user settings.</gray>", "commands.description.toggle": "<gray>Toggle per user settings.</gray>",
"commands.description.toggle.chatspy": "<gray>Toggle plot chat spy.</gray>",
"commands.description.toggle.worldedit": "<gray>Toggle WorldEdit area restrictions.</gray>",
"commands.description.toggle.chat": "<gray>Toggle plot chat.</gray>",
"commands.description.toggle.clear-confirmation": "<gray>Toggle autoclear confirmation.</gray>",
"commands.description.toggle.titles": "<gray>Toggle plot title messages.</gray>",
"commands.description.toggle.time": "<gray>Toggle plot time settings.</gray>",
"commands.description.toggle.debug": "<gray>Toggle plot debugging.</gray>",
"commands.description.trim": "<gray>Delete unmodified portions of your plotworld.</gray>", "commands.description.trim": "<gray>Delete unmodified portions of your plotworld.</gray>",
"commands.description.trust": "<gray>Allow a user to build in a plot and use WorldEdit while the plot owner is offline.</gray>", "commands.description.trust": "<gray>Allow a user to build in a plot and use WorldEdit while the plot owner is offline.</gray>",
"commands.description.unlink": "<gray>Unlink a mega-plot.</gray>", "commands.description.unlink": "<gray>Unlink a mega-plot.</gray>",