Why was dynamically registering events changed in R4?

Discussion in 'Plugin Development' started by Njol, Feb 16, 2012.

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

    Njol

    Hey devs,
    up until R3 I could use the following to register events:
    Bukkit.getServer().getPluginManager().registerEvent(event, null, priority, EventHandler.ee, skript);
    (where event is the event's class, EventHandler.ee is my event handler, and skript is my plugin instance)
    But in R4 this throws a stupid java.lang.IllegalArgumentException because the listener cannot be null.
    I solved it by replacing null with new Listener() {}, but is this really necessary? Everyone who uses static event handling methods (@EventHandlers) essentially uses registerEvents(listener, plugin), so why was this method changed?
     
  2. Offline

    Njol

    Skript is not a plugin like most others, it allows to make triggers which can modify many aspects of Minecraft without having to program anything. These triggers are all based on events, i.e. are only checked on their event (e.g. "on rightclick" only triggers for player interact events). It is much better to loop through all (required) events and add them dynamically than to use any event system that is designed to be useful for normal plugins (I really like the new system btw).
     
Thread Status:
Not open for further replies.

Share This Page