prevent uninvited users from changing the music
This commit is contained in:
parent
a96eccfdec
commit
e19ca42a9d
@ -34,6 +34,12 @@ void AOClient::cmdPlay(int argc, QStringList argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AreaData *l_area = server->getAreaById(areaId());
|
AreaData *l_area = server->getAreaById(areaId());
|
||||||
|
if (l_area->lockStatus() == AreaData::LockStatus::SPECTATABLE && !l_area->invited().contains(clientId()) && !checkPermission(ACLRole::BYPASS_LOCKS)){
|
||||||
|
// Non-invited players cannot play music in spectatable areas
|
||||||
|
sendServerMessage("You are not invited.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const ACLRole l_role = server->getACLRolesHandler()->getRoleById(m_acl_role_id);
|
const ACLRole l_role = server->getACLRolesHandler()->getRoleById(m_acl_role_id);
|
||||||
if (!l_area->owners().contains(clientId()) && !l_area->isPlayEnabled() && !l_role.checkPermission(ACLRole::CM)) { // Make sure we have permission to play music
|
if (!l_area->owners().contains(clientId()) && !l_area->isPlayEnabled() && !l_role.checkPermission(ACLRole::CM)) { // Make sure we have permission to play music
|
||||||
sendServerMessage("Free music play is disabled in this area.");
|
sendServerMessage("Free music play is disabled in this area.");
|
||||||
@ -58,7 +64,14 @@ void AOClient::cmdPlayAmbience(int argc, QStringList argv)
|
|||||||
sendServerMessage("You are blocked from changing the ambience.");
|
sendServerMessage("You are blocked from changing the ambience.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AreaData *l_area = server->getAreaById(areaId());
|
AreaData *l_area = server->getAreaById(areaId());
|
||||||
|
|
||||||
|
if (l_area->lockStatus() == AreaData::LockStatus::SPECTATABLE && !l_area->invited().contains(clientId()) && !checkPermission(ACLRole::BYPASS_LOCKS)){
|
||||||
|
// Non-invited players cannot play music in spectatable areas
|
||||||
|
sendServerMessage("You are not invited.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!l_area->owners().contains(clientId()) && !l_area->isPlayEnabled()) { // Make sure we have permission to play music
|
if (!l_area->owners().contains(clientId()) && !l_area->isPlayEnabled()) { // Make sure we have permission to play music
|
||||||
sendServerMessage("Free ambience play is disabled in this area.");
|
sendServerMessage("Free ambience play is disabled in this area.");
|
||||||
return;
|
return;
|
||||||
|
@ -32,8 +32,8 @@ void PacketMC::handlePacket(AreaData *area, AOClient &client) const
|
|||||||
if (client.getServer()->getMusicList().contains(l_argument) || client.m_music_manager->isCustom(client.areaId(), l_argument) || l_argument == "~stop.mp3") { // ~stop.mp3 is a dummy track used by 2.9+
|
if (client.getServer()->getMusicList().contains(l_argument) || client.m_music_manager->isCustom(client.areaId(), l_argument) || l_argument == "~stop.mp3") { // ~stop.mp3 is a dummy track used by 2.9+
|
||||||
// We have a song here
|
// We have a song here
|
||||||
|
|
||||||
if (client.m_is_spectator) {
|
if (client.m_is_spectator || area->lockStatus() == AreaData::LockStatus::SPECTATABLE && !area->invited().contains(client.clientId()) && !client.checkPermission(ACLRole::BYPASS_LOCKS)) {
|
||||||
client.sendServerMessage("Spectator are blocked from changing the music.");
|
client.sendServerMessage("Spectators are blocked from changing the music.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user