mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Add command disabling
This commit is contained in:
1 parent
632d43d131
commit
6cd2a23770
7 files changed
+59
-12
No files matched your search
@@ -16,18 +16,18 @@ public abstract class CommandBase {
|
||||
@NotNull
|
||||
public final String command;
|
||||
|
||||
/**
|
||||
* Alias input strings for this command
|
||||
*/
|
||||
@NotNull
|
||||
public final String[] aliases;
|
||||
|
||||
/**
|
||||
* The permission node required to use this command
|
||||
*/
|
||||
@NotNull
|
||||
protected final String permission;
|
||||
|
||||
/**
|
||||
* Alias input strings for this command
|
||||
*/
|
||||
@NotNull
|
||||
protected final String[] aliases;
|
||||
|
||||
/**
|
||||
* Instance of the implementing plugin
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.william278.huskhomes.command;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.player.OnlineUser;
|
||||
import net.william278.huskhomes.util.Permission;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DisabledCommand extends CommandBase {
|
||||
|
||||
public DisabledCommand(@NotNull HuskHomes implementor) {
|
||||
super("", Permission.COMMAND_DISABLED_MESSAGE, implementor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||
plugin.getLocales().getLocale("error_command_disabled").ifPresent(onlineUser::sendMessage);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import net.william278.annotaml.KeyPath;
|
||||
import net.william278.annotaml.YamlFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -205,6 +206,10 @@ public class Settings {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
// Disabled commands
|
||||
@KeyPath("disabled_commands")
|
||||
public List<String> disabledCommands = Collections.emptyList();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public Settings() {
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ public enum Permission {
|
||||
/*
|
||||
* Command permission nodes
|
||||
*/
|
||||
/**
|
||||
* Lets the user view the "disabled command" message for disabled commands
|
||||
*/
|
||||
COMMAND_DISABLED_MESSAGE("huskhomes.disabled_command_message", DefaultAccess.EVERYONE),
|
||||
|
||||
/**
|
||||
* Lets the user teleport to their homes ({@code /home [home_name]})
|
||||
|
||||
Reference in new issue
Block a user