mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 22:16:22 +00:00
Get command description from loaded command data, not description file
This commit is contained in:
1 parent
8db7df95a0
commit
6a2161434e
1 file changed
+11
-8
@@ -36,21 +36,24 @@ public class HuskHomesCommand extends CommandBase implements TabCompleter {
|
|||||||
// Show users a list of available commands
|
// Show users a list of available commands
|
||||||
public static void showHelpMenu(Player player, int pageNumber) {
|
public static void showHelpMenu(Player player, int pageNumber) {
|
||||||
ArrayList<String> commandDisplay = new ArrayList<>();
|
ArrayList<String> commandDisplay = new ArrayList<>();
|
||||||
for (String command : plugin.getDescription().getCommands().keySet()) {
|
for (String commandName : plugin.getDescription().getCommands().keySet()) {
|
||||||
|
Command command = plugin.getCommand(commandName);
|
||||||
|
if (command == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (commandName.equals("huskhomes") && HuskHomes.getSettings().hideHuskHomesCommandFromHelpMenu()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (HuskHomes.getSettings().hideCommandsFromHelpMenuWithoutPermission()) {
|
if (HuskHomes.getSettings().hideCommandsFromHelpMenuWithoutPermission()) {
|
||||||
String permission = (String) plugin.getDescription().getCommands().get(command).get("permission");
|
String permission = command.getPermission();
|
||||||
if (permission != null) {
|
if (permission != null) {
|
||||||
if (!player.hasPermission(permission)) {
|
if (!player.hasPermission(permission)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (command.equals("huskhomes") && HuskHomes.getSettings().hideHuskHomesCommandFromHelpMenu()) {
|
commandDisplay.add(MessageManager.getRawMessage("command_list_item", commandName,
|
||||||
continue;
|
command.getUsage(), command.getDescription()));
|
||||||
}
|
|
||||||
String commandDescription = (String) plugin.getDescription().getCommands().get(command).get("description");
|
|
||||||
String commandUsage = (String) plugin.getDescription().getCommands().get(command).get("usage");
|
|
||||||
commandDisplay.add(MessageManager.getRawMessage("command_list_item", command, commandUsage, commandDescription));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.sendMessage(player, "command_list_header");
|
MessageManager.sendMessage(player, "command_list_header");
|
||||||
|
|||||||
Reference in new issue
Block a user