Bukkit Plugin Problem (hElp)

Discussion in 'Plugin Development' started by jimdevl, Mar 14, 2015.

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

    jimdevl

    so when i made my 1st ever plugin and this is the code :
    Show Spoiler

    package me.ItzL1nX.grenader;

    import org.bukkit.Bukkit;
    import org.bukkit.Material;
    import org.bukkit.entity.Egg;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.ProjectileHitEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Grenader extends JavaPlugin implements Listener {

    public void onEnable() {
    Bukkit.getServer().getLogger().info("Plugin enabled!");
    Bukkit.getPluginManager().registerEvents(this, this);
    }
    @EventHandler
    public void onProjectileHit(ProjectileHitEvent e) {
    if (e.getEntity() instanceof Egg & e.getEntity().getShooter() instanceof Player) {
    if (((Player) e.getEntity().getShooter()).hasPermission("grenade.egg.explode")) {
    e.getEntity().getWorld().createExplosion(e.getEntity().getLocation(), 1.0f, false);
    ((Player) e.getEntity().getShooter()).getInventory().remove(new ItemStack(Material.EGG, 1));
    return;
    }
    return;
    }
    return;
    }


    }


    And this is the error:
    Show Spoiler

    [01:24:44] [Server thread/ERROR]: Could not load 'plugins/Grenader.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/ItzL1nX/grenader/Grenader : Unsupported major.minor version 52.0
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:355) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:317) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:126) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    Caused by: java.lang.UnsupportedClassVersionError: me/ItzL1nX/grenader/Grenader : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_71]
    at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_71]
    at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_71]
    at java.net.URLClassLoader.defineClass(Unknown Source) ~[?:1.7.0_71]
    at java.net.URLClassLoader.access$100(Unknown Source) ~[?:1.7.0_71]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_71]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_71]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_71]
    at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_71]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_71]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_71]
    at java.lang.Class.forName0(Native Method) ~[?:1.7.0_71]
    at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_71]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    ... 9 more

    HELPP
     
  2. Offline

    Monkey_Swag

    Make sure your server's jar is the same as the jar you compiled your plugin with.
     
  3. Offline

    jimdevl

    i use the bukkit-1.7.10-R0.1-20140817.175650-8
    server uses craftbukkit 1.7.9 R-0-2 (BETA)
     
  4. Offline

    Kilorbine

    Which java version do you use to compile?
    And to run your server?
     
  5. Offline

    timtower Administrator Administrator Moderator

    @jimdevl You are compiling with java 8 while your server isn't running that.
     
  6. Offline

    jimdevl

  7. Offline

    timtower Administrator Administrator Moderator

    @jimdevl You can change that somewhere in your eclipse settings ( assuming that you use eclipse )
    Don't know exactly where though as I never needed this.
     
  8. Offline

    Kilorbine

    You have to change the eclipse.ini (if you use eclipse)
    You should have something like
    C:\Program Files\Java\jre1.7\blabla\...
    Change to C:\Program Files\Java\jre1.8\blabla\... (in fact, go in \Java\ to check the correct name)
    Then, relaunch eclipse and recompile.
    It should work fine.
    If eclipse.ini is already with jre1.8, do the same with your .bat (if you use one) who launch your server.
     
  9. Offline

    jimdevl

    yes i use eclipse

    so i compile w/ Javase 1.7
     
    Last edited by a moderator: Mar 15, 2015
  10. Offline

    lewis_hutsby

    Well, you are compiling with Java 1.8 when your server runs Java 1.7 try compiling with 1.7 then export it and restart your server, also post your plugin.yml if it doesn't work when compiled with 1.7!

    Oh and, try change your server version from 1.7.9 to 1.7.10 or just select your buildpath as 1.7.9 :) If you are still having problems either reply with your skype or just private message me it. I'll add you and see what the problem is.
     
    Last edited by a moderator: Mar 15, 2015
Thread Status:
Not open for further replies.

Share This Page