Help with config.yml and send message

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

Thread Status:
Not open for further replies.
  1. Offline

    hehh

    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:
    Code:
    Help-Message:
    - ---------------------------------
    -
    -  We're not helping!
    -
    - ---------------------------------
    
    my help command:

    Code:
    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 {
    
        @Override
        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

    so:

    ---------------------------------

    We're not helping

    ---------------------------------

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

    Thanks you
     
  2. Offline

    Strahan

    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.
     
Thread Status:
Not open for further replies.

Share This Page