-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
55 lines (46 loc) · 1.6 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"github.com/bradhe/stopwatch"
"github.com/df-mc/dragonfly/server/player"
"github.com/df-mc/dragonfly/server/player/chat"
"github.com/provsalt/PM-DF/src/commands"
config2 "github.com/provsalt/PM-DF/src/config"
"github.com/provsalt/PM-DF/src/console"
"github.com/sandertv/gophertunnel/minecraft/text"
"github.com/sirupsen/logrus"
formatter "github.com/t-tomalak/logrus-easy-formatter"
"os"
)
func main() {
watch := stopwatch.Start()
log := &logrus.Logger{
Out: os.Stderr,
Level: logrus.DebugLevel,
Formatter: &formatter.Formatter{
TimestampFormat: "15:04:05",
LogFormat: "[%time%] [Server/%lvl%]: %msg% \n",
},
}
log.Level = logrus.DebugLevel
chat.Global.Subscribe(chat.StdoutSubscriber{})
config, err := config2.ReadConfig(log)
if err != nil {
log.Fatalln(err)
}
srv := config.New()
srv.CloseOnProgramEnd()
srv.Listen()
if !config.AuthDisabled {
log.Info("Online mode is enabled. The server will verify that players are authenticated to Xbox Live.")
} else {
log.Warn(text.ANSI(text.Colourf("<yellow>Online mode is disabled. The server will not verify that players are authenticated to Xbox Live.</yellow>")))
}
watch.Stop()
log.Infof("Done (%v): For help, type \"help\" or \"?\" \n", watch.Milliseconds())
console.StartConsole()
commands.Register()
for srv.Accept(func(p *player.Player) {
log.Infof(text.ANSI(text.Colourf("<aqua>%s</aqua> [/%s] logged in with entity %d at (%s, %d, %d, %d)", p.Name(), p.Addr().String(), len(srv.World().Entities()), p.World().Name(), int(p.Position().X()), int(p.Position().Y()), int(p.Position().Z()))))
}) {
}
}