Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom filtering rules to be configured #5

Open
Tracked by #17
TechnicJelle opened this issue Dec 23, 2023 · 13 comments
Open
Tracked by #17

Allow custom filtering rules to be configured #5

TechnicJelle opened this issue Dec 23, 2023 · 13 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@TechnicJelle
Copy link
Owner

Perhaps through some sort of scripting?
That seems awfully complicated, though...

Perhaps just a black/white-list, like BMAreaControl has is already enough..?

Please feel free to comment on this issue with your own thoughts on this!

@TechnicJelle TechnicJelle added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Dec 23, 2023
@TechnicJelle TechnicJelle mentioned this issue Dec 26, 2023
4 tasks
@ShDis
Copy link

ShDis commented Mar 3, 2024

Maybe just require BMAreaControl to use the area config from it? Oh, and also add an option to use BMAreaControl area settings into config.
But the most important filter is null text checker, 100% sure. There are a lot of empty signs in mobfarms like "ffffff". "wwww", etc. But mostly with no text at all or just spaces :)

@TechnicJelle
Copy link
Owner Author

I am leaning towards integrating LuaJ for this, to allow users to script exactly which signs they want to keep and which ones they want to remove.
Perhaps I'll include some templates that can be easily used or adapted.

@TechnicJelle
Copy link
Owner Author

TechnicJelle commented Mar 4, 2024

Regarding your suggestion of using BlueMap Area Control areas, I don't think I would be doing exactly that, due to wanting to keep my add-ons as independent of each other as possible.
Instead, I'll try and see if I can add a way to filter out the signs from un-rendered areas on the BlueMap itself. This should have effectively the same effect.
Likely with the BlueMapMap#getTileFilter() method.

I may have to make this add-on softdepend on BMAC, though, to ensure that it loads after BMCAC, so BMAC has the time to set up its tile filter first. (But not any actual interaction code)
Or I just add a 10-second delay before this plugin starts the sign extraction process. Maybe that'll be simpler...

@ShDis
Copy link

ShDis commented Mar 5, 2024

LuaJ for this, to allow users to script exactly which signs they want to keep and which ones they want to remove

In Overviewer there was an option to filter signs via a python function added to the config or so.
As a temporary solution I made this script for myself to filter the results

import json
with open('markers world original.json', 'r',encoding='UTF8') as file:
    data = json.load(file)
filtered_signs = {key: value for key, value in data['signs']['markers'].items() if ((value['position']['x'] > -4600.0 and value['position']['x'] < 7000.0 and value['position']['z'] > -3500.0 and value['position']['z'] < 1600.0) and value['position']['y'] >= 60.0)}
data['signs']['markers'] = filtered_signs
with open('markers world.json', 'w') as file:
    json.dump(data, file, indent=2)

@TechnicJelle
Copy link
Owner Author

Yeah I also just checked the Overviewer docs, to see what they used, and indeed, they use Python.
https://docs.overviewer.org/en/latest/signs/
I think I'll also use Python then, to keep it simple for people to switch to this.
And I don't necessarily mind using Python for this either, as it's a fine language for scripting stuff like this

@TechnicJelle
Copy link
Owner Author

I've been experimenting with Jython a bit, and from my first tests, it seems pretty cool, but it does inflate the size of the plugin to like 50 megabytes, from the half a megabyte that it currently is...

@TechnicJelle
Copy link
Owner Author

And it also doesn't seem to want to properly compile. It runs fine in IntelliJ, but when I package up the plugin as a .jar, and try to run it, it doesn't work; it can't find the Jython Script Engine.
It's most certainly in there, though, as the jar has bloated to the aforementioned 50 megabytes.

@TechnicJelle
Copy link
Owner Author

TechnicJelle commented Mar 17, 2024

I've found an alternative Python runtime for Java: https://github.com/oracle/graalpython
When I tried it out just now, it was a LOT simpler to integrate and package up, and I have now succeeded in running Python code on my Minecraft server!!

However, this comes at the cost of a ridiculous jar size of 124.4 megabytes... 😱

@TechnicJelle
Copy link
Owner Author

TechnicJelle commented Mar 17, 2024

I am considering using Groovy instead of Python. All these giant jar sizes are making me depressed. Groovy should be a LOT more reasonable.
@ShDis, what would you think about this?
Do you think it'll be easy enough for people who are used to Python to pick up Groovy?

@ShDis
Copy link

ShDis commented Mar 19, 2024

I've never heard of Groovy before (okay, maybe 1 time or 2, sounds familiar).
But I don't think that's the problem. There are no other similar tools to solve the "sign problem". So any solution is great, even a 124mb size (honestly, I don't really care about its size because my server folder without backups is about 130gb).
If the solution is on Groovy - good, then I'll learn how to use it.
And if it's easy to use, the solution will be twice as good :з

@ShDis
Copy link

ShDis commented Mar 19, 2024

But as a "half-programmer", I really like the way you try to make the implementation as good as possible

@TechnicJelle
Copy link
Owner Author

I'd like all the things I make to be as simple as possible for people to use, while still allowing advanced users the power they need, as well :)

I've been playing around with Jython again this evening, without much success, sadly.
Although I have been somewhat convinced to have the scripting feature as like, as addon.
So by default, it just works like this, but if you download the Jython jar and put it into the config directory, it'll load it, and run the filter script.
Only, I've not been successful in loading the jar file dynamically, yet.
It's proving a lot more challenging than I'd hoped.

@TechnicJelle
Copy link
Owner Author

TechnicJelle commented Mar 20, 2024

Oh my goodness, I have finally got it to work!!!
image
It's printing stuff from a Python script, running on my test server! 🥳

With a million thanks to Blue for sending how he does it!

We are back in business! 😎
I'll go to sleep now, but I'll try and get a prototype of filtering working soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants