added optional permission for appliance commands
This commit is contained in:
1 parent
86ae261c60
commit
675d87f6e9
3 files changed
+15
No files matched your search
@@ -139,6 +139,7 @@ public abstract class Appliance {
|
|||||||
PluginCommand command = this.createPluginCommand(name, plugin);
|
PluginCommand command = this.createPluginCommand(name, plugin);
|
||||||
command.setExecutor(executor);
|
command.setExecutor(executor);
|
||||||
command.setTabCompleter(executor);
|
command.setTabCompleter(executor);
|
||||||
|
if(executor.permission() != null) command.setPermission(executor.permission());
|
||||||
plugin.getServer().getCommandMap().register(plugin.getName(), command);
|
plugin.getServer().getCommandMap().register(plugin.getName(), command);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
throw new RuntimeException(String.format("Failed to register command '%s'", name), e);
|
throw new RuntimeException(String.format("Failed to register command '%s'", name), e);
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ public abstract class ApplianceCommand<T extends Appliance> extends CachedApplia
|
|||||||
this.errorMessage = errorMessage;
|
this.errorMessage = errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permission needed to see and run the command. Paper leaves the command out of the command tree
|
||||||
|
* of players without it, so for them it does not exist. Null means everyone.
|
||||||
|
*/
|
||||||
|
public @Nullable String permission() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ database:
|
|||||||
loginLog:
|
loginLog:
|
||||||
retentionMonths: 16
|
retentionMonths: 16
|
||||||
|
|
||||||
|
banEvasion:
|
||||||
|
windowDays: 14
|
||||||
|
rejectionWindowHours: 24
|
||||||
|
banCacheMinutes: 5
|
||||||
|
retentionMonths: 16
|
||||||
|
|
||||||
worldMuseum:
|
worldMuseum:
|
||||||
uuid:
|
uuid:
|
||||||
connect-server-name: worldmuseum
|
connect-server-name: worldmuseum
|
||||||
|
|||||||
Reference in new issue
Block a user