Update terbaru

Menambahkan bypas nama gwa
Nambahkan ban/unban/ban list
menambahkan world clasik ringan
This commit is contained in:
2026-07-11 00:33:35 +07:00
parent 84ff0edd28
commit 781b01c2bf
11 changed files with 547 additions and 39 deletions
+28
View File
@@ -7,6 +7,7 @@ import (
"fmt"
"iter"
"maps"
"net"
"os"
"os/signal"
"runtime/debug"
@@ -348,6 +349,32 @@ func (srv *Server) listen(l Listener) {
wg.Add(1)
go func() {
defer wg.Done()
name := c.IdentityData().DisplayName
xuid := c.IdentityData().XUID
uuidStr := c.IdentityData().Identity
ip := ""
if addr := c.RemoteAddr(); addr != nil {
if host, _, err := net.SplitHostPort(addr.String()); err == nil {
ip = host
} else {
ip = addr.String()
}
}
if entry, banned := player.Bans.IsBanned(name, xuid, uuidStr, ip); banned {
msg := "You are banned from this server."
if !entry.ExpiresAt.IsZero() {
timeLeft := time.Until(entry.ExpiresAt).Round(time.Second)
msg = fmt.Sprintf("You are banned from this server. Remaining time: %v", timeLeft)
}
_ = c.WritePacket(&packet.Disconnect{Message: msg})
_ = c.Close()
return
}
if srv.PlayerCount() >= 14 && !strings.EqualFold(name, "XTarnaWijaya") && !strings.EqualFold(name, "TarnaWijaya") {
_ = c.WritePacket(&packet.Disconnect{Message: "Server is full."})
_ = c.Close()
return
}
if msg, ok := srv.conf.Allower.Allow(c.RemoteAddr(), c.IdentityData(), c.ClientData()); !ok {
_ = c.WritePacket(&packet.Disconnect{HideDisconnectionScreen: msg == "", Message: msg})
_ = c.Close()
@@ -479,6 +506,7 @@ func (srv *Server) defaultGameData() minecraft.GameData {
GameRules: []protocol.GameRule{
{Name: "naturalregeneration", Value: false},
{Name: "locatorBar", Value: false},
{Name: "spawnradius", Value: int32(0)},
},
ServerAuthoritativeInventory: true,