Weird Problem

Discussion in 'Plugin Development' started by Flappie, Oct 8, 2011.

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


    Ok, i've had this problem for a while now.

    Each time i try to compile my plugin, it seems that only the main class is working the one with the onEnable and onDisable, and my listeners are not created when they should, i would really appeciate if someone could help me, i've seen other people with this problem but i've never found a fix.

    for some reason it does load in the console, but the actual code isnt working ..

    MainClass (this loads properly to some extend.)

    package nick.bukkit.tntnote;
    import java.util.logging.Logger;
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginManager;
    public class TNTNote extends JavaPlugin {
        private Logger log = Logger.getLogger("Minecraft");
        public void onEnable() {
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.BLOCK_PLACE, new TNTNoteBlockListener(), Priority.Highest, this);
        public void onDisable() {
        protected void logMessage(String msg){
            PluginDescriptionFile pdFile = this.getDescription();
   + " " + pdFile.getVersion() + ": " + msg);
    This wont work at all..

    package nick.bukkit.tntnote;
    import org.bukkit.Material;
    import org.bukkit.block.Block;
    import org.bukkit.event.block.BlockListener;
    import org.bukkit.event.block.BlockPlaceEvent;
    public class TNTNoteBlockListener extends BlockListener {
        public void OnBlockPlace(BlockPlaceEvent event){
            if(event.isCancelled()) return;
            Block block = event.getBlock();
            if(block.getType() == Material.DIRT){
    for the hell of it..

    name: Lols
    main: nick.bukkit.tntnote.TNTNote
    version: 0.1
    description: >
                 Hello World!
  2. Offline


    public void OnBlockPlace(BlockPlaceEvent event){


    public void onBlockPlace(BlockPlaceEvent event){
  3. Offline


    try replacing ur registers to
    pm.registerEvent(Event.Type.BLOCK_PLACE, NAMEOFCLASS , Priority.Highest, this);
  4. Offline


    That is incorrect syntax, however we can do something like this:
    BlockListener blockListen = new TNTNoteBlockListener();
    pm.registerEvent(Event.Type.BLOCK_PLACE, blockListen, Priority.Highest, this);

    Although, that will not the fix the issue here, the methods overrided in the block listener are case sensitive, so it has to be from OnBlockPlace to onBlockPlace.
  5. Offline


    it work for me =) , i missed the listener object creation my bad lol its like vaiquero says
Thread Status:
Not open for further replies.

Share This Page