aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-12-07 14:37:09 +0100
committerHimbeer <himbeer@disroot.org>2024-12-07 14:37:09 +0100
commit143f14722b6c23cebd9a625e517d5988e8330baa (patch)
treebe295d6400604f9a69e781e965dd8cf59e015dd2
parent56cc91a565dabe8eeedf75c7b381eaeb902e7061 (diff)
Allow plugins to determine whether a player is new
-rw-r--r--client_conn.go4
-rw-r--r--process.go1
2 files changed, 5 insertions, 0 deletions
diff --git a/client_conn.go b/client_conn.go
index 2f5ba04..8c29b90 100644
--- a/client_conn.go
+++ b/client_conn.go
@@ -39,6 +39,7 @@ type ClientConn struct {
method mt.AuthMethods
salt, srpA, srpB, srpM, srpK []byte
}
+ new bool
fallbackFrom string
whyKicked *mt.ToCltKick
@@ -73,6 +74,9 @@ type ClientConn struct {
// Name returns the player name of the ClientConn.
func (cc *ClientConn) Name() string { return cc.name }
+// IsNew reports whether a new account was registered for the ClientConn.
+func (cc *ClientConn) IsNew() bool { return cc.new }
+
func (cc *ClientConn) hasPlayerCAO() bool { return cc.playerCAO != 0 }
func (cc *ClientConn) server() *ServerConn {
diff --git a/process.go b/process.go
index 88c999f..a355d50 100644
--- a/process.go
+++ b/process.go
@@ -213,6 +213,7 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
SendInterval: Conf().SendInterval,
SudoAuthMethods: mt.SRP,
})
+ cc.new = true
} else {
if cc.state() < csSudo {
cc.Log("->", "unauthorized sudo action")