mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 09:07:37 +00:00
check if rsp is null
This commit is contained in:
parent
b78f71c238
commit
ebfba89994
@ -19,6 +19,10 @@ public class VaultHook
|
||||
{
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Vault")) return null;
|
||||
RegisteredServiceProvider<Chat> rsp = Bukkit.getServicesManager().getRegistration(Chat.class);
|
||||
if (rsp == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
CHAT = rsp.getProvider();
|
||||
return CHAT;
|
||||
}
|
||||
@ -27,6 +31,10 @@ public class VaultHook
|
||||
{
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Vault")) return null;
|
||||
RegisteredServiceProvider<Permission> rsp = Bukkit.getServicesManager().getRegistration(Permission.class);
|
||||
if (rsp == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
PERMISSIONS = rsp.getProvider();
|
||||
return PERMISSIONS;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package dev.plex.permission.handler;
|
||||
import dev.plex.api.permission.IPermissionHandler;
|
||||
import dev.plex.hook.VaultHook;
|
||||
import lombok.Getter;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -19,6 +18,10 @@ public class VaultPermissionHandler implements IPermissionHandler
|
||||
{
|
||||
return IPermissionHandler.super.hasPermission(player, permission);
|
||||
}
|
||||
if (VaultHook.getPermission() == null)
|
||||
{
|
||||
return IPermissionHandler.super.hasPermission(player, permission);
|
||||
}
|
||||
return VaultHook.getPermission().playerHas(null, player, permission);
|
||||
|
||||
}
|
||||
|
@ -119,6 +119,10 @@ public class RankManager
|
||||
}
|
||||
if (Bukkit.getServer().getPluginManager().isPluginEnabled("Vault") && Plex.get().getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
if (VaultHook.getChat() == null || VaultHook.getPermission() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Player bukkitPlayer = Bukkit.getPlayer(player.getUuid());
|
||||
String group = VaultHook.getPermission().getPrimaryGroup(bukkitPlayer);
|
||||
String vaultPrefix = VaultHook.getChat().getGroupPrefix(bukkitPlayer.getWorld(), group);
|
||||
|
Loading…
Reference in New Issue
Block a user