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;
@CommandDeclaration(command = "add",
description = "Allow a user to build in a plot while the plot owner is online.",
usage = "/plot add <player | *>",
category = CommandCategory.SETTINGS,
permission = "plots.add",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -71,7 +71,7 @@ public abstract class Command {
private List<String> aliases;
private RequiredType required;
private String usage;
private String description;
private Caption description;
private String permission;
private boolean confirmation;
private CommandCategory category;
@ -171,7 +171,7 @@ public abstract class Command {
return this.aliases;
}
public String getDescription() {
public Caption getDescription() {
return this.description;
}
@ -198,7 +198,21 @@ public abstract class Command {
aliasOptions.addAll(Arrays.asList(declaration.aliases()));
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.confirmation = declaration.confirmation();
@ -335,7 +349,7 @@ public abstract class Command {
String[] allArgs = setArgs.toArray(new String[0]);
int best = 0;
for (Command current : commands) {
int match = getMatch(allArgs, current);
int match = getMatch(allArgs, current, player);
if (match > best) {
cmd = current;
}
@ -385,12 +399,12 @@ public abstract class Command {
return true;
}
public int getMatch(String[] args, Command cmd) {
public int getMatch(String[] args, Command cmd, PlotPlayer<?> player) {
String perm = cmd.getPermission();
HashSet<String> desc = new HashSet<>();
int count = cmd.getAliases().stream().filter(alias -> alias.startsWith(args[0]))
.mapToInt(alias -> 5).sum();
Collections.addAll(desc, cmd.getDescription().split(" "));
Collections.addAll(desc, cmd.getDescription().getComponent(player).split(" "));
for (String arg : args) {
if (perm.startsWith(arg)) {
count++;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,7 +56,6 @@ import java.util.stream.Collectors;
@CommandDeclaration(command = "debugpaste",
aliases = "dp",
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",
category = CommandCategory.DEBUG,
confirmation = true,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -72,7 +72,6 @@ import java.util.stream.Collectors;
@CommandDeclaration(command = "list",
aliases = {"l", "find", "search"},
description = "List plots",
permission = "plots.list",
category = CommandCategory.INFO,
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",
category = CommandCategory.SCHEMATIC,
requiredType = RequiredType.NONE,
description = "Load your plot",
permission = "plots.load",
usage = "/plot load")
public class Load extends SubCommand {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,6 @@ import net.kyori.adventure.text.minimessage.Template;
@CommandDeclaration(command = "plugin",
permission = "plots.use",
description = "Show plugin information",
usage = "/plot plugin",
aliases = "version",
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]",
command = "purge",
permission = "plots.admin",
description = "Purge all plots for a world",
category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.CONSOLE,
confirmation = true)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -52,7 +52,6 @@ import java.util.concurrent.TimeoutException;
aliases = {"t"},
requiredType = RequiredType.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)
public class Trust extends Command {

View File

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

View File

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

View File

@ -29,7 +29,6 @@ import com.plotsquared.core.player.PlotPlayer;
@CommandDeclaration(command = "weanywhere",
permission = "plots.worldedit.bypass",
description = "Force bypass of WorldEdit restrictions",
aliases = {"wea"},
usage = "/plot weanywhere",
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.Command;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan;
@ -37,21 +38,22 @@ public class HelpObject {
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) {
_rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_item").getComponent(audience),
Template.of("usage", command.getUsage().replaceAll("\\{label\\}", label)),
Template.of("alias", command.getAliases().isEmpty() ? StringMan.join(command.getAliases(), "|") : ""),
Template.of("desc", command.getDescription()), Template.of("arguments", buildArgumentList(command.getRequiredArguments())),
rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_item").getComponent(audience),
Template.of("usage", command.getUsage().replace("{label}", label)),
Template.of("alias", command.getAliases().isEmpty() ? "" : StringMan.join(command.getAliases(), " | ")),
Templates.of(audience, "desc", command.getDescription()),
Template.of("arguments", buildArgumentList(command.getRequiredArguments())),
Template.of("label", label)));
}
@Override public String toString() {
return _rendered;
return rendered;
}
private String buildArgumentList(final Argument[] arguments) {
private String buildArgumentList(final Argument<?>[] arguments) {
if (arguments == null) {
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_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_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.direction": "<prefix><gold>Current direction: </gold><gray><dir></gray>",
@ -686,7 +686,12 @@
"commands.description.dislike": "<gray>Dislike the plot.</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.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.help": "<gray>Get this help menu.</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.template": "<gray>Create or use a world template.</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.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>",