fix: suppress map cursor paper exception

dependabot/gradle/org.junit.jupiter-junit-jupiter-engine-5.11.0 3.6.8
William 7 months ago
parent 0f7a866652
commit 52ec138273
No known key found for this signature in database

@ -424,19 +424,23 @@ public interface BukkitMapPersister {
@NotNull @NotNull
private MapData extractMapData() { private MapData extractMapData() {
final List<MapBanner> banners = Lists.newArrayList(); final List<MapBanner> banners = Lists.newArrayList();
final String BANNER_PREFIX = "banner_"; try {
for (int i = 0; i < getCursors().size(); i++) { final String BANNER_PREFIX = "banner_";
final MapCursor cursor = getCursors().getCursor(i); for (int i = 0; i < getCursors().size(); i++) {
final String type = cursor.getType().name().toLowerCase(Locale.ENGLISH); final MapCursor cursor = getCursors().getCursor(i);
if (type.startsWith(BANNER_PREFIX)) { final String type = cursor.getType().name().toLowerCase(Locale.ENGLISH);
banners.add(new MapBanner( if (type.startsWith(BANNER_PREFIX)) {
type.replaceAll(BANNER_PREFIX, ""), banners.add(new MapBanner(
cursor.getCaption() == null ? "" : cursor.getCaption(), type.replaceAll(BANNER_PREFIX, ""),
cursor.getX(), cursor.getCaption() == null ? "" : cursor.getCaption(),
mapView.getWorld() != null ? mapView.getWorld().getSeaLevel() : 128, cursor.getX(),
cursor.getY() mapView.getWorld() != null ? mapView.getWorld().getSeaLevel() : 128,
)); cursor.getY()
));
}
} }
} catch (Throwable ignored) {
} }
return MapData.fromPixels(pixels, getDimension(), (byte) 2, banners, List.of()); return MapData.fromPixels(pixels, getDimension(), (byte) 2, banners, List.of());
} }

Loading…
Cancel
Save