Skip to content

Commit

Permalink
feature: server related events
Browse files Browse the repository at this point in the history
  • Loading branch information
NecrossIT committed Jun 10, 2023
1 parent e8b4ed2 commit 231a598
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pluginLoader.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package Hosting_System_Plugin_Library

import "github.com/Cerberus-Labs-Technologies/Hosting-System-Plugin-Library/events"

func (plugin *HostingPlugin) RegisterListener(listener HostingListener) error {
plugin.Listeners = append(plugin.Listeners, listener)
return nil
Expand All @@ -16,6 +18,15 @@ func (plugin *HostingPlugin) RegisterListeners(listeners []HostingListener) erro
}

func (plugin *HostingPlugin) GetListenerByName(name string) HostingListener {
for _, listener := range plugin.Listeners {
if string(listener.Name) == name {
return listener
}
}
return HostingListener{}
}

func (plugin *HostingPlugin) GetListenerByServerEventName(name events.ServerEvent) HostingListener {
for _, listener := range plugin.Listeners {
if listener.Name == name {
return listener
Expand Down

0 comments on commit 231a598

Please sign in to comment.