mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 05:30:23 -07:00
Fix NPE in Server#getMap before worlds are loaded (#12492)
This commit is contained in:
parent
d1810f241c
commit
02d20ff7eb
@ -830,9 +830,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param id the id of the map to get
|
||||
* @return a map view if it exists, or null otherwise
|
||||
*/
|
||||
// @Deprecated(since = "1.6.2") // Paper - Not a magic value
|
||||
@Nullable
|
||||
public MapView getMap(int id);
|
||||
MapView getMap(int id);
|
||||
|
||||
/**
|
||||
* Create a new map with an automatically assigned ID.
|
||||
|
@ -1944,12 +1944,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public CraftMapView getMap(int id) {
|
||||
MapItemSavedData mapData = this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD).getMapData(new MapId(id));
|
||||
if (mapData == null) {
|
||||
return null;
|
||||
}
|
||||
final net.minecraft.world.level.Level overworld = this.console.overworld();
|
||||
if (overworld == null) return null;
|
||||
|
||||
final MapItemSavedData mapData = overworld.getMapData(new MapId(id));
|
||||
if (mapData == null) return null;
|
||||
|
||||
return mapData.mapView;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user