plugin.InvalidPluginException

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

  1. Offline

    TheRealIceGuru

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

    CookpotListener
    Code (Text):
    1.  package com.permaclan.Cookpot;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.block.Block;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.event.EventHandler;
    7. import org.bukkit.event.EventPriority;
    8. import org.bukkit.event.Listener;
    9. import org.bukkit.event.block.Action;
    10. import org.bukkit.event.player.PlayerInteractEvent;
    11. import org.bukkit.inventory.Inventory;
    12. import org.bukkit.inventory.ItemStack;
    13.  
    14. public class CookpotListener implements Listener {
    15.  
    16. Cookpot plugin;
    17.  
    18. CookpotListener(Cookpot p){
    19. plugin = p;
    20. }
    21.  
    22. @EventHandler(priority = EventPriority.NORMAL)
    23. public void onPlayerInteract(PlayerInteractEvent event) {
    24. Player player = event.getPlayer();
    25. Block block = event.getClickedBlock();
    26. if (block.getTypeId() != 380) {
    27. return;
    28. }
    29. if (block != null && event.getAction() == Action.LEFT_CLICK_BLOCK) {
    30. if (block.getRelative(0, -1, 0).getTypeId() != 51) {
    31. player.sendMessage(ChatColor.RED+"Fires are needed to cook!");
    32. return;
    33. } else {
    34. if (player.getInventory().getItemInHand() != null && player.getInventory().getItemInHand().getTypeId() == 369 ) {
    35. cookObjects(player.getInventory());
    36. event.getPlayer().getInventory().getItemInHand().setAmount(event.getPlayer().getInventory().getItemInHand().getAmount()-1);
    37. player.sendMessage(ChatColor.GREEN+"Your items have been cooked!");
    38. return;
    39. } else {
    40. player.sendMessage(ChatColor.RED+"You need to stir the pot with a blazerod.");
    41. return;
    42. }
    43. }
    44. } else {
    45. return;
    46. }
    47. }
    48.  
    49. private void cookObjects(Inventory i)
    50. {
    51. for(ItemStack is : i.getContents())
    52. {
    53. if(is.getTypeId() == 296)
    54. {
    55. is.setTypeId(297);
    56. }
    57. else if(is.getTypeId() == 349)
    58. {
    59. is.setTypeId(350);
    60. }
    61. }
    62. }
    63. }
     
  2. 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

    Well now it's enabled but wont work 0.0
     

Share This Page