Skip to content

Commit

Permalink
Add VaultGroupManager for GroupManager integration
Browse files Browse the repository at this point in the history
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
NonSwag committed Aug 18, 2024
1 parent 2063d37 commit 8b18636
Showing 1 changed file with 90 additions and 0 deletions.
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;
}
}

0 comments on commit 8b18636

Please sign in to comment.