mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-13 11:02:06 +01:00
SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
By: md_5 <git@md-5.net>
This commit is contained in:
parent
e3eb82a356
commit
aacf3bd308
@ -504,15 +504,31 @@
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||||
@@ -1277,6 +1471,7 @@
|
@@ -1272,11 +1466,22 @@
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public WorldMap getMapData(String s) {
|
||||||
|
- return (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), s);
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ WorldMap worldmap = (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), s);
|
||||||
|
+ if (worldmap != null) {
|
||||||
|
+ worldmap.id = s;
|
||||||
|
+ }
|
||||||
|
+ return worldmap;
|
||||||
|
+ // CraftBukkit end
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMapData(String s, WorldMap worldmap) {
|
public void setMapData(String s, WorldMap worldmap) {
|
||||||
+ worldmap.id = s; // CraftBukkit
|
+ // CraftBukkit start
|
||||||
|
+ worldmap.id = s;
|
||||||
|
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
|
||||||
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
+ // CraftBukkit end
|
||||||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1574,6 +1769,11 @@
|
@@ -1574,6 +1779,11 @@
|
||||||
@Override
|
@Override
|
||||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||||
if (!this.isDebug()) {
|
if (!this.isDebug()) {
|
||||||
@ -524,7 +540,7 @@
|
|||||||
this.updateNeighborsAt(blockposition, block);
|
this.updateNeighborsAt(blockposition, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1593,12 +1793,12 @@
|
@@ -1593,12 +1803,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFlat() {
|
public boolean isFlat() {
|
||||||
@ -539,7 +555,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -1621,7 +1821,7 @@
|
@@ -1621,7 +1831,7 @@
|
||||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||||
try {
|
try {
|
||||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||||
@ -548,7 +564,7 @@
|
|||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
T t0 = iterator.next();
|
T t0 = iterator.next();
|
||||||
@@ -1630,7 +1830,7 @@
|
@@ -1630,7 +1840,7 @@
|
||||||
object2intopenhashmap.addTo(s, 1);
|
object2intopenhashmap.addTo(s, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,7 +573,7 @@
|
|||||||
String s1 = (String) entry.getKey();
|
String s1 = (String) entry.getKey();
|
||||||
|
|
||||||
return s1 + ":" + entry.getIntValue();
|
return s1 + ":" + entry.getIntValue();
|
||||||
@@ -1641,17 +1841,33 @@
|
@@ -1641,17 +1851,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||||
@ -593,7 +609,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1785,6 +2001,8 @@
|
@@ -1785,6 +2011,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||||
@ -602,7 +618,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onTrackingEnd(Entity entity) {
|
public void onTrackingEnd(Entity entity) {
|
||||||
@@ -1821,6 +2039,14 @@
|
@@ -1821,6 +2049,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||||
|
@ -1,18 +1,6 @@
|
|||||||
--- a/net/minecraft/world/item/ItemWorldMap.java
|
--- a/net/minecraft/world/item/ItemWorldMap.java
|
||||||
+++ b/net/minecraft/world/item/ItemWorldMap.java
|
+++ b/net/minecraft/world/item/ItemWorldMap.java
|
||||||
@@ -33,6 +33,11 @@
|
@@ -69,7 +69,7 @@
|
||||||
import net.minecraft.world.level.material.MaterialMapColor;
|
|
||||||
import net.minecraft.world.level.saveddata.maps.WorldMap;
|
|
||||||
|
|
||||||
+// CraftBukkit start
|
|
||||||
+import org.bukkit.Bukkit;
|
|
||||||
+import org.bukkit.event.server.MapInitializeEvent;
|
|
||||||
+// CraftBukkit end
|
|
||||||
+
|
|
||||||
public class ItemWorldMap extends ItemWorldMapBase {
|
|
||||||
|
|
||||||
public static final int IMAGE_WIDTH = 128;
|
|
||||||
@@ -69,7 +74,7 @@
|
|
||||||
public static Integer getMapId(ItemStack itemstack) {
|
public static Integer getMapId(ItemStack itemstack) {
|
||||||
NBTTagCompound nbttagcompound = itemstack.getTag();
|
NBTTagCompound nbttagcompound = itemstack.getTag();
|
||||||
|
|
||||||
@ -21,14 +9,3 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
|
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
|
||||||
@@ -77,6 +82,10 @@
|
|
||||||
int l = world.getFreeMapId();
|
|
||||||
|
|
||||||
world.setMapData(makeKey(l), worldmap);
|
|
||||||
+ // CraftBukkit start
|
|
||||||
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
|
|
||||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
+ // CraftBukkit end
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user