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 (Text):
    1. [B]package.org.d404;[/B]
    2. import org.bukkit.event.Listener;
    3. import org.bukkit.plugin.java.JavaPlugin;
    4. public final class KitsMain extends JavaPlugin {
    5. @Override
    6. [FONT=mceinline]public void onEnable() {[/FONT]
    7. [FONT=mceinline]getServer().getPluginManager().registerEvents((Listener) new KitsBasicListener(), this);[/FONT]
    8. [FONT=mceinline]getServer().getPluginManager().registerEvents((Listener) new KitsArmorListener(), this);[/FONT]
    9. [FONT=mceinline]getLogger().info("Plugin on");[/FONT]
    10. [FONT=mceinline]}[/FONT]
    11. [FONT=mceinline]public void onDisable() {[/FONT]
    12. [FONT=mceinline]getLogger().info("Plugin off");[/FONT]
    13. [FONT=mceinline]}[/FONT]
    14. [FONT=mceinline]}[/FONT]
    15. [FONT=mceinline]
    [/FONT]
    KitsBasicListener code:
    Code (Text):
    1. [/FONT]
    2. package org.d404;
    3. import org.bukkit.Material;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandSender;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.inventory.ItemStack;
    8. public class KitsBasicListener {
    9.  
    10.  
    11. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    12. if(cmd.getName().equalsIgnoreCase("basic")){
    13.  
    14.  
    15. return true;
    16. } Player a = (Player) sender;
    17. ItemStack diamondSword = new ItemStack(Material.DIAMOND_SWORD);
    18. a.getInventory().setItem(0, diamondSword);
    19. ItemStack ironHelmet = new ItemStack(Material.IRON_HELMET);
    20. a.getInventory().setHelmet(ironHelmet);
    21. ItemStack ironChestPlate = new ItemStack(Material.IRON_CHESTPLATE);
    22. a.getInventory().setChestplate(ironChestPlate);
    23. ItemStack ironLeggings = new ItemStack(Material.IRON_LEGGINGS);
    24. a.getInventory().setLeggings(ironLeggings);
    25. ItemStack ironBoots = new ItemStack(Material.IRON_BOOTS);
    26. a.getInventory().setBoots(ironBoots);
    27. return false;
    28.  
    29. }
    30. }
    31.  
    Please help me with this! Thanks alot![/code]
     
  2. Offline

    fireblast709

    My BukkitDev Profile
    My Plugins (3)
    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

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

Share This Page