Solved Custom plugin not loading ><

Discussion in 'Plugin Development' started by Lmagination, Sep 14, 2013.

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

    Lmagination

    EDIT: Solved, thanks for all the help guys :)

    Hey guys, I'm pretty new to the coding world of Java and Bukkit Plugin Dev. After some playing around I decided my hand at creating a plugin for punishing combat loggers, however when I exported the plugin to test it would not load on my server.
    The error I'm getting from console is this:
    Code:
    7:21:50 PM [SEVERE] Could not load 'plugins\CombatLogger.jar' in folder 'plugins'
    7:21:50 PM org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: me.tony.combatlogger.CombatLogger
    7:21:50 PM    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
    7:21:50 PM    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    7:21:50 PM    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    7:21:50 PM    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.java:239)
    7:21:50 PM    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:217)
    7:21:50 PM    at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56)
    7:21:50 PM    at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11)
    7:21:50 PM    at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:106)
    7:21:50 PM    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:391)
    7:21:50 PM    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    7:21:50 PM Caused by: java.lang.ClassNotFoundException: me.tony.combatlogger.CombatLogger
    7:21:50 PM    at java.net.URLClassLoader$1.run(Unknown Source)
    7:21:50 PM    at java.net.URLClassLoader$1.run(Unknown Source)
    7:21:50 PM    at java.security.AccessController.doPrivileged(Native Method)
    7:21:50 PM    at java.net.URLClassLoader.findClass(Unknown Source)
    7:21:50 PM    at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
    7:21:50 PM    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
    7:21:50 PM    at java.lang.ClassLoader.loadClass(Unknown Source)
    7:21:50 PM    at java.lang.ClassLoader.loadClass(Unknown Source)
    7:21:50 PM    at java.lang.Class.forName0(Native Method)
    7:21:50 PM    at java.lang.Class.forName(Unknown Source)
    7:21:50 PM    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
    7:21:50 PM    ... 9 more
    My current code for my Plugin is:
    Code:java
    1. package me.tony.combatlogger;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.Server;
    5. import org.bukkit.configuration.file.FileConfiguration;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.entity.EntityType;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.EventPriority;
    10. import org.bukkit.event.Listener;
    11. import org.bukkit.event.player.PlayerQuitEvent;
    12. import org.bukkit.plugin.java.JavaPlugin;
    13.  
    14. public class CombatLogger extends JavaPlugin implements Listener
    15. {
    16. private FileConfiguration config;
    17.  
    18. @Override
    19. public void onEnable()
    20. {
    21. getServer().getPluginManager().registerEvents(this, this);
    22.  
    23. this.saveDefaultConfig();
    24. config = getConfig();
    25. }
    26.  
    27. @Override
    28. public void onDisable()
    29. {
    30. Bukkit.getConsoleSender().sendMessage("CombatLogger Disabled.");
    31. }
    32.  
    33. @EventHandler(priority = EventPriority.LOWEST)
    34. public void onLogout(PlayerQuitEvent event)
    35. {
    36. Player p = event.getPlayer();
    37.  
    38.  
    39. if (p.getLastDamageCause().getEntityType().equals(EntityType.PLAYER) || p.getLastDamageCause().getEntityType().equals(EntityType.ARROW) || p.getLastDamageCause().getEntityType().equals(EntityType.PRIMED_TNT)) //Checking to see if the damage cause was from another Player
    40. {
    41. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(),"/tempban " + event.getPlayer().getName() + " 5m");
    42. }
    43. }
    44. }
    45.  

    And my plugin.yml is set up as follows:
    Code:
    name: CombatLogger
    main: me.tony.combatlogger.CombatLogger
    version: 0.01
    
    Project SS:
    http://puu.sh/4rAyY.png

    JAR Download:
    <Edit by Moderator: Redacted mediafire url>

    Would appreciate any help you guys can throw my way :)
     
    Last edited by a moderator: Nov 5, 2016
  2. Offline

    Jamesthatguy

    Your plugin.yml is probably wrong. Look at some examples.
     
  3. Offline

    Go Hard

    Lmagination
    It's not able to read your main class file so your plugin.yml is wrong
     
  4. Offline

    The_Doctor_123

    Interesting.. The problem is, is that the plugin cannot find your CombatLogger class. The code and everything looks good. Mind taking a snapshot of your project in Eclipse? And I mean like the hierarchy of the projects and packages and stuff on the left side.
     
    Lmagination likes this.
  5. Offline

    Lmagination

    That's what I thought as well, however I've tried changing my plugin.yml many times to no avail. Here's a Link to a SS of my Project:
    http://puu.sh/4rAyY.png
     
  6. Offline

    daboross

    Can you upload the jar that is failing? It probably didn't compile correctly.
     
  7. Offline

    Lmagination

    Here's the mediafire to the Jar: <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 5, 2016
  8. Offline

    Benatat12

    Maybe your spacing is incorrect? Like there's an extra space added possibly?
     
  9. Offline

    feildmaster

    [quote uid=90871778 name="Lmagination" post=1850194]Here's the mediafire to the Jar: <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 5, 2016
  10. Offline

    daboross

    [quote uid=90871778 name="Lmagination" post=1850194]Here's the mediafire to the Jar: <Edit by Moderator: Redacted mediafire url>

    The plugin.yml looks fine, how are you exporting it?
     
    Last edited by a moderator: Nov 5, 2016
Thread Status:
Not open for further replies.

Share This Page