LiteLoaderBDS-1.16.40/LiteLoader/Kernel/Scoreboard/ObjectiveAPI.cpp
2022-09-25 01:17:11 +08:00

32 lines
804 B
C++

#include <MC/Objective.hpp>
#include <MC/ServerScoreboard.hpp>
#include <GlobalServiceAPI.h>
// helper
#define H do_hash
LIAPI bool checkSlotName(const std::string& slot) {
switch (H(slot.c_str())) {
case H("list"):
break;
case H("sidebar"):
break;
case H("belowname"):
break;
default:
return false;
}
return true;
}
bool Objective::setDisplay(const std::string& slotName, ObjectiveSortOrder sort) {
if (checkSlotName(slotName)) {
((ServerScoreboard*)Global<Scoreboard>)->setDisplayObjective(slotName, *this, sort);
return true;
}
return false;
}
std::string Objective::getName(){
//ScoreboardCommand::applyPlayerOperation Line186
return dAccess<std::string&>(this, 64);
};