Error with org.bukkit.event.Listener

Discussion in 'Plugin Development' started by Edman, Jan 4, 2013.

  1. Offline

    Edman

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I encounter this error when running my plugin on a test server
    [IMG]
    Main code:
    Code:
    [B]package.org.d404;[/B]
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    public final class KitsMain extends JavaPlugin {
    @Override
    [FONT=mceinline]public void onEnable() {[/FONT]
    [FONT=mceinline]getServer().getPluginManager().registerEvents((Listener) new KitsBasicListener(), this);[/FONT]
    [FONT=mceinline]getServer().getPluginManager().registerEvents((Listener) new KitsArmorListener(), this);[/FONT]
    [FONT=mceinline]getLogger().info("Plugin on");[/FONT]
    [FONT=mceinline]}[/FONT]
    [FONT=mceinline]public void onDisable() {[/FONT]
    [FONT=mceinline]getLogger().info("Plugin off");[/FONT]
    [FONT=mceinline]}[/FONT]
    [FONT=mceinline]}[/FONT]
    [FONT=mceinline]
    [/FONT]
    KitsBasicListener code:
    Code:
    [/FONT]
    package org.d404;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    public class KitsBasicListener {
     
     
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    if(cmd.getName().equalsIgnoreCase("basic")){
     
     
    return true;
    } Player a = (Player) sender;
    ItemStack diamondSword = new ItemStack(Material.DIAMOND_SWORD);
    a.getInventory().setItem(0, diamondSword);
    ItemStack ironHelmet = new ItemStack(Material.IRON_HELMET);
    a.getInventory().setHelmet(ironHelmet);
    ItemStack ironChestPlate = new ItemStack(Material.IRON_CHESTPLATE);
    a.getInventory().setChestplate(ironChestPlate);
    ItemStack ironLeggings = new ItemStack(Material.IRON_LEGGINGS);
    a.getInventory().setLeggings(ironLeggings);
    ItemStack ironBoots = new ItemStack(Material.IRON_BOOTS);
    a.getInventory().setBoots(ironBoots);
    return false; 
     
    }
    }
    [/code]
    Please help me with this! Thanks alot![/code][/FONT]

    This post has been edited 1 time. It was last edited by c0mp Jan 4, 2013.
  2. Offline

    fireblast709

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    1. when making a listener, the class should implement Listener
    2. onCommand() is not a listener, but a CommandExecutor
  3. Offline

    Edman

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    How would I go about doing with with CommandExecutor? I tried putting it where Listener goes, but it was to no avail.
  4. Offline

    fireblast709

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

Share This Page