mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Refresh markers from data folder on restart
This commit is contained in:
1 parent
9d57b76c79
commit
757523fe18
2 files changed
+12
-7
No files matched your search
@@ -8,6 +8,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.dynmap.DynmapAPI;
|
||||
import org.dynmap.markers.Marker;
|
||||
import org.dynmap.markers.MarkerIcon;
|
||||
import org.dynmap.markers.MarkerSet;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -20,6 +21,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class DynMap extends Map {
|
||||
@@ -105,13 +107,18 @@ public class DynMap extends Map {
|
||||
@Override
|
||||
public void initialize() {
|
||||
dynMap = plugin.getServer().getPluginManager().getPlugin("dynmap");
|
||||
|
||||
DynmapAPI dynmapAPI = (DynmapAPI) dynMap;
|
||||
|
||||
if (dynmapAPI == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Set<MarkerIcon> markerIconSet = dynmapAPI.getMarkerAPI().getMarkerIcons();
|
||||
for (MarkerIcon icon : markerIconSet) {
|
||||
if (icon.getMarkerIconID().equals(WARP_MARKER_IMAGE_NAME) || icon.getMarkerIconID().equalsIgnoreCase(PUBLIC_HOME_MARKER_IMAGE_NAME)) {
|
||||
dynmapAPI.getMarkerAPI().getMarkerIcons().remove(icon);
|
||||
}
|
||||
}
|
||||
dynmapAPI.getMarkerAPI().createMarkerIcon(WARP_MARKER_IMAGE_NAME, "Warp", getScaledMarkerIconStream(getWarpIcon()));
|
||||
dynmapAPI.getMarkerAPI().createMarkerIcon(PUBLIC_HOME_MARKER_IMAGE_NAME, "Public Home", getScaledMarkerIconStream(getPublicHomeIcon()));
|
||||
|
||||
|
||||
@@ -100,12 +100,10 @@ public class Pl3xMap extends Map {
|
||||
net.pl3x.map.api.Pl3xMap mapAPI = Pl3xMapProvider.get();
|
||||
|
||||
// Register map icons
|
||||
if (!Pl3xMapProvider.get().iconRegistry().hasEntry(Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME))) {
|
||||
Pl3xMapProvider.get().iconRegistry().register(Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME), getPublicHomeIcon());
|
||||
}
|
||||
if (!Pl3xMapProvider.get().iconRegistry().hasEntry(Key.of(WARP_MARKER_IMAGE_NAME))) {
|
||||
Pl3xMapProvider.get().iconRegistry().register(Key.of(WARP_MARKER_IMAGE_NAME), getWarpIcon());
|
||||
}
|
||||
Pl3xMapProvider.get().iconRegistry().unregister(Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME));
|
||||
Pl3xMapProvider.get().iconRegistry().register(Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME), getPublicHomeIcon());
|
||||
Pl3xMapProvider.get().iconRegistry().unregister(Key.of(WARP_MARKER_IMAGE_NAME));
|
||||
Pl3xMapProvider.get().iconRegistry().register(Key.of(WARP_MARKER_IMAGE_NAME), getWarpIcon());
|
||||
|
||||
for (net.pl3x.map.api.MapWorld world : mapAPI.mapWorlds()) {
|
||||
// Register public home map layer
|
||||
|
||||
Reference in new issue
Block a user