Skip to content

Commit

Permalink
Update minecraft-vanilla-server-hibernation.go
Browse files Browse the repository at this point in the history
  • Loading branch information
gekigek99 authored Aug 14, 2020
1 parent e640b77 commit aff2a18
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions go-version/minecraft-vanilla-server-hibernation.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (

//------------------------modify-------------------------------//

const EQUALorOVER_1_16_2 = true // is the minecraft server >= 1.16.2?

const startminecraftserver = "systemctl start minecraft-server"
const stopminecraftserver = "systemctl stop minecraft-server"

Expand Down Expand Up @@ -276,13 +274,8 @@ func Timer(timeleft int, f func()) {

//BuildMessage takes a string and returns a []byte
func BuildMessage(message string) []byte {
if (EQUALorOVER_1_16_2) {
message = "{\"text\":\"" + message + "\"}"
encodedMessage := append([]byte{byte(len(message) + 2), byte(0), byte(len(message))}, []byte(message)...)
} else {
message = "{\"text\":\"" + PaddString(message, "\x0a", 88) + "\"}"
encodedMessage = append([]byte{byte(65), byte(0), byte(63)}, []byte(message)...)
}
message = "{\"text\":\"" + message + "\"}"
encodedMessage := append([]byte{byte(len(message) + 2), byte(0), byte(len(message))}, []byte(message)...)
return encodedMessage
}

Expand Down

0 comments on commit aff2a18

Please sign in to comment.