mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Tweak command registration, make global respawn default to global spawn
This commit is contained in:
3 files changed
+30
-14
No files matched your search
@@ -144,7 +144,7 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask
|
||||
return null;
|
||||
} else {
|
||||
new BukkitCommand(command, this).register();
|
||||
return type.getCommand();
|
||||
return command;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
|
||||
@@ -48,15 +48,9 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
public void register() {
|
||||
// Register with bukkit
|
||||
final PluginCommand pluginCommand = Objects.requireNonNull(plugin.getCommand(command.getName()));
|
||||
pluginCommand.setExecutor(this);
|
||||
pluginCommand.setTabCompleter(this);
|
||||
pluginCommand.setDescription(command.getDescription());
|
||||
pluginCommand.setPermission(command.getPermission());
|
||||
|
||||
// Register commodore TAB completion
|
||||
if (CommodoreProvider.isSupported() && plugin.getSettings().doBrigadierTabCompletion()) {
|
||||
BrigadierUtil.registerCommodore(plugin, pluginCommand, command);
|
||||
final PluginCommand pluginCommand = plugin.getCommand(command.getName());
|
||||
if (pluginCommand == null) {
|
||||
throw new IllegalStateException("Command " + command.getName() + " not found in plugin.yml");
|
||||
}
|
||||
|
||||
// Register permissions
|
||||
@@ -66,8 +60,21 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
.map((entry) -> addPermission(entry.getKey(), "", getPermissionDefault(entry.getValue())))
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
addPermission(command.getPermission("*"), command.getUsage(), PermissionDefault.FALSE,
|
||||
childNodes.toArray(new Permission[0]));
|
||||
if (!childNodes.isEmpty()) {
|
||||
addPermission(command.getPermission("*"), command.getUsage(), PermissionDefault.FALSE,
|
||||
childNodes.toArray(new Permission[0]));
|
||||
}
|
||||
|
||||
// Set command parameters
|
||||
pluginCommand.setExecutor(this);
|
||||
pluginCommand.setTabCompleter(this);
|
||||
pluginCommand.setDescription(command.getDescription());
|
||||
pluginCommand.setPermission(command.getPermission());
|
||||
|
||||
// Register commodore TAB completion
|
||||
if (CommodoreProvider.isSupported() && plugin.getSettings().doBrigadierTabCompletion()) {
|
||||
BrigadierUtil.registerCommodore(plugin, pluginCommand, command);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in new issue
Block a user