mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-06 09:36:40 +00:00
Make the list command work with the permission system
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
package dev.plex.hook;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class VaultHook
|
||||
@ -46,6 +51,22 @@ public class VaultHook
|
||||
return PERMISSIONS;
|
||||
}
|
||||
|
||||
public static Component getPrefix(PlexPlayer plexPlayer)
|
||||
{
|
||||
if (VaultHook.getChat() == null || VaultHook.getPermission() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (Plex.get().getRankManager().getConfigPrefixes(plexPlayer) != null)
|
||||
{
|
||||
return Plex.get().getRankManager().getConfigPrefixes(plexPlayer);
|
||||
}
|
||||
Player bukkitPlayer = Bukkit.getPlayer(plexPlayer.getUuid());
|
||||
String group = VaultHook.getPermission().getPrimaryGroup(bukkitPlayer);
|
||||
String vaultPrefix = VaultHook.getChat().getGroupPrefix(bukkitPlayer.getWorld(), group);
|
||||
return LegacyComponentSerializer.legacyAmpersand().deserialize(vaultPrefix);
|
||||
}
|
||||
|
||||
public static Permission getPermission()
|
||||
{
|
||||
return PERMISSIONS;
|
||||
|
Reference in New Issue
Block a user