Add Level::getCurrentLevelPath and Level::getCurrentLevelName

This commit is contained in:
Qiuzhizhe 2022-10-29 01:07:29 -07:00
parent 59f02218d8
commit f5888eb4da
2 changed files with 21 additions and 21 deletions

View File

@ -93,8 +93,8 @@ public:
LIAPI static void sendPacketForAllPlayers(Packet& pkt); LIAPI static void sendPacketForAllPlayers(Packet& pkt);
//LIAPI static std::string getCurrentLevelName(); LIAPI static std::string getCurrentLevelName();
//LIAPI static std::string getCurrentLevelPath(); LIAPI static std::string getCurrentLevelPath();
LIAPI static int64_t createBossEvent(); LIAPI static int64_t createBossEvent();
public: public:

View File

@ -365,26 +365,26 @@ void Level::sendPacketForAllPlayer(Packet& pkt) {
sendPacketForAllPlayers(pkt); sendPacketForAllPlayers(pkt);
} }
// std::string Level::getCurrentLevelName() { std::string Level::getCurrentLevelName() {
// if (Global<PropertiesSettings>) if (Global<PropertiesSettings>)
// return Global<PropertiesSettings>->getLevelName(); return Global<PropertiesSettings>->getLevelName();
// std::ifstream fin("server.properties"); std::ifstream fin("server.properties");
// string buf; string buf;
// while (getline(fin, buf)) { while (getline(fin, buf)) {
// if (buf.find("level-name=") != string::npos) { if (buf.find("level-name=") != string::npos) {
// if (buf.back() == '\n') if (buf.back() == '\n')
// buf.pop_back(); buf.pop_back();
// if (buf.back() == '\r') if (buf.back() == '\r')
// buf.pop_back(); buf.pop_back();
// return buf.substr(11); return buf.substr(11);
// } }
// } }
// return ""; return "";
// } }
// std::string Level::getCurrentLevelPath() { std::string Level::getCurrentLevelPath() {
// return "./worlds/" + getCurrentLevelName(); return "./worlds/" + getCurrentLevelName();
// } }
int64_t BossID = 7492341231332ull; int64_t BossID = 7492341231332ull;