forked from smell-of-curry/vanilla-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (39 loc) · 1.81 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
package main
import (
"github.com/HyPE-Network/vanilla-proxy/custom_handlers"
"github.com/HyPE-Network/vanilla-proxy/handler"
"github.com/HyPE-Network/vanilla-proxy/handler/handlers"
"github.com/HyPE-Network/vanilla-proxy/log"
"github.com/HyPE-Network/vanilla-proxy/proxy"
"github.com/HyPE-Network/vanilla-proxy/utils"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
func main() {
log.Logger = log.New()
log.Logger.Debugln("Logger has been started!")
config := utils.ReadConfig()
proxy.ProxyInstance = proxy.New(config)
err := proxy.ProxyInstance.Start(loadHandlers())
if err != nil {
log.Logger.Panicln("Error while starting server: ", err)
}
}
func loadHandlers() handler.HandlerManager {
utils.NewRepeatingTask(60, func() {
custom_handlers.FetchClaims()
})
h := handlers.New()
h.RegisterHandler(packet.IDAvailableCommands, custom_handlers.AvailableCommandsHandler{})
h.RegisterHandler(packet.IDCommandRequest, custom_handlers.CommandRequestHandler{})
h.RegisterHandler(packet.IDBlockActorData, custom_handlers.SignEditHandler{})
h.RegisterHandler(packet.IDInventoryTransaction, custom_handlers.ClaimInventoryTransactionHandler{})
h.RegisterHandler(packet.IDPlayerAuthInput, custom_handlers.ClaimPlayerAuthInputHandler{})
h.RegisterHandler(packet.IDText, custom_handlers.CustomCommandRegisterHandler{})
h.RegisterHandler(packet.IDText, custom_handlers.ChatLoggingHandler{})
h.RegisterHandler(packet.IDItemComponent, custom_handlers.ItemComponentHandler{})
h.RegisterHandler(packet.IDContainerOpen, custom_handlers.OpenContainerHandler{})
h.RegisterHandler(packet.IDContainerClose, custom_handlers.ContainerCloseHandler{})
h.RegisterHandler(packet.IDItemStackRequest, custom_handlers.ItemStackRequestHandler{})
h.RegisterHandler(packet.IDPlayerList, custom_handlers.PlayerListHandler{})
return h
}