Improve event emitter/subscription abilities
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package server
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/mitchellh/colorstring"
|
||||
"io"
|
||||
)
|
||||
|
||||
type Console struct {
|
||||
Server *Server
|
||||
Server *Server
|
||||
HandlerFunc *func(string)
|
||||
}
|
||||
|
||||
@@ -18,4 +22,13 @@ func (c Console) Write(b []byte) (int, error) {
|
||||
}
|
||||
|
||||
return len(b), nil
|
||||
}
|
||||
}
|
||||
|
||||
// Sends output to the server console formatted to appear correctly as being sent
|
||||
// from Wings.
|
||||
func (s *Server) PublishConsoleOutputFromDaemon(data string) {
|
||||
s.Events().Publish(
|
||||
ConsoleOutputEvent,
|
||||
colorstring.Color(fmt.Sprintf("[yellow][bold][Pterodactyl Daemon]:[default] %s", data)),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user