How to fix a plugin.yml error?

Discussion in 'Plugin Development' started by Hunslet, Jun 30, 2019.

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

    Hunslet

    Error: org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml

    Main:
    Code:
    package me.AntiRazer;
    
    //import org.bukkit.ChatColor;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin {
       public void onEnable() {
         System.out.print("Hello");
         this.getCommand("mod").setExecutor((CommandExecutor)new Commands());
         this.getCommand("test").setExecutor((CommandExecutor)new Command2());
       }
       public void onDisable() {
         System.out.print("Closing plugin...");
       }
    }
    
    Command:
    Code:
    package me.AntiRazer;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    public class Commands implements CommandExecutor {
      @Override
      public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
      Player player = (Player) sender;
      if (sender instanceof Player){
      sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4Putting you in modmode"));
      }
      if(!(sender instanceof Player)) {
         sender.sendMessage("You can't send this command from the console, doofus");
      }
      if(!(sender.isOp())) {
         player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4You are not in ModMode!"));
         return false;
      }
      if(sender.isOp()) {
         sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"(!) You are op! (!)"));
    
      }
      return true;
      }
    }

    Command2:
    Code:
    package me.AntiRazer;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    public class Command2 implements CommandExecutor {
      @Override
      public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
      Player player = (Player) sender;
      if (sender instanceof Player){
      player.sendMessage(ChatColor.translateAlternateColorCodes('&', "a"));
    
      System.out.print(Bukkit.getOnlinePlayers());
      }
      if(!(sender instanceof Player)) {
         sender.sendMessage("You can't send this command from the console, doofus");
      }
    
    
      return false;
      }
    }
    Plugin.yml
    Code:
    name: AntiRazerPro
    version: 1.2
    main: me.AntiRazer.Main
    description: AntiCheat!
    commands:
      mod:
      usage: /<mod>
      description: An Epic test command!
      test:
         usage: /<test>
         description: test command
     
    Last edited by a moderator: Jun 30, 2019
  2. Offline

    KAM202

    Code:
    name: AntiRazerPro
    version: 1.2
    main: me.AntiRazer.Main
    description: AntiCheat!
    commands:
      mod:
        usage: /<command>
        description: An Epic test command!
      test:
         usage: /<command>
         description: test command
     
  3. Offline

    KarimAKL

    There's your problem. You need to have 2 spaces for every indention.
    Example:
    Code:
    commands:
      command:
        usage: /<command> help
        description: "This is an example command!"
     
  4. Offline

    Kars

    I'm pretty sure a slash is a special character in YML.
    Put quotes around the usage "/<command> help".
     
  5. Offline

    KarimAKL

    @Kars There's no need to quote the slash, i never put the usage in quotes and i've never gotten any errors. :p
     
  6. Offline

    Kars

    Then i said nothing.
     
    KarimAKL likes this.
Thread Status:
Not open for further replies.

Share This Page