mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Fix Pl3xMap not loading icons on multiversed worlds
Fix force-teleport on spawn not working on servers without bungee mode enabled Increment version number
This commit is contained in:
1 parent
4b7dd06d26
commit
5f07f9022b
6 files changed
+95
-49
No files matched your search
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.William278</groupId>
|
<groupId>me.William278</groupId>
|
||||||
<artifactId>HuskHomes</artifactId>
|
<artifactId>HuskHomes</artifactId>
|
||||||
<version>2.9.1</version>
|
<version>2.9.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HuskHomes</name>
|
<name>HuskHomes</name>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class Settings {
|
|||||||
private String redisHost;
|
private String redisHost;
|
||||||
private String redisPassword;
|
private String redisPassword;
|
||||||
|
|
||||||
// Dynmap integration settings
|
// Map plugin integration settings
|
||||||
private boolean doMapIntegration;
|
private boolean doMapIntegration;
|
||||||
private String mapPlugin;
|
private String mapPlugin;
|
||||||
private boolean mapPublicHomes;
|
private boolean mapPublicHomes;
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ public class BlueMap extends Map {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
plugin.getLogger().info("Initializing BlueMap integration");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||||
try (Connection connection = HuskHomes.getConnection()) {
|
try (Connection connection = HuskHomes.getConnection()) {
|
||||||
for (Home home : DataManager.getPublicHomes(connection)) {
|
for (Home home : DataManager.getPublicHomes(connection)) {
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ public class DynMap extends Map {
|
|||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
dynMap = plugin.getServer().getPluginManager().getPlugin("dynmap");
|
dynMap = plugin.getServer().getPluginManager().getPlugin("dynmap");
|
||||||
|
plugin.getLogger().info("Initializing Dynmap integration");
|
||||||
DynmapAPI dynmapAPI = (DynmapAPI) dynMap;
|
DynmapAPI dynmapAPI = (DynmapAPI) dynMap;
|
||||||
|
|
||||||
if (dynmapAPI == null) {
|
if (dynmapAPI == null) {
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ import me.william278.huskhomes2.HuskHomes;
|
|||||||
import me.william278.huskhomes2.data.DataManager;
|
import me.william278.huskhomes2.data.DataManager;
|
||||||
import me.william278.huskhomes2.teleport.points.Home;
|
import me.william278.huskhomes2.teleport.points.Home;
|
||||||
import me.william278.huskhomes2.teleport.points.Warp;
|
import me.william278.huskhomes2.teleport.points.Warp;
|
||||||
import net.pl3x.map.api.Key;
|
import net.pl3x.map.api.*;
|
||||||
import net.pl3x.map.api.Pl3xMapProvider;
|
|
||||||
import net.pl3x.map.api.Point;
|
|
||||||
import net.pl3x.map.api.SimpleLayerProvider;
|
|
||||||
import net.pl3x.map.api.marker.Icon;
|
import net.pl3x.map.api.marker.Icon;
|
||||||
import net.pl3x.map.api.marker.Marker;
|
import net.pl3x.map.api.marker.Marker;
|
||||||
import net.pl3x.map.api.marker.MarkerOptions;
|
import net.pl3x.map.api.marker.MarkerOptions;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.world.WorldLoadEvent;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -46,18 +46,8 @@ public class Pl3xMap extends Map {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeWarpMarker(String warpName) {
|
public void removeWarpMarker(String warpName) {
|
||||||
String warpMarkerWorld = null;
|
|
||||||
final Key warpMarkerKey = Key.of(getWarpMarkerName(warpName));
|
final Key warpMarkerKey = Key.of(getWarpMarkerName(warpName));
|
||||||
for (String worldName : warpProviders.keySet()) {
|
removeMarker(warpMarkerKey, warpProviders);
|
||||||
SimpleLayerProvider warpProvider = warpProviders.get(worldName);
|
|
||||||
if (warpProvider.hasMarker(warpMarkerKey)) {
|
|
||||||
warpMarkerWorld = worldName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (warpMarkerWorld != null) {
|
|
||||||
warpProviders.get(warpMarkerWorld).removeMarker(warpMarkerKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -81,23 +71,15 @@ public class Pl3xMap extends Map {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePublicHomeMarker(String homeName, String ownerName) {
|
public void removePublicHomeMarker(String homeName, String ownerName) {
|
||||||
String publicHomeMarkerWorld = null;
|
|
||||||
final Key publicHomeMarkerKey = Key.of(getPublicHomeMarkerName(ownerName, homeName));
|
final Key publicHomeMarkerKey = Key.of(getPublicHomeMarkerName(ownerName, homeName));
|
||||||
for (String worldName : publicHomeProviders.keySet()) {
|
removeMarker(publicHomeMarkerKey, publicHomeProviders);
|
||||||
SimpleLayerProvider warpProvider = publicHomeProviders.get(worldName);
|
|
||||||
if (warpProvider.hasMarker(publicHomeMarkerKey)) {
|
|
||||||
publicHomeMarkerWorld = worldName;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (publicHomeMarkerWorld != null) {
|
|
||||||
publicHomeProviders.get(publicHomeMarkerWorld).removeMarker(publicHomeMarkerKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
net.pl3x.map.api.Pl3xMap mapAPI = Pl3xMapProvider.get();
|
net.pl3x.map.api.Pl3xMap mapAPI = Pl3xMapProvider.get();
|
||||||
|
plugin.getServer().getPluginManager().registerEvents(new Pl3xMapWorldLoadListener(), plugin);
|
||||||
|
plugin.getLogger().info("Initializing Pl3xMap integration");
|
||||||
|
|
||||||
final Key publicHomeMarkerIconKey = Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME);
|
final Key publicHomeMarkerIconKey = Key.of(PUBLIC_HOME_MARKER_IMAGE_NAME);
|
||||||
final Key warpMarkerIconKey = Key.of(WARP_MARKER_IMAGE_NAME);
|
final Key warpMarkerIconKey = Key.of(WARP_MARKER_IMAGE_NAME);
|
||||||
@@ -113,27 +95,7 @@ public class Pl3xMap extends Map {
|
|||||||
Pl3xMapProvider.get().iconRegistry().register(warpMarkerIconKey, getWarpIcon());
|
Pl3xMapProvider.get().iconRegistry().register(warpMarkerIconKey, getWarpIcon());
|
||||||
|
|
||||||
for (net.pl3x.map.api.MapWorld world : mapAPI.mapWorlds()) {
|
for (net.pl3x.map.api.MapWorld world : mapAPI.mapWorlds()) {
|
||||||
// Register public home map layer
|
loadWorld(world);
|
||||||
SimpleLayerProvider publicHomeProvider =
|
|
||||||
SimpleLayerProvider.builder(HuskHomes.getSettings().getMapPublicHomeMarkerSet())
|
|
||||||
.showControls(true)
|
|
||||||
.defaultHidden(false)
|
|
||||||
.layerPriority(6)
|
|
||||||
.zIndex(250)
|
|
||||||
.build();
|
|
||||||
world.layerRegistry().register(Key.of(PUBLIC_HOMES_MARKER_SET_ID), publicHomeProvider);
|
|
||||||
publicHomeProviders.put(world.name(), publicHomeProvider);
|
|
||||||
|
|
||||||
// Register warps map layer
|
|
||||||
SimpleLayerProvider warpProvider =
|
|
||||||
SimpleLayerProvider.builder(HuskHomes.getSettings().getMapWarpMarkerSet())
|
|
||||||
.showControls(true)
|
|
||||||
.defaultHidden(false)
|
|
||||||
.layerPriority(7)
|
|
||||||
.zIndex(250)
|
|
||||||
.build();
|
|
||||||
world.layerRegistry().register(Key.of(WARPS_MARKER_SET_ID), warpProvider);
|
|
||||||
warpProviders.put(world.name(), warpProvider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate map with markers
|
// Populate map with markers
|
||||||
@@ -159,4 +121,80 @@ public class Pl3xMap extends Map {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Removes a marker from the Pl3xMap Marker API
|
||||||
|
private void removeMarker(Key markerKey, HashMap<String, SimpleLayerProvider> layerProviders) {
|
||||||
|
String markerWorld = null;
|
||||||
|
for (String worldName : layerProviders.keySet()) {
|
||||||
|
SimpleLayerProvider warpProvider = layerProviders.get(worldName);
|
||||||
|
if (warpProvider.hasMarker(markerKey)) {
|
||||||
|
markerWorld = worldName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (markerWorld != null) {
|
||||||
|
layerProviders.get(markerWorld).removeMarker(markerKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loads the world
|
||||||
|
private void loadWorld(MapWorld world) {
|
||||||
|
// Register public home map layer
|
||||||
|
SimpleLayerProvider publicHomeProvider =
|
||||||
|
SimpleLayerProvider.builder(HuskHomes.getSettings().getMapPublicHomeMarkerSet())
|
||||||
|
.showControls(true)
|
||||||
|
.defaultHidden(false)
|
||||||
|
.layerPriority(6)
|
||||||
|
.zIndex(250)
|
||||||
|
.build();
|
||||||
|
world.layerRegistry().register(Key.of(PUBLIC_HOMES_MARKER_SET_ID), publicHomeProvider);
|
||||||
|
publicHomeProviders.put(world.name(), publicHomeProvider);
|
||||||
|
|
||||||
|
// Register warps map layer
|
||||||
|
SimpleLayerProvider warpProvider =
|
||||||
|
SimpleLayerProvider.builder(HuskHomes.getSettings().getMapWarpMarkerSet())
|
||||||
|
.showControls(true)
|
||||||
|
.defaultHidden(false)
|
||||||
|
.layerPriority(7)
|
||||||
|
.zIndex(250)
|
||||||
|
.build();
|
||||||
|
world.layerRegistry().register(Key.of(WARPS_MARKER_SET_ID), warpProvider);
|
||||||
|
warpProviders.put(world.name(), warpProvider);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Pl3xMapWorldLoadListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onWorldLoad(WorldLoadEvent e) {
|
||||||
|
net.pl3x.map.api.Pl3xMap mapAPI = Pl3xMapProvider.get();
|
||||||
|
mapAPI.getWorldIfEnabled(e.getWorld()).ifPresent(Pl3xMap.this::loadWorld);
|
||||||
|
// Populate map with markers
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||||
|
try (Connection connection = HuskHomes.getConnection()) {
|
||||||
|
if (HuskHomes.getSettings().showPublicHomesOnMap()) {
|
||||||
|
for (Home home : DataManager.getPublicHomes(connection)) {
|
||||||
|
if (home.getWorldName().equals(e.getWorld().getName())) {
|
||||||
|
if (!HuskHomes.getSettings().doBungee() || home.getServer().equals(HuskHomes.getSettings().getServerID())) {
|
||||||
|
Bukkit.getScheduler().runTask(plugin, () -> addPublicHomeMarker(home));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (HuskHomes.getSettings().showWarpsOnMap()) {
|
||||||
|
for (Warp warp : DataManager.getWarps(connection)) {
|
||||||
|
if (warp.getWorldName().equals(e.getWorld().getName())) {
|
||||||
|
if (!HuskHomes.getSettings().doBungee() || warp.getServer().equals(HuskHomes.getSettings().getServerID())) {
|
||||||
|
Bukkit.getScheduler().runTask(plugin, () -> addWarpMarker(warp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
plugin.getLogger().log(Level.WARNING, "An SQL exception occurred adding homes and warps to the Pl3xMap");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -84,6 +84,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (HuskHomes.getSettings().doForceSpawnOnLogin()) {
|
||||||
|
if (TeleportManager.getSpawnLocation() != null) {
|
||||||
|
Bukkit.getScheduler().runTask(plugin, () -> PaperLib.teleportAsync(p, TeleportManager.getSpawnLocation().getLocation()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException sqlException) {
|
} catch (SQLException sqlException) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "An SQL error handling a joining player", sqlException);
|
plugin.getLogger().log(Level.SEVERE, "An SQL error handling a joining player", sqlException);
|
||||||
|
|||||||
Reference in new issue
Block a user