Skip to content

Commit

Permalink
fix: fix entity setter
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Aug 10, 2024
1 parent 5169726 commit c1d0125
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/legacy/api/EntityAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,11 @@ std::optional<Actor*> EntityClass::tryExtractActor(Local<Value> v) {

// 成员函数
void EntityClass::set(Actor* actor) {
if (actor) {
runtimeId = actor->getRuntimeID();
}
try {
if (actor && actor->hasRuntimeID()) {
runtimeId = actor->getRuntimeID();
}
} catch (...) {}
}

Actor* EntityClass::get() {
Expand Down
8 changes: 5 additions & 3 deletions src/legacy/api/PlayerAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,11 @@ Local<Value> McClass::broadcast(const Arguments& args) {

// 成员函数
void PlayerClass::set(Player* player) {
if (player) {
runtimeId = player->getRuntimeID();
}
try {
if (player && player->hasRuntimeID()) {
runtimeId = player->getRuntimeID();
}
} catch (...) {}
}

Player* PlayerClass::get() {
Expand Down

0 comments on commit c1d0125

Please sign in to comment.