Skip to content

Commit 99fccc2

Browse files
WillowSauceRWillowSauceR
authored andcommitted
ignore server that online less than display_online
1 parent e35a748 commit 99fccc2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scan.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ def recv_packets(udp_skt, pbar):
8787
infos, addr = parse_raw_pkt(udp_skt.recvfrom(1024))
8888
if not infos or not infos["motd"]: # 过滤掉没有motd的和没有信息的
8989
continue
90+
if int(infos['online']) >= display_online:
91+
continue
9092

9193
server_count += 1
9294

@@ -98,10 +100,9 @@ def recv_packets(udp_skt, pbar):
98100
f"[Online ] {infos['online']}/{infos['max_player']}",
99101
f"[Count ] {server_count}",
100102
""]
101-
if int(infos['online']) >= display_online:
102-
pbar.write("\n".join(values))
103-
if exec_cmd:
104-
threading.Thread(target=exec_cmd_async, args=(exec_cmd, infos), daemon=True).start()
103+
pbar.write("\n".join(values))
104+
if exec_cmd:
105+
threading.Thread(target=exec_cmd_async, args=(exec_cmd, infos), daemon=True).start()
105106
except socket.timeout:
106107
continue
107108
except ConnectionResetError:

0 commit comments

Comments
 (0)