Error with org.bukkit.event.Listener

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

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

    Edman

    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; 
     
    }
    }
    
    Please help me with this! Thanks alot![/code]
     
    1. when making a listener, the class should implement Listener
    2. onCommand() is not a listener, but a CommandExecutor
     
  2. Offline

    Edman

    How would I go about doing with with CommandExecutor? I tried putting it where Listener goes, but it was to no avail.
     
Thread Status:
Not open for further replies.

Share This Page