Slimefun / dough

Library containing a lot of useful utility classes for the everyday Java and Spigot/Paper developer.
MIT License
32 stars 31 forks source link

Lockette fixes, LockettePro support #238

Closed IAISI closed 3 months ago

Sfiguz7 commented 10 months ago

The dependency is not being found, could you double check if it's correct please?

EDIT: Could it be you need one from https://github.com/brunyman/LockettePro rather than NyaaCat's one?

IAISI commented 10 months ago

It should be updated fork of https://github.com/connection-lost/LockettePro

probably...

https://github.com/NyaaCat/LockettePro https://github.com/GreenSurvivors/LockettePro https://github.com/233Chad/LockettePro

personally I'm using the one from NyanCat, also the one from 233Chad is good, they all use same package names.

IAISI commented 10 months ago

My bad I just realized I'm using 233Chad's version.

IAISI commented 10 months ago

This should fix the issue.

IAISI commented 10 months ago

Would also like to point out that the I suspect original Lockette implementation is wrong:

https://github.com/baked-libs/dough/blob/dd9b6b617f0539e832bfe6a31b169d13cd82551e/dough-protection/src/main/java/io/github/bakedlibs/dough/protection/modules/LocketteProtectionModule.java#L36

If block is NOT protected by lockette is would always return false for hasPermission, this is probably not right?

Furthermore booleans are also wrongly negated? So if Lockette#isOwner returns true, hasPermission would actually return false?

J3fftw1 commented 10 months ago

Would also like to point out that the I suspect original Lockette implementation is wrong:

main/dough-protection/src/main/java/io/github/bakedlibs/dough/protection/modules/LocketteProtectionModule.java

` @OverRide public boolean hasPermission(OfflinePlayer p, Location l, Interaction action) { if (action.getType() != ActionType.BLOCK) { return true; }

    Block b = l.getBlock();

    if (Lockette.isProtected(b)) {
        BlockState state = b.getState();

        if (state instanceof Sign) {
            return !Lockette.isOwner((Sign) state, p);
        } else {
            return !Lockette.isOwner(b, p);
        }
    } else
        return false;
}

`

If block is NOT protected by lockette is would always return false for hasPermission, this is probably not right?

Furthermore booleans are also wrongly negated? So if Lockette#isOwner returns true, hasPermission would actually return false?

What you are saying could very well be true, This is why i said on discord to you we do not implement these things since we do not know how their stuff works. This might very well be case of a user like you implementing this wrongly and since we do not the implementation these issues would arrise

IAISI commented 10 months ago

https://github.com/NyaaCat/LockettePro/blob/1.20.1/src/main/java/me/crafter/mc/lockettepro/LocketteProAPI.java

I understand, sorry for the confusion, I guess I can just close this?

J3fftw1 commented 10 months ago

You dont have to close this we appreciate the PR. We just need to be sure its working.

J3fftw1 commented 8 months ago

Marking this as stale. The repo is no merged to the Slimefun org so it should be reviewed faster in the future.