5 Commits

8 changed files with 19 additions and 22 deletions
+3
View File
@@ -2,6 +2,9 @@
"name": "${pluginName}",
"entry": "${pluginFile}",
"type": "native",
"version": "0.10.0",
"author": "GroupMountain",
"description": "Clean Entities",
"dependencies": [
{
"name": "GMLIB"
+3 -8
View File
@@ -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;
+1
View File
@@ -5,6 +5,7 @@ namespace ConfigFile {
bool mConsoleLog = true;
bool mAnnounce = true;
bool mSendToast = true;
std::vector<std::string> mIgnoreTags = {};
} // namespace ConfigFile
+1
View File
@@ -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(); }
+3 -7
View File
@@ -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);
+1
View File
@@ -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
View File
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "github.com/GroupMountain/Cleaner",
"version": "0.9.0",
"version": "0.10.0",
"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.0/Cleaner-windows-x64.zip",
"asset_url": "https://github.com/GroupMountain/Cleaner/releases/download/v0.10.0/Cleaner-windows-x64.zip",
"dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.9.4"
"github.com/GroupMountain/GMLIB": ">=0.10.0"
},
"files": {
"place": [