/// <summary> /// Register this event /// </summary> /// <param name="method">This is the delegate that will get called when this event occurs</param> /// <param name="priority">The priority (imporantce) of this call</param> /// <param name="plugin">The plugin object that is registering the event</param> /// <param name="bypass">Register more than one of the same event</param> public static void Register(Level.OnLevelLoaded method, Priority priority, Plugin plugin, bool bypass = false) { if (Find(plugin) != null) { if (!bypass) { throw new Exception("The user tried to register 2 of the same event!"); } } events.Add(new OnLevelLoadedEvent(method, priority, plugin)); Organize(); }
private void RegEvents() { _logHandler += LogChatDesktop; _onPlayerConnect += PlayerConnect; _onPlayerDisconnect += PlayerDisconnect; _levelUnloaded += LevelUnloadDesktop; _levelLoaded += LevelLoadDesktop; Server.s.OnLog += _logHandler; Player.PlayerConnect += _onPlayerConnect; Player.PlayerDisconnect += _onPlayerDisconnect; Level.LevelLoaded += _levelLoaded; Level.LevelUnload += _levelUnloaded; #if Debug Server.s.Log("Registered Events"); #endif }
public override void LoadEvents() { _logHandler += OnLog; _onPlayerConnect += PlayerConnect; _onPlayerDisconnect += PlayerDisconnect; _levelUnloaded += LevelUnload; _levelLoaded += LevelLoad; Server.s.OnLog += _logHandler; Player.PlayerConnect += _onPlayerConnect; Player.PlayerDisconnect += _onPlayerDisconnect; Level.LevelLoaded += _levelLoaded; Level.LevelUnload += _levelUnloaded; #if Debug Server.s.Log("Registered Events"); #endif }
internal OnLevelLoadedEvent(Level.OnLevelLoaded method, Priority priority, Plugin plugin) { this.plugin = plugin; this.priority = priority; this.method = method; }