lucko / fabric-permissions-api

A simple permissions API for Fabric
MIT License
54 stars 14 forks source link

entity.getCommandSource() fix for 24w39a+ #26

Closed sakura-ryoko closed 1 week ago

sakura-ryoko commented 1 month ago

Not the "Prettiest" solution, but it works.

DrexHD commented 1 week ago

Sorry, never commented on this, but last time I looked, passing null as world will cause an NPE, because the world variable is used to get the server field in the command source.

sakura-ryoko commented 6 days ago

Sorry, never commented on this, but last time I looked, passing null as world will cause an NPE, because the world variable is used to get the server field in the command source.

This is why I was hoping that Lucko would take your input before merging the PR. Let's just hope things don't break badly.

DrexHD commented 6 days ago

This will only cause problems if the api is used on a client side entity, which afaik luckperms (pretty much the main provider for the api) doesn't even support (see line 72 & 118).

Wesley1808 commented 4 days ago

This sadly doesn't seem to return accurate permission results, at least for fallback checking operator levels. It turns out that there's a ServerPlayerEntity.getCommandSource() aswell as a Entity.getCommandSource(ServerWorld). The entity one (which is used here) always passes op level 0.