2022-05-11 05:48:47 +00:00
|
|
|
package dev.plex.hook;
|
|
|
|
|
|
|
|
import net.milkbowl.vault.chat.Chat;
|
|
|
|
import net.milkbowl.vault.permission.Permission;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
|
|
|
|
|
|
public class VaultHook
|
|
|
|
{
|
|
|
|
private static Chat CHAT;
|
|
|
|
private static Permission PERMISSIONS;
|
|
|
|
|
2022-05-19 18:59:16 +00:00
|
|
|
static
|
|
|
|
{
|
2022-05-11 05:48:47 +00:00
|
|
|
CHAT = setupChat();
|
|
|
|
PERMISSIONS = setupPermissions();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Chat setupChat()
|
|
|
|
{
|
2022-05-19 18:59:16 +00:00
|
|
|
if (!Bukkit.getPluginManager().isPluginEnabled("Vault"))
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2022-05-11 05:48:47 +00:00
|
|
|
RegisteredServiceProvider<Chat> rsp = Bukkit.getServicesManager().getRegistration(Chat.class);
|
2022-05-11 06:06:56 +00:00
|
|
|
if (rsp == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2022-05-11 05:48:47 +00:00
|
|
|
CHAT = rsp.getProvider();
|
|
|
|
return CHAT;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Permission setupPermissions()
|
|
|
|
{
|
2022-05-19 18:59:16 +00:00
|
|
|
if (!Bukkit.getPluginManager().isPluginEnabled("Vault"))
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2022-05-11 05:48:47 +00:00
|
|
|
RegisteredServiceProvider<Permission> rsp = Bukkit.getServicesManager().getRegistration(Permission.class);
|
2022-05-11 06:06:56 +00:00
|
|
|
if (rsp == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2022-05-11 05:48:47 +00:00
|
|
|
PERMISSIONS = rsp.getProvider();
|
|
|
|
return PERMISSIONS;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Permission getPermission()
|
|
|
|
{
|
|
|
|
return PERMISSIONS;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Chat getChat()
|
|
|
|
{
|
|
|
|
return CHAT;
|
|
|
|
}
|
|
|
|
}
|