mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
More work on BlueMap support
This commit is contained in:
1 parent
4cc19cb71b
commit
bdf7e9b976
4 files changed
+30
-12
No files matched your search
@@ -29,6 +29,7 @@ import me.william278.huskhomes2.config.Settings;
|
||||
import me.william278.huskhomes2.data.SQL.Database;
|
||||
import me.william278.huskhomes2.data.SQL.MySQL;
|
||||
import me.william278.huskhomes2.data.SQL.SQLite;
|
||||
import me.william278.huskhomes2.integrations.Map.BlueMap;
|
||||
import me.william278.huskhomes2.integrations.Map.DynMap;
|
||||
import me.william278.huskhomes2.integrations.Map.Map;
|
||||
import me.william278.huskhomes2.integrations.VaultIntegration;
|
||||
@@ -186,13 +187,13 @@ public final class HuskHomes extends JavaPlugin {
|
||||
// Fetch spawn location if set
|
||||
SettingHandler.fetchSpawnLocation();
|
||||
|
||||
// Setup the DynMap integration if it is enabled
|
||||
// Setup the map integration with the correct plugin
|
||||
if (HuskHomes.getSettings().doMapIntegration()) {
|
||||
String mapPlugin = HuskHomes.getSettings().getMapPlugin();
|
||||
if (mapPlugin.equalsIgnoreCase("dynmap")) {
|
||||
map = new DynMap();
|
||||
} else if (mapPlugin.equalsIgnoreCase("bluemap")) {
|
||||
//map = new BlueMap();
|
||||
map = new BlueMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,21 +146,34 @@ public class Settings {
|
||||
|
||||
if (this.doMapIntegration) {
|
||||
if (mapPlugin != null) {
|
||||
PluginManager pluginManager = HuskHomes.getInstance().getServer().getPluginManager();
|
||||
switch (mapPlugin.toLowerCase(Locale.ROOT)) {
|
||||
case "dynmap":
|
||||
PluginManager pluginManager = HuskHomes.getInstance().getServer().getPluginManager();
|
||||
Plugin dynMap = pluginManager.getPlugin("dynmap");
|
||||
if (dynMap == null) {
|
||||
Bukkit.getLogger().warning("Dynmap integration was enabled in config, but the Dynmap plugin could not be found!");
|
||||
Bukkit.getLogger().warning("The Dynmap setting has been disabled. Please ensure Dynmap is installed and restart the server.");
|
||||
Bukkit.getLogger().warning("The map integration setting has been disabled. Please ensure BlueMap is installed and restart the server.");
|
||||
this.doMapIntegration = false;
|
||||
plugin.getConfig().set("map_integration.enabled", false);
|
||||
plugin.saveConfig();
|
||||
}
|
||||
break;
|
||||
case "bluemap":
|
||||
Plugin blueMap = pluginManager.getPlugin("BlueMap");
|
||||
if (blueMap == null) {
|
||||
Bukkit.getLogger().warning("BlueMap integration was enabled in config, but the BlueMap plugin could not be found!");
|
||||
Bukkit.getLogger().warning("The map integration setting has been disabled. Please ensure BlueMap is installed and restart the server.");
|
||||
this.doMapIntegration = false;
|
||||
plugin.getConfig().set("map_integration.enabled", false);
|
||||
plugin.saveConfig();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Bukkit.getLogger().warning("Map integration was enabled in config, but the map plugin type was invalid.");
|
||||
Bukkit.getLogger().warning("The map integration setting has been disabled. Please ensure you specify a valid map plugin type.");
|
||||
this.doMapIntegration = false;
|
||||
plugin.getConfig().set("map_integration.enabled", false);
|
||||
plugin.saveConfig();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class DynMap extends Map {
|
||||
|
||||
@Override
|
||||
public void removeWarpMarker(String warpName) {
|
||||
String markerId = "huskhomes." + warpName;
|
||||
String markerId = WARPS_MARKER_SET_ID + "." + warpName;
|
||||
DynmapAPI dynmapAPI = (DynmapAPI) dynMap;
|
||||
|
||||
MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet("huskhomes.warps");
|
||||
@@ -34,7 +34,7 @@ public class DynMap extends Map {
|
||||
|
||||
@Override
|
||||
public void removePublicHomeMarker(String homeName, String ownerName) {
|
||||
String markerId = "huskhomes." + ownerName + "." + homeName;
|
||||
String markerId = PUBLIC_HOMES_MARKER_SET_ID + "." + ownerName + "." + homeName;
|
||||
DynmapAPI dynmapAPI = (DynmapAPI) dynMap;
|
||||
|
||||
MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet("huskhomes.public_homes");
|
||||
@@ -48,10 +48,10 @@ public class DynMap extends Map {
|
||||
@Override
|
||||
public void addWarpMarker(Warp warp) {
|
||||
try {
|
||||
String markerId = "huskhomes." + warp.getName();
|
||||
String markerId = WARPS_MARKER_SET_ID + "." + warp.getName();
|
||||
DynmapAPI dynmapAPI = (DynmapAPI) dynMap;
|
||||
|
||||
MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet("huskhomes.warps");
|
||||
MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet(WARPS_MARKER_SET_ID);
|
||||
Marker m = markerSet.createMarker(markerId, warp.getName(), warp.getWorldName(), warp.getX(), warp.getY(), warp.getZ(), dynmapAPI.getMarkerAPI().getMarkerIcon(HuskHomes.getSettings().getMapWarpMarkerIconID()), false);
|
||||
|
||||
m.setDescription(getWarpInfoMenu(warp));
|
||||
@@ -64,10 +64,10 @@ public class DynMap extends Map {
|
||||
@Override
|
||||
public void addPublicHomeMarker(Home home) {
|
||||
try {
|
||||
String markerId = "huskhomes." + home.getOwnerUsername() + "." + home.getName();
|
||||
String markerId = PUBLIC_HOMES_MARKER_SET_ID + "." + home.getOwnerUsername() + "." + home.getName();
|
||||
DynmapAPI dynmapAPI = (DynmapAPI) dynMap;
|
||||
|
||||
MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet("huskhomes.public_homes");
|
||||
MarkerSet markerSet = dynmapAPI.getMarkerAPI().getMarkerSet(PUBLIC_HOMES_MARKER_SET_ID);
|
||||
Marker m = markerSet.createMarker(markerId, home.getName(), home.getWorldName(), home.getX(), home.getY(), home.getZ(), dynmapAPI.getMarkerAPI().getMarkerIcon(HuskHomes.getSettings().getMapPublicHomeMarkerIconID()), false);
|
||||
|
||||
m.setDescription(getPublicHomeInfoMenu(home));
|
||||
@@ -91,7 +91,7 @@ public class DynMap extends Map {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
if (HuskHomes.getSettings().showPublicHomesOnMap()) {
|
||||
dynmapAPI.getMarkerAPI().createMarkerSet("huskhomes.public_homes", HuskHomes.getSettings().getMapPublicHomeMarkerSet(), dynmapAPI.getMarkerAPI().getMarkerIcons(), false);
|
||||
dynmapAPI.getMarkerAPI().createMarkerSet(PUBLIC_HOMES_MARKER_SET_ID, HuskHomes.getSettings().getMapPublicHomeMarkerSet(), dynmapAPI.getMarkerAPI().getMarkerIcons(), false);
|
||||
for (Home home : DataManager.getPublicHomes(connection)) {
|
||||
if (!HuskHomes.getSettings().doBungee() || home.getServer().equals(HuskHomes.getSettings().getServerID())) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> addPublicHomeMarker(home));
|
||||
@@ -99,7 +99,7 @@ public class DynMap extends Map {
|
||||
}
|
||||
}
|
||||
if (HuskHomes.getSettings().showWarpsOnMap()) {
|
||||
dynmapAPI.getMarkerAPI().createMarkerSet("huskhomes.warps", HuskHomes.getSettings().getMapWarpMarkerSet(), dynmapAPI.getMarkerAPI().getMarkerIcons(), false);
|
||||
dynmapAPI.getMarkerAPI().createMarkerSet(WARPS_MARKER_SET_ID, HuskHomes.getSettings().getMapWarpMarkerSet(), dynmapAPI.getMarkerAPI().getMarkerIcons(), false);
|
||||
for (Warp warp : DataManager.getWarps(connection)) {
|
||||
if (!HuskHomes.getSettings().doBungee() || warp.getServer().equals(HuskHomes.getSettings().getServerID())) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> addWarpMarker(warp));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.william278.huskhomes2.integrations.Map;
|
||||
|
||||
import me.william278.huskhomes2.HuskHomes;
|
||||
import me.william278.huskhomes2.teleport.points.Home;
|
||||
import me.william278.huskhomes2.teleport.points.Warp;
|
||||
|
||||
@@ -9,6 +10,9 @@ public abstract class Map {
|
||||
|
||||
public Map() { }
|
||||
|
||||
public static final String PUBLIC_HOMES_MARKER_SET_ID = "huskhomes.public_homes";
|
||||
public static final String WARPS_MARKER_SET_ID = "huskhomes.warps";
|
||||
|
||||
public abstract void addWarpMarker(Warp warp);
|
||||
public abstract void removeWarpMarker(String warpName);
|
||||
|
||||
|
||||
Reference in new issue
Block a user