Compare commits
6 Commits
+1
-1
Submodule SDK-GMLIB updated: b1e7ebd770...ae86cc4327
@@ -2,6 +2,9 @@
|
||||
"name": "${pluginName}",
|
||||
"entry": "${pluginFile}",
|
||||
"type": "native",
|
||||
"version": "0.10.2",
|
||||
"author": "GroupMountain",
|
||||
"description": "Clean Entities",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "GMLIB"
|
||||
|
||||
@@ -17,11 +17,7 @@ bool isMatch(std::string& A, std::string& B) {
|
||||
|
||||
bool shouldIgnore(GMLIB_Actor* ac) {
|
||||
if (ac->isMob() || ac->isItemActor()) {
|
||||
if (ac->isTame() || ac->isTrusting() || ac->getNameTag() != "") {
|
||||
return true;
|
||||
}
|
||||
auto nbt = ac->getNbt();
|
||||
if (nbt->getByte("ShowBottom") == 1) { // End Crystal Used Only, if has this tag 1b, it is modified by cleaner.
|
||||
if (ac->isTame() || ac->isTrusting() || ac->getNameTag() != "" || ac->hasTag("cleaner:ignore")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -35,8 +31,7 @@ bool ShouldClean(Actor* actor) {
|
||||
return false;
|
||||
}
|
||||
auto type = en->getTypeName();
|
||||
auto tags = Config->getValue<std::vector<std::string>>({"IgnoreTags"}, {});
|
||||
for (auto& tag : tags) {
|
||||
for (auto& tag : ConfigFile::mIgnoreTags) {
|
||||
if (en->hasTag(tag)) {
|
||||
return false;
|
||||
}
|
||||
@@ -62,7 +57,7 @@ bool ShouldClean(Actor* actor) {
|
||||
// Mobs
|
||||
else if (en->isMob()) {
|
||||
if (Config->getValue<bool>({"CleanMobs", "Enabled"}, false)) {
|
||||
auto blacklist = Config->getValue<std::vector<std::string>>({"CleanMobs", "Blacklist"}, {});
|
||||
auto blacklist = Config->getValue<std::vector<std::string>>({"CleanMobs", "BlackList"}, {});
|
||||
for (auto& key : blacklist) {
|
||||
if (isMatch(type, key)) {
|
||||
return true;
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace ConfigFile {
|
||||
bool mConsoleLog = true;
|
||||
bool mAnnounce = true;
|
||||
bool mSendToast = true;
|
||||
std::vector<std::string> mIgnoreTags = {};
|
||||
|
||||
} // namespace ConfigFile
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ void loadCleaner() {
|
||||
ConfigFile::mAnnounce = Config->getValue<bool>({"Basic", "SendBroadcast"}, true);
|
||||
ConfigFile::mConsoleLog = Config->getValue<bool>({"Basic", "ConsoleLog"}, true);
|
||||
ConfigFile::mSendToast = Config->getValue<bool>({"Basic", "SendToast"}, true);
|
||||
ConfigFile::mIgnoreTags = Config->getValue<std::vector<std::string>>({"IgnoreTags"}, {});
|
||||
}
|
||||
|
||||
void unloadCleaner() { stopAllTasks(); }
|
||||
|
||||
@@ -9,11 +9,7 @@ int mItemDespawnTicks = 3000;
|
||||
|
||||
namespace Cleaner {
|
||||
|
||||
void setShouldIgnore(GMLIB_Actor* ac) {
|
||||
auto nbt = ac->getNbt();
|
||||
nbt->put("ShowBottom", ByteTag(1));
|
||||
ac->setNbt(*nbt);
|
||||
}
|
||||
void setShouldIgnore(GMLIB_Actor* ac) { ac->addTag("cleaner:ignore"); }
|
||||
|
||||
void ListenEvents() {
|
||||
auto& eventBus = ll::event::EventBus::getInstance();
|
||||
@@ -21,8 +17,8 @@ void ListenEvents() {
|
||||
eventBus.emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent>(
|
||||
[](GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent& event) {
|
||||
auto& item = event.getItemActor();
|
||||
auto pl = (GMLIB_Player*)event.getSpawner();
|
||||
if (pl) {
|
||||
if (event.getSpawner().has_value()) {
|
||||
auto pl = (GMLIB_Player*)event.getSpawner().as_ptr();
|
||||
if (pl->isPlayer() && !pl->isAlive()) { // Death Drop
|
||||
auto ac = (GMLIB_Actor*)&item;
|
||||
setShouldIgnore(ac);
|
||||
|
||||
@@ -30,14 +30,15 @@ void sendVoteForm(Player* pl) {
|
||||
tr("cleaner.vote.no")
|
||||
);
|
||||
ll::service::getLevel()->forEachPlayer([&](Player& pl) -> bool {
|
||||
fm.sendTo(pl, [](Player& player, ll::form::ModalForm::SelectedButton button) {
|
||||
switch (button) {
|
||||
case ll::form::ModalForm::SelectedButton::Upper: {
|
||||
fm.sendTo(pl, [](Player& player, ll::form::ModalFormResult result, ll::form::FormCancelReason reason) {
|
||||
if (result.has_value()) {
|
||||
switch (result.value()) {
|
||||
case ll::form::ModalFormSelectedButton::Upper: {
|
||||
voteList[player.getUuid()] = true;
|
||||
player.sendMessage(tr("cleaner.vote.accept"));
|
||||
return;
|
||||
}
|
||||
case ll::form::ModalForm::SelectedButton::Lower: {
|
||||
case ll::form::ModalFormSelectedButton::Lower: {
|
||||
voteList[player.getUuid()] = false;
|
||||
player.sendMessage(tr("cleaner.vote.deny"));
|
||||
return;
|
||||
@@ -45,6 +46,7 @@ void sendVoteForm(Player* pl) {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
@@ -104,17 +106,19 @@ void confirmForm(Player* pl) {
|
||||
tr("cleaner.vote.confirmOk"),
|
||||
tr("cleaner.vote.confirmNo")
|
||||
);
|
||||
fm.sendTo(*pl, [](Player& player, ll::form::ModalForm::SelectedButton button) {
|
||||
switch (button) {
|
||||
case ll::form::ModalForm::SelectedButton::Upper: {
|
||||
fm.sendTo(*pl, [](Player& player, ll::form::ModalFormResult result, ll::form::FormCancelReason reason) {
|
||||
if (result.has_value()) {
|
||||
switch (result.value()) {
|
||||
case ll::form::ModalFormSelectedButton::Upper: {
|
||||
return voteClean(&player);
|
||||
}
|
||||
case ll::form::ModalForm::SelectedButton::Lower: {
|
||||
case ll::form::ModalFormSelectedButton::Lower: {
|
||||
return player.sendMessage(tr("cleaner.vote.cancel"));
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ extern int mItemDespawnTicks;
|
||||
extern bool mConsoleLog;
|
||||
extern bool mAnnounce;
|
||||
extern bool mSendToast;
|
||||
extern std::vector<std::string> mIgnoreTags;
|
||||
} // namespace ConfigFile
|
||||
|
||||
namespace Helper {
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"format_version": 2,
|
||||
"tooth": "github.com/GroupMountain/Cleaner",
|
||||
"version": "0.9.1",
|
||||
"version": "0.10.2",
|
||||
"info": {
|
||||
"name": "Cleaner",
|
||||
"description": "A Powerful Entities Cleaning up Plugin for BDS",
|
||||
@@ -13,9 +13,9 @@
|
||||
"gmlib"
|
||||
]
|
||||
},
|
||||
"asset_url": "https://github.com/GroupMountain/Cleaner/releases/download/v0.9.1/Cleaner-windows-x64.zip",
|
||||
"asset_url": "https://github.com/GroupMountain/Cleaner/releases/download/v0.10.2/Cleaner-windows-x64.zip",
|
||||
"dependencies": {
|
||||
"github.com/GroupMountain/GMLIB": ">=0.9.6"
|
||||
"github.com/GroupMountain/GMLIB": ">=0.10.0"
|
||||
},
|
||||
"files": {
|
||||
"place": [
|
||||
|
||||
Reference in New Issue
Block a user