Add coreprotect support, start on prism but commented out until they figure out a maven repository for their API

This commit is contained in:
Taah
2024-01-15 15:39:57 -08:00
parent 8c5c058292
commit b35bf63ba4
5 changed files with 175 additions and 4 deletions

View 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;
}
}

View 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;
}
}
*/