mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Manually register aliases
This commit is contained in:
1 parent
435a9b9dff
commit
3b69b2df4d
3 files changed
+15
-8
No files matched your search
@@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,7 +37,6 @@ public class BukkitCommand implements CommandExecutor, TabExecutor {
|
||||
*/
|
||||
public void register(@NotNull PluginCommand pluginCommand) {
|
||||
try {
|
||||
pluginCommand.setAliases(Arrays.asList(command.aliases));
|
||||
pluginCommand.setPermission(command.permission);
|
||||
pluginCommand.setDescription(command.getDescription());
|
||||
pluginCommand.setExecutor(this);
|
||||
|
||||
@@ -17,20 +17,24 @@ commands:
|
||||
usage: /sethome <name>
|
||||
homelist:
|
||||
usage: /homelist [page]
|
||||
aliases: [homes]
|
||||
delhome:
|
||||
usage: /delhome <name>
|
||||
edithome:
|
||||
usage: /edithome <name> [rename|description|relocate|privacy] [args]
|
||||
publichome:
|
||||
usage: /publichome [<owner_name>.<home_name>]
|
||||
aliases: [phome]
|
||||
publichomelist:
|
||||
usage: /publichomelist [page]
|
||||
aliases: [phomelist, phomes]
|
||||
warp:
|
||||
usage: /warp <name>
|
||||
setwarp:
|
||||
usage: /setwarp <name>
|
||||
warplist:
|
||||
usage: /warplist [page]
|
||||
aliases: [warps]
|
||||
delwarp:
|
||||
usage: /delwarp <name>
|
||||
editwarp:
|
||||
|
||||
@@ -13,25 +13,29 @@ public abstract class CommandBase {
|
||||
/**
|
||||
* The input string to match for this command
|
||||
*/
|
||||
@NotNull
|
||||
public final String command;
|
||||
|
||||
/**
|
||||
* The permission node required to use this command
|
||||
*/
|
||||
public final String permission;
|
||||
@NotNull
|
||||
protected final String permission;
|
||||
|
||||
/**
|
||||
* Alias input strings for this command
|
||||
*/
|
||||
public final String[] aliases;
|
||||
@NotNull
|
||||
protected final String[] aliases;
|
||||
|
||||
/**
|
||||
* Instance of the implementing plugin
|
||||
*/
|
||||
public final HuskHomes plugin;
|
||||
@NotNull
|
||||
protected final HuskHomes plugin;
|
||||
|
||||
|
||||
public CommandBase(@NotNull String command, @NotNull Permission permission, @NotNull HuskHomes implementor, String... aliases) {
|
||||
protected CommandBase(@NotNull String command, @NotNull Permission permission, @NotNull HuskHomes implementor,
|
||||
@NotNull String... aliases) {
|
||||
this.command = command;
|
||||
this.permission = permission.node;
|
||||
this.plugin = implementor;
|
||||
@@ -42,7 +46,7 @@ public abstract class CommandBase {
|
||||
* Fires when the command is executed
|
||||
*
|
||||
* @param onlineUser {@link OnlineUser} executing the command
|
||||
* @param args Command arguments
|
||||
* @param args Command arguments
|
||||
*/
|
||||
public abstract void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args);
|
||||
|
||||
@@ -51,6 +55,7 @@ public abstract class CommandBase {
|
||||
*
|
||||
* @return the command description
|
||||
*/
|
||||
@NotNull
|
||||
public String getDescription() {
|
||||
return plugin.getLocales().getRawLocale(command + "_command_description")
|
||||
.orElse("A HuskHomes command");
|
||||
|
||||
Reference in new issue
Block a user