Plugin Help

Discussion in 'Plugin Development' started by Linux1337, Aug 23, 2012.

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

    Linux1337

    Hi guys,

    Something is wrong with my code and i cant figure it out, Can someone please help?

    Code:
    package com.plugin.checkinv;
    
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.PlayerInventory;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.event.Listener;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    
    public class CheckInv extends JavaPlugin{
        public void onEnable() {
            getServer().getPluginManager().registerEvents((Listener) this, this);
            getLogger().info("BlockCheck has been enabled!");
        }
        
        public void onDisable() {
            getLogger().info("BlockCheck has been disabled!");
        }
        
        public class LoginListener implements Listener {
            @EventHandler(priority = EventPriority.HIGHEST)
            public void onPlayerJoin(PlayerJoinEvent evt) {
                Player player = evt.getPlayer();
                PlayerInventory inventory = player.getInventory();
                
                if (inventory.contains(Material.BEDROCK)) {
                    inventory.remove(Material.BEDROCK);
                    player.sendMessage("Why do you have bedrock???");
                }
            }
        }
    }
    Heres the error:

    Code:
    2012-08-23 15:56:37 [SEVERE] Could not load 'plugins/CkeckInv1.0.5.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:208)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:132)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:222)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:198)
        at net.minecraft.server.ServerConfigurationManagerAbstract.<init>(ServerConfigurationManagerAbstract.java:50)
        at net.minecraft.server.ServerConfigurationManager.<init>(SourceFile:11)
        at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:105)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: while scanning a simple key
     in "<reader>", line 4, column 1:
        description:Checks inventories f ... 
        ^
    could not found expected ':'
     in "<reader>", line 5, column 1:
        
        ^
    
        at org.yaml.snakeyaml.scanner.ScannerImpl.stalePossibleSimpleKeys(ScannerImpl.java:398)
        at org.yaml.snakeyaml.scanner.ScannerImpl.needMoreTokens(ScannerImpl.java:229)
        at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:178)
        at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.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.composeDocument(Composer.java:123)
        at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106)
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.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:42)
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:203)
        ... 8 more
    
     
  2. Offline

    Jnorr44

    We need to see your plugin.yml, that is where the beast (problem) sleeps!
     
  3. Offline

    Linux1337

    my plugin.yml is file but here is it anyways:

    Code:
    name: CheckInv
    main: com.plugin.checkinv.CheckInv
    version: 1.0.5
    
    This is confusing 0_0
     
  4. Offline

    Jnorr44

    You have something on line 4:

    line 4, column 1:
    description:Checks inventories f ...


    and line 5...

    could not found expected ':'
    in "<reader>", line 5, column 1:
     
  5. Offline

    Linux1337

    Ok updated plugin.yml...

    New error:
    Code:
    26:34 [SEVERE] Error occurred while enabling CheckInv v1.0.5 (Is it up to date?)
    java.lang.ClassCastException: com.plugin.checkinv.CheckInv cannot be cast to org.bukkit.event.Listener
        at com.plugin.checkinv.CheckInv.onEnable(CheckInv.java:14)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:365)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:265)
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:247)
        at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:296)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:275)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:225)
        at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:140)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    16:26:34 [INFO] Server permissions file permissions.yml is empty, ignoring it
    16:26:34 [INFO] Done (2.554s)! For help, type "help" or "?"
    
    no thats all of my plugin.yml

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  6. Offline

    Jnorr44

    You don't have to register events on the main class:
    getServer().getPluginManager().registerEvents((Listener) this, this); delete this

    and maybe your plugin.yml has extra lines? Either way... there was a description in there that you may have deletd... you just might've forgotten to refresh and re-export
     
  7. Offline

    Linux1337

    Ok problem solved! now all i have to do is test it!
     
Thread Status:
Not open for further replies.

Share This Page