EventListener not going to be called

Discussion in 'Spigot Plugin Development' started by John_H_Smith, Nov 10, 2019.

  1. Hi guys, I just want to print a message if a player is revived with a totem.
    I had created many plugins with listeners in the past, but I don't know why this one won't work.
    This is my Main:
    Code (Java):
    public static Logger log = Bukkit.getLogger();

    public void onEnable() {
         getServer().getPluginManager().registerEvents(new TotemActivationListener(this), this);
    And this the TotemActivationListener:
    Code (Java):
    public class TotemActivationListener implements Listener {

        private Main plugin;

        public TotemActivationListener(Main plugin) {
            this.plugin = plugin;

        @EventHandler(priority = EventPriority.HIGHEST)
        public void onTotemActivation(EntityResurrectEvent event) {
            Main.log.info("Running EntityResurrectEvent");
    I tried to use with EventPriority.HIGHEST, but this doesn't work either.
    The message just doesn't pop up.
    Thanks in advance!
  2. You call 'Main' instead of 'plugin'
    Edit: nvm log is static, sorry
  3. JavaPlugin already comes with a logger; use plugin.getLogger().info("info message");. Other than that, I really don't see why your event wouldn't trigger. Are you sure your plugin is loading? Forgot your plugin.yml?
  4. oh wow, my fault... true, the plugin hasn't loaded correctly. Thank you!
    And sorry for wasting your time.
    #4 John_H_Smith, Nov 10, 2019
    Last edited: Nov 10, 2019
  5. Just to note, HIGHEST priority is at the bottom of the hierarchy

    The order is
  6. Alright, thanks for the information!