mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[Master] Init BanAddress/UnbanAddress before opening script
This commit is contained in:
parent
dc18916f46
commit
bb183457a6
1 changed files with 3 additions and 6 deletions
|
@ -29,6 +29,9 @@ MasterServer::MasterServer(const std::string &luaScript)
|
|||
std::string package_path = state["package"]["path"];
|
||||
state["package"]["path"] = Utils::convertPath(absPath.parent_path().string() + "/?.lua") + ";" + package_path;
|
||||
|
||||
state.set_function("BanAddress", &MasterServer::ban, this);
|
||||
state.set_function("UnbanAddress", &MasterServer::unban, this);
|
||||
|
||||
state.script_file(luaScript);
|
||||
|
||||
sol::table config = state["config"];
|
||||
|
@ -44,18 +47,12 @@ MasterServer::MasterServer(const std::string &luaScript)
|
|||
if (port.get_type() != sol::type::number)
|
||||
throw runtime_error("config.port is not correct");
|
||||
|
||||
state.set_function("BanAddress", [this](const string &address) {
|
||||
this->ban(address);
|
||||
});
|
||||
state.new_usertype<MasterServer::SServer>("Server",
|
||||
"name", sol::property(&MasterServer::SServer::GetName),
|
||||
"gamemode", sol::property(&MasterServer::SServer::GetGameMode),
|
||||
"version", sol::property(&MasterServer::SServer::GetVersion)
|
||||
);
|
||||
|
||||
state.set_function("UnbanAddress", [this](const string &address) {
|
||||
this->unban(address);
|
||||
});
|
||||
|
||||
peer = RakPeerInterface::GetInstance();
|
||||
sockdescr = SocketDescriptor(port.as<unsigned short>(), nullptr);
|
||||
|
|
Loading…
Reference in a new issue