9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-19 14:59:21 +00:00

fix: ensure map view for ID is set when applying, close #498

This commit is contained in:
William278
2025-05-10 23:45:05 +01:00
parent 5cea4665a1
commit f6d860335f

View File

@@ -266,10 +266,15 @@ public interface BukkitMapHandler {
int newId = currentServerName.equals(originServerName) int newId = currentServerName.equals(originServerName)
? originalMapId : getBoundMapId(originServerName, originalMapId, currentServerName); ? originalMapId : getBoundMapId(originServerName, originalMapId, currentServerName);
if (newId != -1) { if (newId != -1) {
meta.setMapId(newId); final MapView view = Bukkit.getMap(newId);
map.setItemMeta(meta); if (view != null) {
getPlugin().debug(String.format("Map ID set to %s", newId)); meta.setMapView(view);
return; meta.setMapId(newId);
map.setItemMeta(meta);
getPlugin().debug(String.format("Map ID set to #%s", newId));
return;
}
getPlugin().debug(String.format("Map ID #%s not saved on this server, creating...", newId));
} }
// Read the pixel data from the ItemStack and generate a map view otherwise // Read the pixel data from the ItemStack and generate a map view otherwise
@@ -293,6 +298,7 @@ public interface BukkitMapHandler {
final int id = view.getId(); final int id = view.getId();
getRedisManager().bindMapIds(originServerName, originalMapId, currentServerName, id); getRedisManager().bindMapIds(originServerName, originalMapId, currentServerName, id);
getPlugin().getDatabase().setMapBinding(originServerName, originalMapId, currentServerName, id); getPlugin().getDatabase().setMapBinding(originServerName, originalMapId, currentServerName, id);
meta.setMapId(id);
getPlugin().debug(String.format("Bound map to view (#%s) on server %s", id, currentServerName)); getPlugin().debug(String.format("Bound map to view (#%s) on server %s", id, currentServerName));
}); });