Skip to content

Commit 212cc1e

Browse files
block spectators from using judge controls (#424)
1 parent e6058c1 commit 212cc1e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/packet/packet_hp.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ PacketInfo PacketHP::getPacketInfo() const
2121

2222
void PacketHP::handlePacket(AreaData *area, AOClient &client) const
2323
{
24+
if (client.m_is_spectator) {
25+
client.sendServerMessage("Spectators are blocked from using the judge controls.");
26+
return;
27+
}
28+
29+
if (area->lockStatus() == AreaData::LockStatus::SPECTATABLE && !area->invited().contains(client.clientId()) && !client.checkPermission(ACLRole::BYPASS_LOCKS)) {
30+
client.sendServerMessage("Spectators are blocked from using the judge controls.");
31+
return;
32+
}
33+
2434
if (client.m_is_wtce_blocked) {
2535
client.sendServerMessage("You are blocked from using the judge controls.");
2636
return;

src/packet/packet_rt.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ PacketInfo PacketRT::getPacketInfo() const
2020

2121
void PacketRT::handlePacket(AreaData *area, AOClient &client) const
2222
{
23+
if (client.m_is_spectator) {
24+
client.sendServerMessage("Spectators are blocked from using the judge controls.");
25+
return;
26+
}
27+
28+
if (area->lockStatus() == AreaData::LockStatus::SPECTATABLE && !area->invited().contains(client.clientId()) && !client.checkPermission(ACLRole::BYPASS_LOCKS)) {
29+
client.sendServerMessage("Spectators are blocked from using the judge controls.");
30+
return;
31+
}
32+
2333
if (client.m_is_wtce_blocked) {
2434
client.sendServerMessage("You are blocked from using the judge controls.");
2535
return;

0 commit comments

Comments
 (0)