plugin.InvalidPluginException

Discussion in 'Plugin Development' started by TheRealIceGuru, Apr 27, 2012.

  1. Offline

    TheRealIceGuru

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Error
    Code:
    2012-04-27 16:14:05 [SEVERE] Could not load 'plugins\Cookpot.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: com.permaclan.Cookpot
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:150)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:207)
    at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:183)
    at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:53)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:156)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:422)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.ClassNotFoundException: com.permaclan.Cookpot
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:41)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:139)
    ... 8 more
    Cookpot
    Code:
    package com.permaclan.Cookpot;
    
    import java.util.logging.Logger;
    
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Cookpot extends JavaPlugin {
    private Logger log = Logger.getLogger("Minecraft");
    public void onEnable() {
    log.info("Your plugin has been enabled.");
    getServer().getPluginManager().registerEvents(new CookpotListener(this), this);
    }
    
    public void onDisable() {
    log.info("Your plugin has been disabled.");
    }
    }

    CookpotListener
    Code:
     package com.permaclan.Cookpot;
    
    import org.bukkit.ChatColor;
    import org.bukkit.block.Block;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    
    public class CookpotListener implements Listener {
    
    Cookpot plugin;
    
    CookpotListener(Cookpot p){
    plugin = p;
    }
    
    @EventHandler(priority = EventPriority.NORMAL)
    public void onPlayerInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    Block block = event.getClickedBlock();
    if (block.getTypeId() != 380) {
    return;
    }
    if (block != null && event.getAction() == Action.LEFT_CLICK_BLOCK) {
    if (block.getRelative(0, -1, 0).getTypeId() != 51) {
    player.sendMessage(ChatColor.RED+"Fires are needed to cook!");
    return;
    } else {
    if (player.getInventory().getItemInHand() != null && player.getInventory().getItemInHand().getTypeId() == 369 ) {
    cookObjects(player.getInventory());
    event.getPlayer().getInventory().getItemInHand().setAmount(event.getPlayer().getInventory().getItemInHand().getAmount()-1);
    player.sendMessage(ChatColor.GREEN+"Your items have been cooked!");
    return;
    } else {
    player.sendMessage(ChatColor.RED+"You need to stir the pot with a blazerod.");
    return;
    }
    }
    } else {
    return;
    }
    }
    
    private void cookObjects(Inventory i)
    {
    for(ItemStack is : i.getContents())
    {
    if(is.getTypeId() == 296)
    {
    is.setTypeId(297);
    }
    else if(is.getTypeId() == 349)
    {
    is.setTypeId(350);
    }
    }
    }
    }
  2. Offline

    Njol

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    fix your plugin.yml:
    change
    main: com.permaclan.Cookpot
    to
    main: com.permaclan.Cookpot.Cookpot
    since your class Cookpot is in package com.permaclan.Cookpot, not com.permaclan.
  3. Offline

    TheRealIceGuru

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Well now it's enabled but wont work 0.0

Share This Page