2019-04-21 00:38:12 +00:00
|
|
|
package server
|
|
|
|
|
2019-12-01 01:08:11 +00:00
|
|
|
import (
|
2020-08-11 04:38:42 +00:00
|
|
|
"github.com/pterodactyl/wings/events"
|
2019-12-01 01:08:11 +00:00
|
|
|
)
|
|
|
|
|
2019-04-21 00:38:12 +00:00
|
|
|
// Defines all of the possible output events for a server.
|
2019-05-28 01:03:37 +00:00
|
|
|
// noinspection GoNameStartsWithPackageName
|
2019-04-21 00:38:12 +00:00
|
|
|
const (
|
2020-07-30 04:39:27 +00:00
|
|
|
DaemonMessageEvent = "daemon message"
|
|
|
|
InstallOutputEvent = "install output"
|
|
|
|
InstallStartedEvent = "install started"
|
|
|
|
InstallCompletedEvent = "install completed"
|
|
|
|
ConsoleOutputEvent = "console output"
|
|
|
|
StatusEvent = "status"
|
|
|
|
StatsEvent = "stats"
|
|
|
|
BackupCompletedEvent = "backup completed"
|
2020-12-25 21:32:41 +00:00
|
|
|
TransferLogsEvent = "transfer logs"
|
|
|
|
TransferStatusEvent = "transfer status"
|
2019-04-21 00:38:12 +00:00
|
|
|
)
|
|
|
|
|
2020-01-18 22:04:26 +00:00
|
|
|
// Returns the server's emitter instance.
|
2020-08-11 04:38:42 +00:00
|
|
|
func (s *Server) Events() *events.EventBus {
|
2020-07-30 04:56:22 +00:00
|
|
|
s.emitterLock.Lock()
|
|
|
|
defer s.emitterLock.Unlock()
|
|
|
|
|
2020-01-18 22:04:26 +00:00
|
|
|
if s.emitter == nil {
|
2020-08-11 04:38:42 +00:00
|
|
|
s.emitter = events.New()
|
2019-04-21 00:38:12 +00:00
|
|
|
}
|
2020-01-18 22:04:26 +00:00
|
|
|
|
|
|
|
return s.emitter
|
2019-04-21 00:38:12 +00:00
|
|
|
}
|