Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Set;

public class QuestsCommandSwitcher extends CommandSwitcher implements TabExecutor {

Expand Down Expand Up @@ -76,21 +77,16 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman

@Override
public void showHelp(CommandSender sender) {
sender.sendMessage(ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "------------=[" + ChatColor.RED + " Quests v" + plugin
.getDescription().getVersion() + " " + ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "]=------------");
sender.sendMessage(ChatColor.GRAY + "The following commands are available: ");
sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + "/quests " + ChatColor.DARK_GRAY + ": show quests");
sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + "/quests c/category <categoryid> " + ChatColor.DARK_GRAY + ": open category by ID");
sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + "/quests q/quest <questid> (start|cancel|track) " + ChatColor.DARK_GRAY + ": start, cancel or track quest by ID");
sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + "/quests started " + ChatColor.DARK_GRAY + ": show started quests");
if (sender.hasPermission(subcommands.get("random").getPermission())) {
sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + "/quests random " + ChatColor.DARK_GRAY + ": show random quests");
}
if (sender.hasPermission(subcommands.get("admin").getPermission())) {
sender.sendMessage(ChatColor.DARK_GRAY + " * " + ChatColor.RED + "/quests a/admin " + ChatColor.DARK_GRAY + ": view help for admins");
Set<String> permissions = plugin.getConfig().getConfigurationSection("command.player-help").getKeys(false);
for (String permission : permissions) {
if(!permission.contains("default") && !sender.hasPermission(subcommands.get(permission).getPermission())) continue;
for(String message : plugin.getConfig().getStringList("command.player-help."+permission)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use a string list to define multiline messages, instead use on of the many different ways to define newlines in YAML

https://yaml-multiline.info/

if(message.contains("%version%")) {
message = message.replace("%version%", plugin.getDescription().getVersion());
}
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
}
}
sender.sendMessage(ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "--------=[" + ChatColor.RED + " made with <3 by LMBishop " + ChatColor
.GRAY.toString() + ChatColor.STRIKETHROUGH + "]=--------");
}

@Override
Expand Down
16 changes: 16 additions & 0 deletions bukkit/src/main/resources/resources/bukkit/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@

# Trying to add new categories? This has been moved to categories.yml

#Default section doesn't require any permission
command:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be with the other messages (though this system is going to redone at some point in the future anyway)

player-help:
default-start:
- "&7&m------------=[&c Quests v%version% &7&m]=------------"
- "&7The following commands are available: "
- "&8 * &c/quests &8: show quests"
- "&8 * &c/quests c/category <categoryid> &8: open category by ID"
- "&8 * &c/quests q/quest <questid> (start|cancel|track) &8: start, cancel or track quest by ID"
- "&8 * &c/quests started &8: show started quests"
random:
- "&8 * &c/quests random &8: show random quests"
admin:
- "&8 * &c/quests a/admin &8: view help for admins"
default-end:
- "&7&m--------=[&c made with <3 by LMBishop &7&m]=--------"
# The items listed below are placeholder items for quests which the player cannot start.
# You should change these for 1.8
gui:
Expand Down