Skip to content

Commit

Permalink
Force ToLower
Browse files Browse the repository at this point in the history
  • Loading branch information
Distortions81 committed Dec 25, 2023
1 parent bf38c1d commit bc9dd84
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions banlist/banList.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ type banDataType struct {
Reason string `json:"reason,omitempty"`
}

func CheckBanList(player string) {
func CheckBanList(name string) {
pname := strings.ToLower(name)
BanListLock.Lock()
defer BanListLock.Unlock()

Expand All @@ -33,18 +34,18 @@ func CheckBanList(player string) {
}

for _, ban := range BanList {
if strings.EqualFold(ban.UserName, player) {
if strings.EqualFold(ban.UserName, pname) {
if fact.PlayerLevelGet(ban.UserName, true) < 2 {
fact.PlayerSetBanReason(ban.UserName, "[FCL] "+ban.Reason, true)
}
return
}
}

if fact.PlayerLevelGet(player, false) == -1 {
if fact.PlayerLevelGet(pname, false) == -1 {
glob.PlayerListLock.Lock()
if glob.PlayerList[player] != nil {
fact.WriteFact("/ban " + player + " " + glob.PlayerList[player].BanReason)
if glob.PlayerList[pname] != nil {
fact.WriteFact("/ban " + pname + " " + glob.PlayerList[pname].BanReason)
}
glob.PlayerListLock.Unlock()
}
Expand Down

0 comments on commit bc9dd84

Please sign in to comment.