Compare commits
4 Commits
+1
-1
Submodule SDK-GMLIB updated: 58cec5c0c5...37d92200bd
@@ -2,6 +2,9 @@
|
|||||||
"name": "${pluginName}",
|
"name": "${pluginName}",
|
||||||
"entry": "${pluginFile}",
|
"entry": "${pluginFile}",
|
||||||
"type": "native",
|
"type": "native",
|
||||||
|
"version": "0.10.0",
|
||||||
|
"author": "GroupMountain",
|
||||||
|
"description": "Clean Entities",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
{
|
{
|
||||||
"name": "GMLIB"
|
"name": "GMLIB"
|
||||||
|
|||||||
@@ -17,11 +17,7 @@ bool isMatch(std::string& A, std::string& B) {
|
|||||||
|
|
||||||
bool shouldIgnore(GMLIB_Actor* ac) {
|
bool shouldIgnore(GMLIB_Actor* ac) {
|
||||||
if (ac->isMob() || ac->isItemActor()) {
|
if (ac->isMob() || ac->isItemActor()) {
|
||||||
if (ac->isTame() || ac->isTrusting() || ac->getNameTag() != "") {
|
if (ac->isTame() || ac->isTrusting() || ac->getNameTag() != "" || ac->hasTag("cleaner:ignore")) {
|
||||||
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.
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,8 +31,7 @@ bool ShouldClean(Actor* actor) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto type = en->getTypeName();
|
auto type = en->getTypeName();
|
||||||
auto tags = Config->getValue<std::vector<std::string>>({"IgnoreTags"}, {});
|
for (auto& tag : ConfigFile::mIgnoreTags) {
|
||||||
for (auto& tag : tags) {
|
|
||||||
if (en->hasTag(tag)) {
|
if (en->hasTag(tag)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ConfigFile {
|
|||||||
bool mConsoleLog = true;
|
bool mConsoleLog = true;
|
||||||
bool mAnnounce = true;
|
bool mAnnounce = true;
|
||||||
bool mSendToast = true;
|
bool mSendToast = true;
|
||||||
|
std::vector<std::string> mIgnoreTags = {};
|
||||||
|
|
||||||
} // namespace ConfigFile
|
} // namespace ConfigFile
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ void loadCleaner() {
|
|||||||
ConfigFile::mAnnounce = Config->getValue<bool>({"Basic", "SendBroadcast"}, true);
|
ConfigFile::mAnnounce = Config->getValue<bool>({"Basic", "SendBroadcast"}, true);
|
||||||
ConfigFile::mConsoleLog = Config->getValue<bool>({"Basic", "ConsoleLog"}, true);
|
ConfigFile::mConsoleLog = Config->getValue<bool>({"Basic", "ConsoleLog"}, true);
|
||||||
ConfigFile::mSendToast = Config->getValue<bool>({"Basic", "SendToast"}, true);
|
ConfigFile::mSendToast = Config->getValue<bool>({"Basic", "SendToast"}, true);
|
||||||
|
ConfigFile::mIgnoreTags = Config->getValue<std::vector<std::string>>({"IgnoreTags"}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void unloadCleaner() { stopAllTasks(); }
|
void unloadCleaner() { stopAllTasks(); }
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ int mItemDespawnTicks = 3000;
|
|||||||
|
|
||||||
namespace Cleaner {
|
namespace Cleaner {
|
||||||
|
|
||||||
void setShouldIgnore(GMLIB_Actor* ac) {
|
void setShouldIgnore(GMLIB_Actor* ac) { ac->addTag("cleaner:ignore"); }
|
||||||
auto nbt = ac->getNbt();
|
|
||||||
nbt->put("ShowBottom", ByteTag(1));
|
|
||||||
ac->setNbt(*nbt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListenEvents() {
|
void ListenEvents() {
|
||||||
auto& eventBus = ll::event::EventBus::getInstance();
|
auto& eventBus = ll::event::EventBus::getInstance();
|
||||||
@@ -21,8 +17,8 @@ void ListenEvents() {
|
|||||||
eventBus.emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent>(
|
eventBus.emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent>(
|
||||||
[](GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent& event) {
|
[](GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent& event) {
|
||||||
auto& item = event.getItemActor();
|
auto& item = event.getItemActor();
|
||||||
auto pl = (GMLIB_Player*)event.getSpawner();
|
if (event.getSpawner().has_value()) {
|
||||||
if (pl) {
|
auto pl = (GMLIB_Player*)event.getSpawner().as_ptr();
|
||||||
if (pl->isPlayer() && !pl->isAlive()) { // Death Drop
|
if (pl->isPlayer() && !pl->isAlive()) { // Death Drop
|
||||||
auto ac = (GMLIB_Actor*)&item;
|
auto ac = (GMLIB_Actor*)&item;
|
||||||
setShouldIgnore(ac);
|
setShouldIgnore(ac);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ extern int mItemDespawnTicks;
|
|||||||
extern bool mConsoleLog;
|
extern bool mConsoleLog;
|
||||||
extern bool mAnnounce;
|
extern bool mAnnounce;
|
||||||
extern bool mSendToast;
|
extern bool mSendToast;
|
||||||
|
extern std::vector<std::string> mIgnoreTags;
|
||||||
} // namespace ConfigFile
|
} // namespace ConfigFile
|
||||||
|
|
||||||
namespace Helper {
|
namespace Helper {
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"format_version": 2,
|
"format_version": 2,
|
||||||
"tooth": "github.com/GroupMountain/Cleaner",
|
"tooth": "github.com/GroupMountain/Cleaner",
|
||||||
"version": "0.8.2",
|
"version": "0.10.0",
|
||||||
"info": {
|
"info": {
|
||||||
"name": "Cleaner",
|
"name": "Cleaner",
|
||||||
"description": "A Powerful Entities Cleaning up Plugin for BDS",
|
"description": "A Powerful Entities Cleaning up Plugin for BDS",
|
||||||
@@ -13,9 +13,9 @@
|
|||||||
"gmlib"
|
"gmlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"asset_url": "https://github.com/GroupMountain/Cleaner/releases/download/v0.8.2/Cleaner-windows-x64.zip",
|
"asset_url": "https://github.com/GroupMountain/Cleaner/releases/download/v0.10.0/Cleaner-windows-x64.zip",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"github.com/GroupMountain/GMLIB": ">=0.8.2"
|
"github.com/GroupMountain/GMLIB": ">=0.10.0"
|
||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"place": [
|
"place": [
|
||||||
|
|||||||
Reference in New Issue
Block a user