3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-29 09:30:07 +01:00
Paper/nms-patches/ItemWorldMap.patch
2020-06-25 10:00:00 +10:00

36 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/ItemWorldMap.java
+++ b/net/minecraft/server/ItemWorldMap.java
@@ -6,6 +6,11 @@
import com.google.common.collect.Multisets;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.event.server.MapInitializeEvent;
+// CraftBukkit end
+
public class ItemWorldMap extends ItemWorldMapBase {
public ItemWorldMap(Item.Info item_info) {
@@ -38,7 +43,7 @@
public static int d(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
}
private static WorldMap a(ItemStack itemstack, World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
@@ -48,6 +53,11 @@
worldmap.a(i, j, k, flag, flag1, resourcekey);
world.a(worldmap);
itemstack.getOrCreateTag().setInt("map", l);
+
+ // CraftBukkit start
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
return worldmap;
}