-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for permissions api, add few more rules and setup modrint…
…h releases
- Loading branch information
Showing
8 changed files
with
150 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/xyz/nucleoid/leukocyte/roles/PermissionAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package xyz.nucleoid.leukocyte.roles; | ||
|
||
import me.lucko.fabric.api.permissions.v0.Permissions; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
|
||
public interface PermissionAccessor { | ||
PermissionAccessor INSTANCE = FabricLoader.getInstance().isModLoaded("fabric-permissions-api-v0") ? new FabricPermissionsV0() : new None(); | ||
|
||
boolean hasPermission(ServerPlayerEntity player, String permission); | ||
|
||
final class None implements PermissionAccessor { | ||
None() { | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(ServerPlayerEntity player, String permission) { | ||
return false; | ||
} | ||
} | ||
|
||
final class FabricPermissionsV0 implements PermissionAccessor { | ||
FabricPermissionsV0() { | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(ServerPlayerEntity player, String permission) { | ||
return Permissions.check(player, permission); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters