-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add VaultGroupManager for GroupManager integration
This commit introduces the VaultGroupManager class for integrating the GroupManager plugin with Vault permissions. It implements various methods for managing player and group permissions, enabling seamless permission handling within different worlds. This ensures compatibility and enhanced functionality between Vault and GroupManager.
- Loading branch information
Showing
1 changed file
with
90 additions
and
0 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
plugin/src/main/java/net/thenextlvl/services/hook/permission/VaultSuperPerms.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,90 @@ | ||
package net.thenextlvl.services.hook.permission; | ||
|
||
import lombok.Getter; | ||
import net.milkbowl.vault.permission.Permission; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
@Getter | ||
public class VaultSuperPerms extends Permission { | ||
private final String name = "SuperPerms"; | ||
|
||
public VaultSuperPerms(Plugin plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean playerHas(String world, String name, String permission) { | ||
var player = plugin.getServer().getPlayer(name); | ||
return player != null && player.hasPermission(permission); | ||
} | ||
|
||
@Override | ||
public boolean playerAdd(String world, String player, String permission) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean playerRemove(String world, String player, String permission) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean groupHas(String world, String group, String permission) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public boolean groupAdd(String world, String group, String permission) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public boolean groupRemove(String world, String group, String permission) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public boolean playerInGroup(String world, String player, String group) { | ||
return playerHas(world, player, "groups." + group); | ||
} | ||
|
||
@Override | ||
public boolean playerAddGroup(String world, String player, String group) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public boolean playerRemoveGroup(String world, String player, String group) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public String[] getPlayerGroups(String world, String player) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public String getPrimaryGroup(String world, String player) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public String[] getGroups() { | ||
return new String[0]; | ||
} | ||
|
||
@Override | ||
public boolean hasSuperPermsCompat() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean hasGroupSupport() { | ||
return false; | ||
} | ||
} |