mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-11-07 17:36:15 +00:00
logging fix , playlist fallback
This commit is contained in:
parent
436ee54ba2
commit
0dfe2de8e5
6 changed files with 109 additions and 110 deletions
11
dist/ba_data/python/ba/_multiteamsession.py
vendored
11
dist/ba_data/python/ba/_multiteamsession.py
vendored
|
|
@ -105,9 +105,16 @@ class MultiTeamSession(Session):
|
|||
add_resolved_type=True,
|
||||
name='default teams' if self.use_teams else 'default ffa',
|
||||
)
|
||||
|
||||
default_playlist_resolved = _playlist.filter_playlist(
|
||||
_playlist.get_default_teams_playlist(),
|
||||
sessiontype=type(self),
|
||||
add_resolved_type=True,
|
||||
name='default teams' if self.use_teams else 'default ffa',
|
||||
)
|
||||
if not playlist_resolved:
|
||||
raise RuntimeError('Playlist contains no valid games.')
|
||||
print("PLAYLIST CONTAINS NO VALID GAMES , FALLING BACK TO DEFAULT TEAM PLAYLIST")
|
||||
playlist_resolved = default_playlist_resolved
|
||||
# raise RuntimeError('Playlist contains no valid games.')
|
||||
|
||||
self._playlist = ShuffleList(
|
||||
playlist_resolved, shuffle=self._playlist_randomize
|
||||
|
|
|
|||
|
|
@ -6,14 +6,10 @@ import ba.internal
|
|||
|
||||
def send(msg, clientid):
|
||||
"""Shortcut To Send Private Msg To Client"""
|
||||
|
||||
ba.internal.chatmessage(str(msg), clients=[clientid])
|
||||
for m in msg.split("\n"):
|
||||
ba.internal.chatmessage(str(m), clients=[clientid])
|
||||
_ba.screenmessage(str(msg), transient=True, clients=[clientid])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def clientid_to_myself(clientid):
|
||||
"""Return Player Index Of Self Player"""
|
||||
|
||||
|
|
@ -21,20 +17,11 @@ def clientid_to_myself(clientid):
|
|||
if player.sessionplayer.inputdevice.client_id == clientid:
|
||||
return i
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def handlemsg(client, msg):
|
||||
"""Handles Spaz Msg For Single Player"""
|
||||
|
||||
activity = _ba.get_foreground_host_activity()
|
||||
activity.players[client].actor.node.handlemessage(msg)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def handlemsg_all(msg):
|
||||
"""Handle Spaz message for all players in activity"""
|
||||
|
||||
|
|
|
|||
4
dist/ba_root/mods/chatHandle/handlechat.py
vendored
4
dist/ba_root/mods/chatHandle/handlechat.py
vendored
|
|
@ -18,6 +18,7 @@ def filter_chat_message(msg, client_id):
|
|||
if msg.startswith("/"):
|
||||
Main.Command(msg, client_id)
|
||||
return None
|
||||
logger.log("Host msg: |" + msg , "chat")
|
||||
return msg
|
||||
acid = ""
|
||||
displaystring = ""
|
||||
|
|
@ -35,6 +36,7 @@ def filter_chat_message(msg, client_id):
|
|||
msg = ChatFilter.filter(msg, acid, client_id)
|
||||
if msg == None:
|
||||
return
|
||||
logger.log(acid + " | " + displaystring + " | " + currentname + " | " + msg, "chat")
|
||||
if msg.startswith("/"):
|
||||
return Main.Command(msg, client_id)
|
||||
|
||||
|
|
@ -46,8 +48,6 @@ def filter_chat_message(msg, client_id):
|
|||
if msg == "end" and settings["allowEndVote"]:
|
||||
EndVote.vote_end(acid, client_id)
|
||||
|
||||
logger.log(acid + " | " + displaystring + "|" + currentname + "| " + msg, "chat")
|
||||
|
||||
if acid in serverdata.clients and serverdata.clients[acid]["verified"]:
|
||||
|
||||
if serverdata.muted:
|
||||
|
|
|
|||
11
dist/ba_root/mods/features/discord_bot.py
vendored
11
dist/ba_root/mods/features/discord_bot.py
vendored
|
|
@ -12,7 +12,10 @@ import os
|
|||
import _thread
|
||||
import logging
|
||||
logging.getLogger('asyncio').setLevel(logging.WARNING)
|
||||
client = Bot(command_prefix='!')
|
||||
intents = discord.Intents().all()
|
||||
|
||||
client = Bot(command_prefix='!', intents=intents)
|
||||
|
||||
|
||||
# client = discord.Client()
|
||||
|
||||
|
|
@ -32,8 +35,6 @@ def push_log(msg):
|
|||
|
||||
def init():
|
||||
|
||||
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.create_task(client.start(token))
|
||||
|
||||
|
|
@ -84,7 +85,7 @@ async def refresh_stats():
|
|||
|
||||
await livestatsmsgs[0].edit(content=get_live_players_msg())
|
||||
await livestatsmsgs[1].edit(content=get_chats())
|
||||
await asyncio.sleep(5)
|
||||
await asyncio.sleep(10)
|
||||
|
||||
async def send_logs():
|
||||
global logs
|
||||
|
|
@ -101,7 +102,7 @@ async def send_logs():
|
|||
if msg:
|
||||
await channel.send(msg)
|
||||
|
||||
await asyncio.sleep(5)
|
||||
await asyncio.sleep(10)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
10
dist/ba_root/mods/tools/servercheck.py
vendored
10
dist/ba_root/mods/tools/servercheck.py
vendored
|
|
@ -1,8 +1,6 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
|
||||
|
||||
# NOT COMPLETED YET
|
||||
|
||||
from serverData import serverdata
|
||||
from playersData import pdata
|
||||
import _ba
|
||||
|
|
@ -123,6 +121,10 @@ def on_player_join_server(pbid, player_data):
|
|||
color=(1, 0, 0), transient=True,
|
||||
clients=[ros['client_id']])
|
||||
logger.log(pbid + " | kicked > reason:Banned account")
|
||||
_ba.screenmessage(
|
||||
"Contact server owner, your account not allowed here",
|
||||
color=(1, 0, 0), transient=True,
|
||||
clients=[ros['client_id']])
|
||||
ba.internal.disconnect_client(ros['client_id'])
|
||||
|
||||
return
|
||||
|
|
@ -152,7 +154,7 @@ def on_player_join_server(pbid, player_data):
|
|||
if(device_id==None):
|
||||
device_id = _ba.get_client_device_uuid(cid)
|
||||
serverdata.clients[pbid]["deviceUUID"] = device_id
|
||||
logger.log("ip:"+serverdata.clients[pbid]["lastIP"]+",Device id"+device_id)
|
||||
logger.log(pbid+" ip: "+serverdata.clients[pbid]["lastIP"]+", Device id: "+device_id)
|
||||
_ba.screenmessage(settings["regularWelcomeMsg"] + " " + d_st,
|
||||
color=(0.60, 0.8, 0.6), transient=True,
|
||||
clients=[cid])
|
||||
|
|
@ -187,6 +189,7 @@ def check_ban(clid,pbid):
|
|||
device_id = _ba.get_client_device_uuid(clid)
|
||||
if (ip in blacklist["ban"]['ips'] or device_id in blacklist['ban']['deviceids'] or pbid in blacklist["ban"]["ids"]):
|
||||
_ba.chatmessage('sad ,your account is flagged contact server owner for unban',clients=[clid])
|
||||
logger.log(pbid + " | kicked > reason: Banned account")
|
||||
ba.internal.disconnect_client(clid)
|
||||
return True
|
||||
return False
|
||||
|
|
@ -348,6 +351,7 @@ def reportSpam(id):
|
|||
if now - profiles[id]["lastSpam"] < 2 * 24 * 60 * 60:
|
||||
count += 1
|
||||
if count > 3:
|
||||
logger.log(id+" auto banned for spamming")
|
||||
profiles[id]["isBan"] = True
|
||||
else:
|
||||
count = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue