File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11#include " api/LoggerAPI.h"
22
33#include " api/APIHelp.h"
4+ #include " api/PlayerAPI.h"
45#include " engine/EngineOwnData.h"
56#include " ll/api/Logger.h"
7+ #include " ll/api/service/Bedrock.h"
8+ #include " mc/world/actor/player/Player.h"
9+ #include " mc/world/level/Level.h"
610#include " utils/Utils.h"
711
812#include < fstream>
913#include < iostream>
1014#include < string>
15+ #include < string_view>
1116
1217// ////////////////// Classes ////////////////////
1318
@@ -169,8 +174,20 @@ Local<Value> LoggerClass::setFile(const Arguments& args) {
169174}
170175
171176Local<Value> LoggerClass::setPlayer (const Arguments& args) {
177+ CHECK_ARGS_COUNT (args, 1 )
172178 try {
173- return Boolean::newBoolean (false );
179+ Player* player = PlayerClass::extract (args[0 ]);
180+ if (!player) {
181+ return Boolean::newBoolean (false );
182+ }
183+ ENGINE_OWN_DATA ()->logger .setPlayerOutputFunc ([uuid (player->getUuid ())](std::string_view str) {
184+ ll::service::getLevel ()->getPlayer (uuid)->sendMessage (str);
185+ });
186+ if (args.size () >= 2 ) {
187+ ENGINE_OWN_DATA ()->logger .fileLevel = args[1 ].toInt ();
188+ UpdateMaxLogLevel ();
189+ }
190+ return Boolean::newBoolean (true );
174191 }
175192 CATCH (" Fail in LoggerSetPlayer!" )
176193}
You can’t perform that action at this time.
0 commit comments