mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-06-05 03:43:40 +00:00
28 lines
669 B
C++
28 lines
669 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;
|
|
}
|