hasherr
hasherr

Reputation: 709

Invalid plugin.yml exception with Bukkit

I'm just testing some basic Bukkit plugins, trying to get them to work so that I can test them. I keep getting the same error with my plugin (which I practically copied from the Bukkit wiki)

Here's the error message:

15:25:18 [INFO] Starting minecraft server version 1.6.2
15:25:18 [INFO] Loading properties
15:25:18 [INFO] Default game type: SURVIVAL
15:25:18 [INFO] Generating keypair
15:25:18 [INFO] Starting Minecraft server on *:25565
15:25:19 [INFO] This server is running CraftBukkit version git-Bukkit-1.6.2-R1.0
-b2879jnks (MC: 1.6.2) (Implementing API version 1.6.2-R1.0)
15:25:19 [SEVERE] Could not load 'plugins\Test-Plugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPlug
inLoader.java:257)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
.java:132)
        at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.ja
va:239)
        at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:21
7)
        at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56)
        at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11
)
        at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.jav
a:106)
        at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java
:391)
        at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:5
82)
Caused by: while scanning for the next token
found character         '\t' that cannot start any token
 in "<reader>", line 7, column 1:
        usage: /ignite [player]
    ^

        at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.ja
va:358)
        at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:17
9)
        at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Par
serImpl.java:563)
        at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161)
        at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:146)
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
:230)
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
:237)
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
:237)
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
        at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
3)
        at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106)

        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
tructor.java:121)
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:411)
        at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.
java:188)
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPlug
inLoader.java:252)
        ... 8 more

Right now, all I'm trying to do is to get this plugin to load on my server. The main error here is Invalid plugin.yml. Here's my plugin.yml file:

name: Test
main: com.hasherr.bukkit.test.Main
version: 1.0
commands:
  ignite:
        description: Sets the designated player on fire.
        usage: /ignite [player]
        permissions: Test.ignite
        permission-message: You can't use that command.

As for the actual code of the plugin, here it is:

public final class Main extends JavaPlugin
{

    @Override
    public void onEnable()
    {
        getLogger().info("Test plugin has been enabled.");
    }

    @Override
    public void onDisable()
    {
        getLogger().info("Test plugin has been disabled.");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        // Uses equalsIgnoreCase() over equals() to accept "ignite" and "IgNiTe."
        if (cmd.getName().equalsIgnoreCase("ignite")) {
            // Make sure that the player specified exactly one argument (the name of the player to ignite).
            if (args.length != 1) {
                // When onCommand() returns false, the help message associated with that command is displayed.
                return false;
            }

            // Make sure the sender is a player.
            if (!(sender instanceof Player)) {
                sender.sendMessage("Only players can set other players on fire.");
                sender.sendMessage("This is an arbitrary requirement for demonstration purposes only.");
                return true;
            }

            // Get the player who should be set on fire. Remember that indecies start with 0, not 1.
            Player target = Bukkit.getServer().getPlayer(args[0]);

            // Make sure the player is online.
            if (target == null) {
                sender.sendMessage(args[0] + " is not currently online.");
                return true;
            }

            // Sets the player on fire for 1,000 ticks (there are ~20 ticks in second, so 50 seconds total).
            target.setFireTicks(1000);
            return true;
        }
        return false;
    }

}

Could somebody tell me why I'm getting an Invalid plugin.yml message that doesn't allow my plugin to run? Let me know if you need any more details/info, I'll be happy to edit.

Upvotes: 1

Views: 4607

Answers (3)

Jeff
Jeff

Reputation: 1

name: Test
main: com.hasherr.bukkit.test.Main
version: 1.0
commands:
  ignite:
     description: Sets the designated player on fire.
     usage: /ignite [player]
permissions: 
  Test.ignite
    description: Sets a player on FIRE
    default:true

Like this...

Upvotes: 0

timbru31
timbru31

Reputation: 365

You can also configure that each time you press TAB it's automatically converted to spaces. Additonally you can define how many spaces should be inserted when you press TAB. Personally I use 4 spaces, at work we use the 2 spaces standard.

You can find the options in NotePad+ here

Settings -> Preferences -> Tab Settings

you can define it for each language and a default value. Just mark "Replace by space"

Upvotes: 0

Decimix
Decimix

Reputation: 373

You have tabs in your plugin.yml, which aren't allowed. The code runs as expected if you replace all of the tabs with a set amount of spaces (most commonly 4 in my experience).

If you're editing it in Notepad++, use Edit -> Blank Operations -> TAB to Space to replace all tabs with spaces automatically.

Upvotes: 3

Related Questions