From 2676c4ef99f4905224576c6c1a2d1d217f4c26d1 Mon Sep 17 00:00:00 2001 From: pranav-1711 Date: Mon, 14 Feb 2022 16:05:07 +0530 Subject: [PATCH] More feature folder updates. --- .../fireflies.py => features/fire_flies.py} | 0 .../mods/{ => plugins}/bombsquadhttpapi.py | 0 dist/ba_root/mods/privateserver.backup | 168 ------------------ 3 files changed, 168 deletions(-) rename dist/ba_root/mods/{tools/fireflies.py => features/fire_flies.py} (100%) rename dist/ba_root/mods/{ => plugins}/bombsquadhttpapi.py (100%) delete mode 100644 dist/ba_root/mods/privateserver.backup diff --git a/dist/ba_root/mods/tools/fireflies.py b/dist/ba_root/mods/features/fire_flies.py similarity index 100% rename from dist/ba_root/mods/tools/fireflies.py rename to dist/ba_root/mods/features/fire_flies.py diff --git a/dist/ba_root/mods/bombsquadhttpapi.py b/dist/ba_root/mods/plugins/bombsquadhttpapi.py similarity index 100% rename from dist/ba_root/mods/bombsquadhttpapi.py rename to dist/ba_root/mods/plugins/bombsquadhttpapi.py diff --git a/dist/ba_root/mods/privateserver.backup b/dist/ba_root/mods/privateserver.backup deleted file mode 100644 index a629ded..0000000 --- a/dist/ba_root/mods/privateserver.backup +++ /dev/null @@ -1,168 +0,0 @@ -""" -Private Server whitelist by Mr.Smoothy - -* don't dare to remove credits or I will bite you - -GitHub : https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server -""" - -# ba_meta require api 6 -from __future__ import annotations -from typing import TYPE_CHECKING -from ba._enums import TimeType - -import ba, json, _ba, time, datetime - -if TYPE_CHECKING: - pass - - -whitelist_on = True -""" Change It By Chat Commands For By Editing Here """ - - -spectators = False -""" False Means Spectating Not Allowed """ - - -whitelist = {} -""" Dont change """ - - -lobbychecktime = 3 -""" -Time in seconds, to check lobby players ... increase time ,for more time unwanted players can watch match -Decrease time , kick them fast , but can also give some lagg to the server , adjust yourself acrd. to cpu power """ - - -admins = ['pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE'] -"""Dirty admin system , for now , until we get good working chat commands """ - - -def inWhiteList(id): - global whitelist - if id in whitelist: - return True - else: - return False -def addToWhitelist(id,displaystr): - global whitelist - if id not in whitelist: - whitelist[id]=[displaystr] - else: - whitelist[id].append(displaystr) - f=open("whitelist.json","w") - json.dump(whitelist,f,indent=4) - f.close() - -def handlechat(msg,clientid): - gg=_ba.get_game_roster() - acc_id="LOL" - if msg.startswith("/"): - for clt in gg: - if clt['client_id'] ==clientid: - acc_id=clt['account_id'] - global admins - if acc_id in admins: - commands(acc_id ,msg) -def handlerequest(player): - if whitelist_on: - if inWhiteList(player.get_account_id()): - pass - else: - for clt in _ba.get_game_roster(): - if clt['account_id']==player.get_account_id(): - - f=open("loggs.txt",'a+') - f.write("kicked for joining"+clt['account_id']+"\n") - f.close() - _ba.disconnect_client(clt['client_id']) - - - - -def commands(acc_id,msg): - global whitelist - global whitelist_on - global spectators - cmnd=msg.split(" ")[0] - - args=msg.split(" ")[1:] - if cmnd=='/add' and args!=[]: - - gg=_ba.get_game_roster() - for clt in gg: - if clt['client_id']==int(args[0]): - - addToWhitelist(clt['account_id'],clt['display_string']) - f=open("loggs.txt",'a+') - f.write(acc_id+" added "+clt['account_id']+"\n") - f.close() - _ba.chatmessage(clt['display_string']+" whitelisted") - if cmnd=='/whitelist': - whitelist_on=whitelist_on==False - if whitelist_on: - _ba.chatmessage("WhiteList turned on") - else: - _ba.chatmessage("whitelist turned off") - if cmnd=='/spectators': - spectators=spectators==False - if spectators: - _ba.chatmessage("Spectators can watch now") - else: - _ba.chatmessage("Spectators will be kicked") - - - -def dstrinWhiteList(dstr): - global whitelist - return any(dstr in chici for chici in whitelist.values()) - - -# ba_meta export plugin -class private(ba.Plugin): - """My first ballistica plugin!""" - - def __init__(self): - global whitelist - global whitelist_on - global spectators - global lobbychecktime - - try: - f=open("whitelist.json") - dat=json.loads(f.read()) - whitelist=dat - f.close() - except: - print("no whitelist detected , creating one") - self.li={} - self.li['pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE']=['smoothyki-id','mr.smoothy'] - f=open("whitelist.json",'w') - json.dump(self.li,f,indent=4) - f.close() - if whitelist_on and not spectators: - self.timerr=ba.Timer(lobbychecktime,self.checklobby,repeat=True,timetype=TimeType.REAL) - def checklobby(self): - global whitelist_on - global whitelist - global spectators - if whitelist_on and not spectators: - try: - gg=_ba.get_game_roster() - for clt in gg: - if clt['account_id'] in whitelist and clt['account_id']!='' or clt['client_id']==-1: - pass - else: - f=open("loggs.txt","a+") - f.write("Kicked from lobby"+clt['account_id']+" "+clt['spec_string']+"\n") - _ba.disconnect_client(clt['client_id']) - except: - pass - - - - - - -