Skip to content

Commit

Permalink
fix: fix onRespawn
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jan 20, 2024
1 parent 7b4fa76 commit 6615a6f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/api/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "ll/api/event/player/PlayerDieEvent.h"
#include "ll/api/event/player/PlayerJoinEvent.h"
#include "ll/api/event/player/PlayerLeaveEvent.h"
#include "ll/api/event/player/PlayerRespawnEvent.h"
#include "mc/world/actor/player/Player.h"
#include "mc/world/level/dimension/Dimension.h"

Expand Down Expand Up @@ -426,15 +427,16 @@ void EnableEventListener(int eventId) {
});
break;

// case EVENT_TYPES::onRespawn:
// Event::PlayerRespawnEvent::subscribe([](const PlayerRespawnEvent &ev) {
// IF_LISTENED(EVENT_TYPES::onRespawn) {
// CallEvent(EVENT_TYPES::onRespawn,
// PlayerClass::newPlayer((Player *)ev.mPlayer));
// }
// IF_LISTENED_END(EVENT_TYPES::onRespawn)
// });
// break;
case EVENT_TYPES::onRespawn:
bus.emplaceListener<ll::event::PlayerRespawnEvent>(
[](ll::event::PlayerRespawnEvent &ev) {
IF_LISTENED(EVENT_TYPES::onRespawn) {
CallEvent(EVENT_TYPES::onRespawn,
PlayerClass::newPlayer(&ev.self()));
}
IF_LISTENED_END(EVENT_TYPES::onRespawn)
});
break;

// case EVENT_TYPES::onStartDestroyBlock:
// Event::PlayerStartDestroyBlockEvent::subscribe(
Expand Down

0 comments on commit 6615a6f

Please sign in to comment.