This repository has been archived by the owner on Feb 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Window5000/dev
Update permission handling
- Loading branch information
Showing
5 changed files
with
21 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
13 changes: 9 additions & 4 deletions
13
.../io/github/openminigameserver/worldedit/platform/adapters/MinestomPermissionProvider.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 |
---|---|---|
@@ -1,16 +1,21 @@ | ||
package io.github.openminigameserver.worldedit.platform.adapters; | ||
|
||
import me.window.permissions.PermissionProvider; | ||
import net.minestom.server.entity.Player; | ||
|
||
public class MinestomPermissionProvider { | ||
|
||
public static PermissionProvider provider; | ||
|
||
public static void init() { | ||
provider = new PermissionProvider(4, "worldedit"); | ||
} | ||
public static boolean hasPermission(Player player, String permission) { | ||
if (player.hasPermission("*") || player.hasPermission("worldedit.*") || player.getPermissionLevel() >= 4) | ||
return true; | ||
return player.hasPermission(permission); | ||
return provider.hasExtensionPermission(player, permission); | ||
} | ||
|
||
public static boolean hasWorldEditPermission(Player player) { | ||
return player.hasPermission("*") || player.hasPermission("worldedit") || player.getPermissionLevel() >= 4; | ||
return provider.hasExtensionPermission(player); | ||
} | ||
|
||
} |
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