MyEntityListener cannot be cast to EntityListener

Discussion in 'Plugin Development' started by Zelnehlun, Dec 12, 2011.

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

    Zelnehlun

    Hello Bukkit Community,
    I am having trouble adding listeners to my plugin, I am using the latest Bukkit Snapshot (1069) and the latest Craftbukkit Snapshot (1588) [not the recommended ones].
    Here is the code of the main class:
    Code:
    PlayerListener playerListener;
        EntityListener entityListener;
    
        public void onEnable(){
            playerListener = new OrbPlayerListener(this);
            entityListener = new OrbEntityListener(this);
            PluginManager pm = Bukkit.getPluginManager();
      
            pm.registerEvent(Type.ENTITY_DEATH, entityListener, Event.Priority.Normal, this);
    
            pm.registerEvent(Type.PLAYER_PICKUP_ITEM, playerListener, Event.Priority.Normal, this);
    }
    This is the code of my Entity Listener class:
    Code:
    public class OrbEntityListener extends EntityListener {
    
        Orb plugin;
    
        OrbEntityListener(Orb plugin){
            this.plugin = plugin;
        }
    Testing my plugin on the server throws exception in the console: OrbEntityListener cannot be cast to org.bukkit.event.entity.EntityListener
     
  2. Offline

    halley

    You need to show the import lines for your java files. I expect you're importing or exending the wrong EntityListener or something else fundamental here.
     
  3. Offline

    Zelnehlun

    [SOLVED]

    Sorry, tested it on another server, worked perfectly fine... Then deleted content of my local server and it works fine too... Sorry for asking (I am importing the right Listeners ;)
     
Thread Status:
Not open for further replies.

Share This Page