mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
Merge branch 'pr/37' into public-server
This commit is contained in:
commit
0585b4ec9b
2 changed files with 108 additions and 79 deletions
|
|
@ -1,79 +1,100 @@
|
||||||
# Released under the MIT License. See LICENSE for details.
|
# Released under the MIT License. See LICENSE for details.
|
||||||
import ba, _ba
|
import ba, _ba
|
||||||
from serverData import serverdata
|
from serverData import serverdata
|
||||||
from features import profanity
|
from features import profanity
|
||||||
from tools import servercheck
|
from tools import servercheck
|
||||||
import time
|
import time
|
||||||
import setting
|
import setting
|
||||||
from tools import logger
|
from tools import logger
|
||||||
import _thread
|
import _thread
|
||||||
settings = setting.get_settings_data()
|
from playersData import pdata
|
||||||
|
settings = setting.get_settings_data()
|
||||||
|
|
||||||
def filter(msg,pb_id,client_id):
|
def check_permissions(accountid):
|
||||||
new_msg=profanity.censor(msg)
|
roles = pdata.get_roles()
|
||||||
if new_msg!=msg:
|
for role in roles:
|
||||||
addWarn(pb_id,client_id)
|
if accountid in roles[role]["ids"] and ( role == "bypass-warn" or role=="owner") :
|
||||||
|
return True
|
||||||
now = time.time()
|
return False
|
||||||
if pb_id not in serverdata.clients:
|
|
||||||
return None
|
|
||||||
|
def filter(msg,pb_id,client_id):
|
||||||
if "lastMsgTime" in serverdata.clients[pb_id]:
|
new_msg=profanity.censor(msg)
|
||||||
count=serverdata.clients[pb_id]["cMsgCount"]
|
if new_msg!=msg:
|
||||||
smsgcount=serverdata.clients[pb_id]['cSameMsg']
|
_ba.screenmessage("Don\'t ABUSE!", color=(1,0,0), transient=True, clients=[client_id])
|
||||||
if now - serverdata.clients[pb_id]["lastMsgTime"] < 5:
|
if not check_permissions(pb_id):
|
||||||
count+=1
|
addWarn(pb_id,client_id)
|
||||||
if count >=2:
|
else:
|
||||||
addWarn(pb_id,client_id)
|
_ba.screenmessage("Special role found, Warn BYPASSED!", color=(0,1,0), transient=True, clients=[client_id])
|
||||||
count =0
|
|
||||||
elif now - serverdata.clients[pb_id]["lastMsgTime"] < 30:
|
now = time.time()
|
||||||
if serverdata.clients[pb_id]["lastMsg"]==msg:
|
|
||||||
if len(msg)>5:
|
if "lastMsgTime" in serverdata.clients[pb_id]:
|
||||||
smsgcount+=1
|
count=serverdata.clients[pb_id]["cMsgCount"]
|
||||||
if smsgcount>=3:
|
smsgcount=serverdata.clients[pb_id]['cSameMsg']
|
||||||
logger.log(pb_id+" | kicked for chat spam")
|
if now - serverdata.clients[pb_id]["lastMsgTime"] < 8:
|
||||||
_ba.disconnect_client(client_id)
|
count+=1
|
||||||
smsgcount=0
|
if count == 2: #when 3 msgs
|
||||||
addWarn(pb_id,client_id)
|
_ba.screenmessage("Sending messages too fast, cool down...", color=(1,0.40,0.50), transient=True, clients=[client_id])
|
||||||
else:
|
elif count >=3: #when 4 msgs
|
||||||
smsgcount=0
|
_ba.screenmessage("Don\'t SPAM!", color=(1,0,0), transient=True, clients=[client_id])
|
||||||
else:
|
if not check_permissions(pb_id):
|
||||||
count =0
|
addWarn(pb_id,client_id)
|
||||||
smsgcount=0
|
else:
|
||||||
|
_ba.screenmessage("Special role found, Warn BYPASSED!", color=(0,1,0), transient=True, clients=[client_id])
|
||||||
|
count =0
|
||||||
serverdata.clients[pb_id]['cMsgCount']=count
|
elif now - serverdata.clients[pb_id]["lastMsgTime"] < 20:
|
||||||
serverdata.clients[pb_id]['lastMsgTime']=now
|
# < 30
|
||||||
serverdata.clients[pb_id]['lastMsg']=msg
|
if serverdata.clients[pb_id]["lastMsg"]==msg:
|
||||||
serverdata.clients[pb_id]['cSameMsg']=smsgcount
|
if len(msg)>5:
|
||||||
else:
|
smsgcount+=1
|
||||||
serverdata.clients[pb_id]['cMsgCount']=0
|
if smsgcount>=3:
|
||||||
serverdata.clients[pb_id]['lastMsgTime']=now
|
logger.log(pb_id+" | kicked for chat spam")
|
||||||
serverdata.clients[pb_id]['lastMsg']=msg
|
_ba.disconnect_client(client_id)
|
||||||
serverdata.clients[pb_id]['cSameMsg']=0
|
smsgcount=0
|
||||||
return new_msg
|
_ba.screenmessage("Don\'t SPAM!", color=(1,0,0), transient=True, clients=[client_id])
|
||||||
|
if not check_permissions(pb_id):
|
||||||
|
addWarn(pb_id,client_id)
|
||||||
|
else:
|
||||||
def addWarn(pb_id,client_id):
|
_ba.screenmessage("Special role found, Warn BYPASSED!", color=(0,1,0), transient=True, clients=[client_id])
|
||||||
now=time.time()
|
else:
|
||||||
player=serverdata.clients[pb_id]
|
smsgcount=0
|
||||||
warn=player['warnCount']
|
else:
|
||||||
if now - player['lastWarned'] <= settings["WarnCooldownMinutes"]*60:
|
count =0
|
||||||
warn+=1
|
smsgcount=0
|
||||||
if warn > settings["maxWarnCount"]:
|
|
||||||
_ba.screenmessage(settings["afterWarnKickMsg"],color=(1,0,0),transient=True,clients=[client_id])
|
|
||||||
logger.log(pb_id+" | kicked for chat spam")
|
serverdata.clients[pb_id]['cMsgCount']=count
|
||||||
_ba.disconnect_client(client_id)
|
serverdata.clients[pb_id]['lastMsgTime']=now
|
||||||
_thread.start_new_thread(servercheck.reportSpam,(pb_id,))
|
serverdata.clients[pb_id]['lastMsg']=msg
|
||||||
|
serverdata.clients[pb_id]['cSameMsg']=smsgcount
|
||||||
else:
|
else:
|
||||||
_ba.screenmessage(settings["warnMsg"],color=(1,0,0),transient=True,clients=[client_id])
|
serverdata.clients[pb_id]['cMsgCount']=0
|
||||||
else:
|
serverdata.clients[pb_id]['lastMsgTime']=now
|
||||||
warn=0
|
serverdata.clients[pb_id]['lastMsg']=msg
|
||||||
serverdata.clients[pb_id]["warnCount"]=warn
|
serverdata.clients[pb_id]['cSameMsg']=0
|
||||||
serverdata.clients[pb_id]['lastWarned']=now
|
return new_msg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def addWarn(pb_id,client_id):
|
||||||
|
now=time.time()
|
||||||
|
player=serverdata.clients[pb_id]
|
||||||
|
warn=player['warnCount']
|
||||||
|
if now - player['lastWarned'] <= settings["WarnCooldownMinutes"]*60:
|
||||||
|
warn+=1
|
||||||
|
if warn > settings["maxWarnCount"]:
|
||||||
|
_ba.screenmessage(settings["afterWarnKickMsg"],color=(1,0,0),transient=True,clients=[client_id])
|
||||||
|
logger.log(pb_id+" | kicked for chat spam")
|
||||||
|
_ba.disconnect_client(client_id)
|
||||||
|
_thread.start_new_thread(servercheck.reportSpam,(pb_id,))
|
||||||
|
|
||||||
|
else:
|
||||||
|
_ba.screenmessage(settings["warnMsg"]+f"\n\nWarn Count = {warn}/3!!!",color=(1,0,0),transient=True,clients=[client_id])
|
||||||
|
else:
|
||||||
|
warn=0
|
||||||
|
serverdata.clients[pb_id]["warnCount"]=warn
|
||||||
|
serverdata.clients[pb_id]['lastWarned']=now
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
8
dist/ba_root/mods/playersData/roles.json
vendored
8
dist/ba_root/mods/playersData/roles.json
vendored
|
|
@ -46,5 +46,13 @@
|
||||||
],
|
],
|
||||||
"commands": [],
|
"commands": [],
|
||||||
"ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="]
|
"ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="]
|
||||||
|
},
|
||||||
|
"bypass-warn": {
|
||||||
|
"tag": "", "tagcolor": [1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"commands": [],
|
||||||
|
"ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue