diff --git a/common/build.gradle b/common/build.gradle index 4693edb6..336aa49d 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -26,7 +26,7 @@ dependencies { compileOnly 'com.github.plan-player-analytics:Plan:5.5.2391' compileOnly 'com.github.BlueMap-Minecraft:BlueMapAPI:2.6.0' compileOnly 'us.dynmap:DynmapCoreAPI:3.4' - compileOnly 'maven.modrinth:pl3xmap:1.20.2-475' + compileOnly 'maven.modrinth:pl3xmap:1.20.4-489' compileOnly 'org.projectlombok:lombok:1.18.32' testImplementation 'com.github.plan-player-analytics:Plan:5.5.2391' diff --git a/common/src/main/java/net/william278/huskhomes/hook/MapHook.java b/common/src/main/java/net/william278/huskhomes/hook/MapHook.java index 0aba2766..139c76d4 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/MapHook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/MapHook.java @@ -176,37 +176,43 @@ private MarkerInformationPopup(@NotNull String title) { } @NotNull - protected static DynmapHook.MarkerInformationPopup warp(@NotNull Warp warp, @NotNull String thumbnail) { - return MarkerInformationPopup.create(warp.getName()) + protected static MarkerInformationPopup warp(@NotNull Warp warp, @NotNull String thumbnail) { + final MarkerInformationPopup popup = MarkerInformationPopup.create(warp.getName()) .thumbnail(thumbnail) - .field("Description", warp.getMeta().getDescription()) .field("Location", warp.toString()) .field("Command", "/warp " + warp.getSafeIdentifier()); + if (!warp.getMeta().getDescription().isBlank()) { + popup.field("Description", warp.getMeta().getDescription()); + } + return popup; } @NotNull - protected static DynmapHook.MarkerInformationPopup publicHome(@NotNull Home home, @NotNull String thumbnail) { - return MarkerInformationPopup.create(home.getName()) + protected static MarkerInformationPopup publicHome(@NotNull Home home, @NotNull String thumbnail) { + final MarkerInformationPopup popup = MarkerInformationPopup.create(home.getName()) .thumbnail(thumbnail) .field("Owner", home.getOwner().getUsername()) - .field("Description", home.getMeta().getDescription()) .field("Location", home.toString()) .field("Command", "/phome " + home.getSafeIdentifier()); + if (!home.getMeta().getDescription().isBlank()) { + popup.field("Description", home.getMeta().getDescription()); + } + return popup; } @NotNull - protected static DynmapHook.MarkerInformationPopup create(@NotNull String title) { + protected static MarkerInformationPopup create(@NotNull String title) { return new MarkerInformationPopup(title); } @NotNull - protected DynmapHook.MarkerInformationPopup thumbnail(@NotNull String thumbnail) { + protected MarkerInformationPopup thumbnail(@NotNull String thumbnail) { this.thumbnail = thumbnail; return this; } @NotNull - protected DynmapHook.MarkerInformationPopup field(@NotNull String key, @NotNull String value) { + protected MarkerInformationPopup field(@NotNull String key, @NotNull String value) { fields.put(key, value); return this; } diff --git a/common/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java b/common/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java index dfe62029..33af5fc8 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java @@ -22,6 +22,7 @@ import net.pl3x.map.core.Pl3xMap; import net.pl3x.map.core.event.EventHandler; import net.pl3x.map.core.event.EventListener; +import net.pl3x.map.core.event.server.Pl3xMapDisabledEvent; import net.pl3x.map.core.event.server.Pl3xMapEnabledEvent; import net.pl3x.map.core.event.world.WorldLoadedEvent; import net.pl3x.map.core.event.world.WorldUnloadedEvent; @@ -51,6 +52,7 @@ import java.util.logging.Level; import java.util.stream.Collectors; +@SuppressWarnings("unused") public class Pl3xMapHook extends MapHook implements EventListener { private static final String ICON_PATH = "/images/icon/registered/"; @@ -66,6 +68,9 @@ public Pl3xMapHook(@NotNull HuskHomes plugin) { @Override public void initialize() { Pl3xMap.api().getEventRegistry().register(this); + if (Pl3xMap.api().isEnabled()) { + onPl3xMapEnabled(new Pl3xMapEnabledEvent()); + } } @Override @@ -159,6 +164,14 @@ public void onPl3xMapEnabled(@NotNull Pl3xMapEnabledEvent event) { }); } + @EventHandler + public void onPl3xMapDisabled(@NotNull Pl3xMapDisabledEvent event) { + Pl3xMap.api().getWorldRegistry().forEach(world -> { + world.getLayerRegistry().unregister(WARPS_LAYER); + world.getLayerRegistry().unregister(PUBLIC_HOMES_LAYER); + }); + } + @EventHandler public void onWorldLoaded(@NotNull WorldLoadedEvent event) { registerLayers(event.getWorld()); diff --git a/paper/build.gradle b/paper/build.gradle index bdf34be4..251868ab 100644 --- a/paper/build.gradle +++ b/paper/build.gradle @@ -48,5 +48,15 @@ shadowJar { tasks { runServer { minecraftVersion('1.20.4') + + downloadPlugins { + url("https://download.luckperms.net/1526/bukkit/loader/LuckPerms-Bukkit-5.4.113.jar") + url("https://ci.lucko.me/job/spark/399/artifact/spark-bukkit/build/libs/spark-1.10.58-bukkit.jar") + hangar("Plan-Player-Analytics", "5.6+build.2614") + +// modrinth("dynmap", "5F9fwzR1") + modrinth("pl3xmap", "1.20.4-489") +// modrinth("bluemap", "3.20-paper") + } } } \ No newline at end of file