PlotSquared icon indicating copy to clipboard operation
PlotSquared copied to clipboard

fix: replace Vault`isPluginEnabled` check with null check as plugin not necessarily enabled yet

Open Test-Account666 opened this issue 1 year ago • 5 comments

Overview

In some cases, the isPluginEnabled check will cause the NullEconHandler to be used - Even though everything will work out.

Description

I noticed that PlotSquared will use the NullEconHandler in some scenarios. One of them is when the plugin providing the Economy is depending on Vault and PlotSquared.

I fixed this by replacing the Vault isPluginEnabled check with a null check.

The VaultPermissionHandler is also affected, although I don't know what's causing the issue here. I did not replace the isPluginEnabled this time, as it breaks permissions otherwise (See previous pull request).

Note that I kept the Vault isPluginEnabled check in the ServerListener, since Vault is going to be enabled at this point.

### Submitter Checklist
- [x] Make sure you are opening from a topic branch (**/feature/fix/docs/ branch** (right side)) and not your main branch.
- [x] Ensure that the pull request title represents the desired changelog entry.
- [x] New public fields and methods are annotated with `@since TODO`.
- [x] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md).

Test-Account666 avatar May 21 '24 17:05 Test-Account666

Have you tested ?

TheMeinerLP avatar May 21 '24 17:05 TheMeinerLP

Have you tested ?

This time, I tested the merge command, yes.

Without enough money, the merge will fail, as expected.

With enough money, the merge will succeed and withdraw the correct amount.

I also used the unlink command and tried again, for good measure.

If I should be doing more than that, please tell me :)

Test-Account666 avatar May 21 '24 17:05 Test-Account666

What exactly breaks by making the same change elsewhere, e.g. for permission handler?

dordsor21 avatar Jun 01 '24 14:06 dordsor21

What exactly breaks by making the same change elsewhere, e.g. for permission handler?

I actually didn't investigate to why this happens.

Permission checking straight up doesn't work anymore.

PlotSquared thinks nobody has permission to do anything

Test-Account666 avatar Jun 01 '24 22:06 Test-Account666

IHmm okay, so I suppose the vault permissions module is just never used then, which is why permissions continue to work? It might be worth forcefully disabling it to be sure

dordsor21 avatar Jun 02 '24 08:06 dordsor21