spartacus04 / jext-reborn

Level up your server with custom music discs - "Just like vanilla jukebox, but better!". I mantain this in my free time.
https://spartacus04.github.io/jext-reborn/
Other
36 stars 8 forks source link

Add permission node for using jukeboxes, fix worldguard integration #301

Closed neomoth closed 5 months ago

neomoth commented 5 months ago

Addresses the following issue/feature request by adding the requested permission node:

Addresses the fact that the WorldGuard integration does not account for unset flags that don't have a default permission (CHEST_ACCESS does not have a default value when unset, meaning by default players cannot use jukeboxes.) This is done via altering the flag check to allow returning null, and explicitly check that the returned result is equal to false.

neomoth commented 5 months ago

May need some slight tweaking, unsure how you want to handle this, and the CodeFactor thing is pointing out some stuff but also I barely know how Kotlin works in the first place. Just wanted to address these issues as they were causing issues for the server I manage.

spartacus04 commented 5 months ago

Hello! Thanks a lot for the pr. I've been extremely busy lately and I've had no time to work on the plugin. It's extremely appreciated.

I'll just check the code a bit in a few minutes, and tell you if there are any changes you should make.

spartacus04 commented 5 months ago

@neomoth If you are busy I can fix these problems myself don't worry, I just reported these to make them clear since it could help you get better at kotlin

neomoth commented 5 months ago

I've made the requested changes, I had changed so much due to not being familiar with kotlin syntax and wasn't aware I could have avoided the whole needing to check for null situation by just altering the original flags.any return statement lol. Also, I updated on browser due to being a tad busy, so I can't test if this actually works though I assume it does and can test in a couple of hours just in case.

spartacus04 commented 5 months ago

thanks for the fixes! Once you are done with the testing I'll merge this and publish an update

neomoth commented 5 months ago

Oh that's a problem.

Operator '==' cannot be applied to 'Boolean' and 'StateFlag.State'
spartacus04 commented 5 months ago

Just replace containerQuery.testState with containerQuery.queryState

neomoth commented 5 months ago

Ohhh i see. One moment.

neomoth commented 5 months ago

Fixed, had to actually rewind and commit again because apparently it really didn't feel like using my correct credentials on this machine so it had used a different name and email for the commit lol. Tested and it works, I'm able to use a jukebox deopped in the __global__ region.

spartacus04 commented 5 months ago

Thanks again for the pr!