mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Added /notify and /players admin commands
Co-authored-by: dongresource <dongresource@protonmail.com>
This commit is contained in:
parent
a1145aced4
commit
83c378c9c2
@ -436,6 +436,24 @@ void tasksCommand(std::string full, std::vector<std::string>& args, CNSocket* so
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void notifyCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
||||||
|
Player *plr = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
|
if (plr->notify) {
|
||||||
|
plr->notify = false;
|
||||||
|
ChatManager::sendServerMessage(sock, "[ADMIN] No longer receiving join notifications");
|
||||||
|
} else {
|
||||||
|
plr->notify = true;
|
||||||
|
ChatManager::sendServerMessage(sock, "[ADMIN] Receiving join notifications");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void playersCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
||||||
|
ChatManager::sendServerMessage(sock, "[ADMIN] Players on the server:");
|
||||||
|
for (auto pair : PlayerManager::players)
|
||||||
|
ChatManager::sendServerMessage(sock, PlayerManager::getPlayerName(pair.second.plr));
|
||||||
|
}
|
||||||
|
|
||||||
void flushCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
void flushCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
||||||
TableData::flush();
|
TableData::flush();
|
||||||
ChatManager::sendServerMessage(sock, "Wrote gruntwork to " + settings::GRUNTWORKJSON);
|
ChatManager::sendServerMessage(sock, "Wrote gruntwork to " + settings::GRUNTWORKJSON);
|
||||||
@ -461,6 +479,8 @@ void ChatManager::init() {
|
|||||||
registerCommand("refresh", 100, refreshCommand, "teleport yourself to your current location");
|
registerCommand("refresh", 100, refreshCommand, "teleport yourself to your current location");
|
||||||
registerCommand("minfo", 30, minfoCommand, "show details of the current mission and task.");
|
registerCommand("minfo", 30, minfoCommand, "show details of the current mission and task.");
|
||||||
registerCommand("tasks", 30, tasksCommand, "list all active missions and their respective task ids.");
|
registerCommand("tasks", 30, tasksCommand, "list all active missions and their respective task ids.");
|
||||||
|
registerCommand("notify", 30, notifyCommand, "receive a message whenever a player joins the server");
|
||||||
|
registerCommand("players", 30, playersCommand, "print all players on the server");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatManager::registerCommand(std::string cmd, int requiredLevel, CommandHandler handlr, std::string help) {
|
void ChatManager::registerCommand(std::string cmd, int requiredLevel, CommandHandler handlr, std::string help) {
|
||||||
|
@ -68,4 +68,6 @@ struct Player {
|
|||||||
int groupCnt;
|
int groupCnt;
|
||||||
int32_t groupIDs[4];
|
int32_t groupIDs[4];
|
||||||
int32_t iGroupConditionBitFlag;
|
int32_t iGroupConditionBitFlag;
|
||||||
|
|
||||||
|
bool notify;
|
||||||
};
|
};
|
||||||
|
@ -402,6 +402,10 @@ void PlayerManager::enterPlayer(CNSocket* sock, CNPacketData* data) {
|
|||||||
ItemManager::setItemStats(getPlayer(sock));
|
ItemManager::setItemStats(getPlayer(sock));
|
||||||
|
|
||||||
MissionManager::failInstancedMissions(sock);
|
MissionManager::failInstancedMissions(sock);
|
||||||
|
|
||||||
|
for (auto& pair : PlayerManager::players)
|
||||||
|
if (pair.second.plr->notify)
|
||||||
|
ChatManager::sendServerMessage(pair.first, "[ADMIN]" + getPlayerName(&plr) + " has joined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerManager::sendToViewable(CNSocket* sock, void* buf, uint32_t type, size_t size) {
|
void PlayerManager::sendToViewable(CNSocket* sock, void* buf, uint32_t type, size_t size) {
|
||||||
|
Loading…
Reference in New Issue
Block a user