Paper/nms-patches/ItemWorldMap.patch

36 lines
1.4 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ItemWorldMap.java
+++ b/net/minecraft/server/ItemWorldMap.java
2018-07-15 02:00:00 +02:00
@@ -6,6 +6,11 @@
2018-12-25 22:00:00 +01:00
import com.google.common.collect.Multisets;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.event.server.MapInitializeEvent;
+// CraftBukkit end
+
public class ItemWorldMap extends ItemWorldMapBase {
2018-07-15 02:00:00 +02:00
public ItemWorldMap(Item.Info item_info) {
2019-04-23 04:00:00 +02:00
@@ -38,7 +43,7 @@
2018-07-15 02:00:00 +02:00
public static int e(ItemStack itemstack) {
NBTTagCompound nbttagcompound = itemstack.getTag();
- return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : 0;
+ return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag
2016-11-17 02:41:03 +01:00
}
2018-08-26 04:00:00 +02:00
private static WorldMap a(ItemStack itemstack, World world, int i, int j, int k, boolean flag, boolean flag1, DimensionManager dimensionmanager) {
2019-04-23 04:00:00 +02:00
@@ -48,6 +53,11 @@
2018-08-26 04:00:00 +02:00
worldmap.a(i, j, k, flag, flag1, dimensionmanager);
2019-04-23 04:00:00 +02:00
world.a(worldmap);
2018-08-26 04:00:00 +02:00
itemstack.getOrCreateTag().setInt("map", l);
2015-02-26 23:41:06 +01:00
+
2018-07-15 02:00:00 +02:00
+ // CraftBukkit start
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
return worldmap;
}