Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
fix MakeSP
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jul 14, 2021
1 parent 3bff961 commit 17a550e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 6 additions & 2 deletions LiteLoader/api/Basic_Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,14 @@ THook(bool,
}

Player *MakeSP(CommandOrigin &ori) {
Player *pl = (Player *)ori.getEntity();
if (pl) {
return pl;
}
// if (ori.getOriginType() == OriginType::Player) {
return (Player *)ori.getEntity();

// }
// return 0;
return 0;
}

vector<function<bool(PlayerUseCmdEV)>> PlayerUseCmdCallBacks;
Expand Down
13 changes: 10 additions & 3 deletions headers/api/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,22 @@ static_assert(sizeof(MakeOverload<void, int>) == 1);
{ MakeOverload __ov2((struct name2 *)0, cb2, #name2, cb, __VA_ARGS__); }
#include <api/types/types.h>
inline static optional<WPlayer> MakeWP(CommandOrigin const &ori) {
if (ori.getOriginType() == OriginType::Player) {
if ((ServerPlayer *)ori.getEntity()) {
return {{*(ServerPlayer *)ori.getEntity()}};
}
// if (ori.getOriginType() == OriginType::Player) {
//return {{*(ServerPlayer *)ori.getEntity()}};
//}
return {};
}
inline static ServerPlayer *MakeSP(CommandOrigin const &ori) {
if (ori.getOriginType() == OriginType::Player) {
return {(ServerPlayer *)ori.getEntity()};
ServerPlayer *sp = (ServerPlayer *)ori.getEntity();
if (sp) {
return {sp};
}
// if (ori.getOriginType() == OriginType::Player) {
//return {(ServerPlayer *)ori.getEntity()};
//}
return nullptr;
}
inline static ServerPlayer *MakeSP(void *x) {
Expand Down

0 comments on commit 17a550e

Please sign in to comment.