Fixes the problem with Dynmap disabling Stargate

This commit is contained in:
2024-03-06 13:57:31 +01:00
parent 2746e4f8ee
commit c2ab3dd8b2
2 changed files with 22 additions and 8 deletions

View File

@@ -131,6 +131,14 @@ public final class DynmapManager {
} }
} }
/**
* Disables Dynmap integration
*/
public static void disable() {
markerSet = null;
portalIcon = null;
}
/** /**
* Gets the id used for the given portal's marker * Gets the id used for the given portal's marker
* *

View File

@@ -112,15 +112,21 @@ public final class StargateConfig {
setupVaultEconomy(); setupVaultEconomy();
//Set up dynmap //Set up dynmap
DynmapAPI dynmapAPI = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap"); try {
if (dynmapAPI != null) { DynmapAPI dynmapAPI = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap");
try { if (dynmapAPI != null) {
DynmapManager.initialize(dynmapAPI); try {
DynmapManager.addAllPortalMarkers(); DynmapManager.initialize(dynmapAPI);
} catch (NullPointerException exception) { DynmapManager.addAllPortalMarkers();
logger.warning("Dynmap started in an invalid state. Check your log/console for dynmap-related " + } catch (NullPointerException ignored) {
"problems. Dynmap integration cannot be initialized."); logger.warning("Dynmap started in an invalid state. Check your log/console for dynmap-related " +
"problems. Dynmap integration cannot be initialized.");
}
} }
} catch (NoClassDefFoundError error) {
logger.warning("Dynmap seems to be unavailable, even though its API is registered. Dynmap " +
"integration is disabled.");
DynmapManager.disable();
} }
this.isLoaded = true; this.isLoaded = true;