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,16 +112,22 @@ public final class StargateConfig {
setupVaultEconomy(); setupVaultEconomy();
//Set up dynmap //Set up dynmap
try {
DynmapAPI dynmapAPI = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap"); DynmapAPI dynmapAPI = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap");
if (dynmapAPI != null) { if (dynmapAPI != null) {
try { try {
DynmapManager.initialize(dynmapAPI); DynmapManager.initialize(dynmapAPI);
DynmapManager.addAllPortalMarkers(); DynmapManager.addAllPortalMarkers();
} catch (NullPointerException exception) { } catch (NullPointerException ignored) {
logger.warning("Dynmap started in an invalid state. Check your log/console for dynmap-related " + logger.warning("Dynmap started in an invalid state. Check your log/console for dynmap-related " +
"problems. Dynmap integration cannot be initialized."); "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;
} }