mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-06 09:36:40 +00:00
Add coreprotect support, start on prism but commented out until they figure out a maven repository for their API
This commit is contained in:
63
server/src/main/java/dev/plex/hook/CoreProtectHook.java
Normal file
63
server/src/main/java/dev/plex/hook/CoreProtectHook.java
Normal file
@ -0,0 +1,63 @@
|
||||
package dev.plex.hook;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import dev.plex.util.minimessage.SafeMiniMessage;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CoreProtectHook
|
||||
{
|
||||
private CoreProtectAPI coreProtectAPI;
|
||||
private boolean hasApi;
|
||||
|
||||
public CoreProtectHook(Plex plex)
|
||||
{
|
||||
Plugin plugin = plex.getServer().getPluginManager().getPlugin("CoreProtect");
|
||||
|
||||
// Check that CoreProtect is loaded
|
||||
if (!(plugin instanceof CoreProtect))
|
||||
{
|
||||
PlexLog.debug("Plugin was not CoreProtect.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that the API is enabled
|
||||
CoreProtectAPI coreProtectAPI = ((CoreProtect) plugin).getAPI();
|
||||
this.hasApi = coreProtectAPI.isEnabled();
|
||||
if (!hasApi)
|
||||
{
|
||||
PlexLog.debug("CoreProtect API was disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that a compatible version of the API is loaded
|
||||
if (coreProtectAPI.APIVersion() < 9)
|
||||
{
|
||||
PlexLog.debug("CoreProtect API version is: {0}", coreProtectAPI.APIVersion());
|
||||
return;
|
||||
}
|
||||
this.coreProtectAPI = coreProtectAPI;
|
||||
this.coreProtectAPI.testAPI();
|
||||
}
|
||||
|
||||
public boolean hasCoreProtect() {
|
||||
return hasApi;
|
||||
}
|
||||
|
||||
public CoreProtectAPI coreProtectAPI()
|
||||
{
|
||||
return coreProtectAPI;
|
||||
}
|
||||
}
|
34
server/src/main/java/dev/plex/hook/PrismHook.java
Normal file
34
server/src/main/java/dev/plex/hook/PrismHook.java
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
package dev.plex.hook;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class PrismHook
|
||||
{
|
||||
private PrismApi prismApi;
|
||||
|
||||
public PrismHook(Plex plex)
|
||||
{
|
||||
Plugin plugin = plex.getServer().getPluginManager().getPlugin("Prism");
|
||||
|
||||
// Check that Prism is loaded
|
||||
if (!plugin.isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that the API is enabled
|
||||
this.prismApi = (PrismApi) plugin;
|
||||
}
|
||||
|
||||
public boolean hasPrism() {
|
||||
return prismApi != null;
|
||||
}
|
||||
|
||||
public PrismApi prismApi()
|
||||
{
|
||||
return prismApi;
|
||||
}
|
||||
}
|
||||
*/
|
Reference in New Issue
Block a user