Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing connection error message #274

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ Hibernation and Starting server description
"InfoStarting": " §fserver status:\n §6§lWARMING UP"
```

Connection error message contents when client tries to join but the server is starting
```yaml
"MsgStarting": "Server start command issued. Please wait..."
```

Set to false if you don't want notifications (every 20 minutes)
```yaml
"NotifyUpdate": true
Expand Down
1 change: 1 addition & 0 deletions lib/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func (c *Configuration) loadRuntime(confdef *Configuration) *errco.MshLog {
flag.IntVar(&c.Msh.SuspendRefresh, "suspendrefresh", c.Msh.SuspendRefresh, "Specify how often the suspended minecraft server process must be refreshed.")
flag.StringVar(&c.Msh.InfoHibernation, "infohibe", c.Msh.InfoHibernation, "Specify hibernation info.")
flag.StringVar(&c.Msh.InfoStarting, "infostar", c.Msh.InfoStarting, "Specify starting info.")
flag.StringVar(&c.Msh.MsgStarting, "msgstar", c.Msh.MsgStarting, "Specify server starting error message.")
flag.BoolVar(&c.Msh.NotifyUpdate, "notifyupd", c.Msh.NotifyUpdate, "Enables update notifications.")
flag.BoolVar(&c.Msh.NotifyMessage, "notifymes", c.Msh.NotifyMessage, "Enables message notifications.")
// c.Msh.Whitelist (type []string, not worth to make it a flag)
Expand Down
2 changes: 1 addition & 1 deletion lib/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func HandlerClientConn(clientConn net.Conn) {
}

// msh JOIN response (answer client with text in the loadscreen)
mes := buildMessage(reqType, "Server start command issued. Please wait... "+servstats.Stats.LoadProgress)
mes := buildMessage(reqType, config.ConfigRuntime.Msh.MsgStarting)
clientConn.Write(mes)
errco.NewLogln(errco.TYPE_BYT, errco.LVL_4, errco.ERROR_NIL, "%smsh --> client%s: %v", errco.COLOR_PURPLE, errco.COLOR_RESET, mes)

Expand Down
1 change: 1 addition & 0 deletions lib/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Configuration struct {
SuspendRefresh int `json:"SuspendRefresh"` // specify if msh should refresh java server process suspension and every how many seconds
InfoHibernation string `json:"InfoHibernation"`
InfoStarting string `json:"InfoStarting"`
MsgStarting string `json:"MsgStarting"`
NotifyUpdate bool `json:"NotifyUpdate"`
NotifyMessage bool `json:"NotifyMessage"`
Whitelist []string `json:"Whitelist"`
Expand Down
1 change: 1 addition & 0 deletions msh-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"SuspendRefresh": -1,
"InfoHibernation": " §fserver status:\n §b§lHIBERNATING",
"InfoStarting": " §fserver status:\n §6§lWARMING UP",
"MsgStarting": "Server start command issued. Please wait...",
"NotifyUpdate": true,
"NotifyMessage": true,
"Whitelist": [],
Expand Down