From 1c7698fab2c35d18c0edb16ff325d30ddab1f8e9 Mon Sep 17 00:00:00 2001 From: feildmaster Date: Wed, 30 Oct 2013 13:23:24 -0500 Subject: Ensure maps are stored only in the main world. Fixes BUKKIT-4872 --- src/main/java/net/minecraft/server/ItemWorldMap.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/net/minecraft/server/ItemWorldMap.java') diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java index be1b13a6..3866c1bb 100644 --- a/src/main/java/net/minecraft/server/ItemWorldMap.java +++ b/src/main/java/net/minecraft/server/ItemWorldMap.java @@ -13,11 +13,12 @@ public class ItemWorldMap extends ItemWorldMapBase { } public WorldMap getSavedMap(ItemStack itemstack, World world) { + World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world String s = "map_" + itemstack.getData(); - WorldMap worldmap = (WorldMap) world.getServer().getServer().worlds.get(0).a(WorldMap.class, s); // CraftBukkit - use primary world for maps + WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps if (worldmap == null && !world.isStatic) { - itemstack.setData(world.b("map")); + itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps s = "map_" + itemstack.getData(); worldmap = new WorldMap(s); worldmap.scale = 3; @@ -27,7 +28,7 @@ public class ItemWorldMap extends ItemWorldMapBase { worldmap.centerZ = Math.round((float) (world.getWorldData().e() / i)) * i; worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps worldmap.c(); - world.a(s, (WorldMapBase) worldmap); + worldMain.a(s, (WorldMapBase) worldmap); // CraftBukkit - use primary world for maps // CraftBukkit start MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView); @@ -237,6 +238,8 @@ public class ItemWorldMap extends ItemWorldMapBase { if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) { WorldMap worldmap = Item.MAP.getSavedMap(itemstack, world); + world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps + itemstack.setData(world.b("map")); WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData()); -- cgit v1.2.3