Error on console when I launch my plugin

Discussion in 'Programming' started by Azen0x, Jun 25, 2015.

  1. Hi,
    I try to create my first plugin ! I use bukkit-1.8.1-R4-20111031.021102-1.

    But I have some problems when I start my server...
    I show you my error :

    [16:10:20 INFO]: [Test_2_events] Enabling Test_2_events v1.0.0
    [16:10:20 ERROR]: Error occurred while enabling Test_2_events v1.0.0 (Is it up t
    o date?)
    java.lang.NoClassDefFoundError: org/bukkit/event/Event$Type
    at fr.azenox.test_2_events.Main.onEnable( ~[?:?]
    at ~[c
    .java:327) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin(CraftServer.jav
    a:341) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins(CraftServer.
    java:313) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at net.minecraft.server.v1_8_R1.MinecraftServer.q(
    94) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at net.minecraft.server.v1_8_R1.MinecraftServer.k(
    62) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at net.minecraft.server.v1_8_R1.MinecraftServer.a(
    17) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.jav
    a:190) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    :484) [craftbukkit-1.8.jar:git-Bukkit-726656b]
    at Source) [?:1.8.0_45]
    Caused by: java.lang.ClassNotFoundException: org.bukkit.event.Event$Type
    java:67) ~[craftbukkit-1.8.jar:git-Bukkit-726656b]
    java:62) ~[craftbukkit-1.8.jar:git-Bukkit-726656b]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_45]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_45]
    ... 12 more

    My plugin is called "Test_2_events", and there is the source code:

    package fr.azenox.test_2_events;

    import java.util.logging.Logger;

    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.PluginManager;

    public class Main extends JavaPlugin implements Listener {

    public Logger Log = Logger.getLogger("Minecraft");

    public void onEnable() {
    PluginManager pm = getServer().getPluginManager();
    pm.registerEvent(Event.Type.PLAYER_JOIN, this, Priority.Normal, this); + "[Test_2]" + ChatColor.WHITE + " Chargement du plugin reussi");

    public void onDisable() { + "[Test_2]" + ChatColor.WHITE + " Déchargement du plugin reussi");

    public void onJoin(PlayerJoinEvent e){
    if(e.getPlayer() instanceof Player){
    e.getPlayer().sendMessage("§c[Test_2] §aHELLO " + e.getPlayer() + " !");


    I want to create my a plugin with an event which when someone is connecting on server, It say "Hello" !

    Can you help me please ?
  2. You're registering your listener wrong.

    It should be pm.registerEvent(this, this). I believe.

    Also, Use @EventHandler to set your listener priority.