|
1 | 1 | #include "api/PlayerAPI.h" |
2 | 2 |
|
3 | | - |
4 | | -#include "mc/world/scores/ScoreboardId.h" |
5 | | -#include "mc/world/scores/PlayerScoreboardId.h" |
6 | | - |
7 | | - |
8 | | - |
9 | 3 | #include "EventAPI.h" |
10 | 4 | #include "api/APIHelp.h" |
11 | 5 | #include "api/BaseAPI.h" |
|
83 | 77 | #include "mc/world/scores/Scoreboard.h" |
84 | 78 | #include "mc/world/scores/ScoreboardId.h" |
85 | 79 |
|
86 | | - |
87 | 80 | #include <algorithm> |
88 | 81 | #include <climits> |
89 | 82 | #include <list> |
@@ -1521,14 +1514,16 @@ Local<Value> PlayerClass::runcmd(const Arguments& args) { |
1521 | 1514 | CHECK_ARG_TYPE(args[0], ValueKind::kString); |
1522 | 1515 |
|
1523 | 1516 | try { |
1524 | | - Player* player = get(); |
1525 | | - if (!player) return Local<Value>(); |
1526 | | - CommandContext context = CommandContext( |
1527 | | - args[0].asString().toString(), |
1528 | | - std::make_unique<PlayerCommandOrigin>(*get()), |
1529 | | - CommandVersion::CurrentVersion() |
1530 | | - ); |
1531 | | - ll::service::getMinecraft()->getCommands().executeCommand(context, false); |
| 1517 | + // todo: fix this |
| 1518 | + |
| 1519 | + // Player* player = get(); |
| 1520 | + // if (!player) return Local<Value>(); |
| 1521 | + // CommandContext context = CommandContext( |
| 1522 | + // args[0].asString().toString(), |
| 1523 | + // std::make_unique<PlayerCommandOrigin>(*get()), |
| 1524 | + // CommandVersion::CurrentVersion() |
| 1525 | + // ); |
| 1526 | + // ll::service::getMinecraft()->getCommands().executeCommand(context, false); |
1532 | 1527 | return Boolean::newBoolean(true); |
1533 | 1528 | } |
1534 | 1529 | CATCH("Fail in runcmd!"); |
@@ -2015,15 +2010,16 @@ Local<Value> PlayerClass::crash(const Arguments&) { |
2015 | 2010 | try { |
2016 | 2011 | Player* player = get(); |
2017 | 2012 | if (!player) return Local<Value>(); |
| 2013 | + // todo: fix this |
2018 | 2014 |
|
2019 | | - RecordOperation( |
2020 | | - ENGINE_OWN_DATA()->pluginName, |
2021 | | - "Crash Player", |
2022 | | - "Execute player.crash() to crash player <" + player->getRealName() + ">" |
2023 | | - ); |
2024 | | - LevelChunkPacket pkt; |
2025 | | - pkt.mCacheEnabled = true; |
2026 | | - player->sendNetworkPacket(pkt); |
| 2015 | + // RecordOperation( |
| 2016 | + // ENGINE_OWN_DATA()->pluginName, |
| 2017 | + // "Crash Player", |
| 2018 | + // "Execute player.crash() to crash player <" + player->getRealName() + ">" |
| 2019 | + // ); |
| 2020 | + // LevelChunkPacket pkt; |
| 2021 | + // pkt.mCacheEnabled = true; |
| 2022 | + // player->sendNetworkPacket(pkt); |
2027 | 2023 | return Boolean::newBoolean(false); |
2028 | 2024 | } |
2029 | 2025 | CATCH("Fail in crashPlayer!"); |
@@ -2180,34 +2176,37 @@ Local<Value> PlayerClass::setSidebar(const Arguments& args) { |
2180 | 2176 | if (args.size() >= 3) CHECK_ARG_TYPE(args[2], ValueKind::kNumber); |
2181 | 2177 |
|
2182 | 2178 | try { |
2183 | | - Player* player = get(); |
2184 | | - if (!player) return Local<Value>(); |
2185 | | - |
2186 | | - std::vector<std::pair<std::string, int>> data; |
2187 | | - auto source = args[1].asObject(); |
2188 | | - auto keys = source.getKeyNames(); |
2189 | | - for (auto& key : keys) { |
2190 | | - data.push_back(make_pair(key, source.get(key).toInt())); |
2191 | | - } |
| 2179 | + // todo: fix this |
2192 | 2180 |
|
2193 | | - int sortOrder = 1; |
2194 | | - if (args.size() >= 3) sortOrder = args[2].toInt(); |
2195 | | - |
2196 | | - SetDisplayObjectivePacket |
2197 | | - disObjPkt("sidebar", "FakeScoreObj", args[0].asString().toString(), "dummy", (ObjectiveSortOrder)sortOrder); |
2198 | | - disObjPkt.sendTo(*player); |
2199 | | - std::vector<ScorePacketInfo> info; |
2200 | | - for (auto& i : data) { |
2201 | | - ScorePacketInfo pktInfo; |
2202 | | - pktInfo.mScoreboardId = i.second; |
2203 | | - pktInfo.mObjectiveName = "FakeScoreObj"; |
2204 | | - pktInfo.mIdentityType = IdentityDefinition::Type::FakePlayer; |
2205 | | - pktInfo.mScoreValue = i.second; |
2206 | | - pktInfo.mFakePlayerName = i.first; |
2207 | | - info.emplace_back(pktInfo); |
2208 | | - } |
2209 | | - SetScorePacket setPkt = SetScorePacket::change(info); |
2210 | | - setPkt.sendTo(*player); |
| 2181 | + // Player* player = get(); |
| 2182 | + // if (!player) return Local<Value>(); |
| 2183 | + // |
| 2184 | + // std::vector<std::pair<std::string, int>> data; |
| 2185 | + // auto source = args[1].asObject(); |
| 2186 | + // auto keys = source.getKeyNames(); |
| 2187 | + // for (auto& key : keys) { |
| 2188 | + // data.push_back(make_pair(key, source.get(key).toInt())); |
| 2189 | + // } |
| 2190 | + // |
| 2191 | + // int sortOrder = 1; |
| 2192 | + // if (args.size() >= 3) sortOrder = args[2].toInt(); |
| 2193 | + // |
| 2194 | + // SetDisplayObjectivePacket |
| 2195 | + // disObjPkt("sidebar", "FakeScoreObj", args[0].asString().toString(), "dummy", |
| 2196 | + // (ObjectiveSortOrder)sortOrder); |
| 2197 | + // disObjPkt.sendTo(*player); |
| 2198 | + // std::vector<ScorePacketInfo> info; |
| 2199 | + // for (auto& i : data) { |
| 2200 | + // ScorePacketInfo pktInfo; |
| 2201 | + // pktInfo.mScoreboardId = i.second; |
| 2202 | + // pktInfo.mObjectiveName = "FakeScoreObj"; |
| 2203 | + // pktInfo.mIdentityType = IdentityDefinition::Type::FakePlayer; |
| 2204 | + // pktInfo.mScoreValue = i.second; |
| 2205 | + // pktInfo.mFakePlayerName = i.first; |
| 2206 | + // info.emplace_back(pktInfo); |
| 2207 | + // } |
| 2208 | + // SetScorePacket setPkt = SetScorePacket::change(info); |
| 2209 | + // setPkt.sendTo(*player); |
2211 | 2210 | return Boolean::newBoolean(true); |
2212 | 2211 | } |
2213 | 2212 | CATCH("Fail in setSidebar!") |
|
0 commit comments