Help with config.yml and send message

Discussion in 'Plugin Development' started by hehh, Aug 6, 2020.

  1. Offline


    Hi, i recently created a config.yml for my plugin!

    it works fine, but now i want to send the message that is in config, when a player executes a command.

    my config.yml:
    - ---------------------------------
    -  We're not helping!
    - ---------------------------------
    my help command:

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import ca.hehh.serveur.config;
    public class CommandHelp implements CommandExecutor {
        public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
            if(sender instanceof Player) {
                Player player = (Player)sender;
            return false;

    here i want to send whats in the config file



    We're not helping


    How can I make the plugin send whats in the config file?

    Thanks you
  2. Offline


    Get the StringList "Help-Message" then iterate over it, sending the message to the player during the loop.

    PS in that iteration page lists of examples, their for-each method is the one I'd use. Don't forget to run the String through ChatColor.translateAlternateColorCodes as well.

Share This Page