Adventure
== AT == public net.minecraft.network.chat.HoverEvent$ItemStackInfo item public net.minecraft.network.chat.HoverEvent$ItemStackInfo count public net.minecraft.network.chat.HoverEvent$ItemStackInfo components public net.minecraft.network.chat.contents.TranslatableContents filterAllowedArguments(Ljava/lang/Object;)Lcom/mojang/serialization/DataResult; Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
@@ -109,22 +109,22 @@
|
||||
- return text;
|
||||
+ // CraftBukkit start
|
||||
+ Player player = ((ServerPlayer) entityhuman).getBukkitEntity();
|
||||
+ String[] lines = new String[4];
|
||||
+ List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>(); // Paper - adventure
|
||||
+
|
||||
+ for (int i = 0; i < list.size(); ++i) {
|
||||
+ lines[i] = CraftChatMessage.fromComponent(signtext.getMessage(i, entityhuman.isTextFilteringEnabled()));
|
||||
+ lines.add(io.papermc.paper.adventure.PaperAdventure.asAdventure(signtext.getMessage(i, entityhuman.isTextFilteringEnabled()))); // Paper - Adventure
|
||||
+ }
|
||||
+
|
||||
+ SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, lines.clone(), (front) ? Side.FRONT : Side.BACK);
|
||||
+ SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, new java.util.ArrayList<>(lines), (front) ? Side.FRONT : Side.BACK); // Paper - Adventure
|
||||
+ entityhuman.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return originalText;
|
||||
+ }
|
||||
+
|
||||
+ Component[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines());
|
||||
+ Component[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.lines()); // Paper - Adventure
|
||||
+ for (int i = 0; i < components.length; i++) {
|
||||
+ if (!Objects.equals(lines[i], event.getLine(i))) {
|
||||
+ if (!Objects.equals(lines.get(i), event.line(i))) { // Paper - Adventure
|
||||
+ signtext = signtext.setMessage(i, components[i]);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
+++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
@@ -47,6 +47,16 @@
|
||||
@@ -47,6 +47,17 @@
|
||||
import net.minecraft.world.level.saveddata.SavedData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import io.papermc.paper.adventure.PaperAdventure; // Paper
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
@@ -17,7 +18,7 @@
|
||||
public class MapItemSavedData extends SavedData {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -70,6 +80,13 @@
|
||||
@@ -70,6 +81,13 @@
|
||||
private final Map<String, MapFrame> frameMarkers = Maps.newHashMap();
|
||||
private int trackedDecorationCount;
|
||||
|
||||
@@ -31,7 +32,7 @@
|
||||
public static SavedData.Factory<MapItemSavedData> factory() {
|
||||
return new SavedData.Factory<>(() -> {
|
||||
throw new IllegalStateException("Should never create an empty map saved data");
|
||||
@@ -84,6 +101,10 @@
|
||||
@@ -84,6 +102,10 @@
|
||||
this.trackingPosition = showDecorations;
|
||||
this.unlimitedTracking = unlimitedTracking;
|
||||
this.locked = locked;
|
||||
@@ -42,7 +43,7 @@
|
||||
}
|
||||
|
||||
public static MapItemSavedData createFresh(double centerX, double centerZ, byte scale, boolean showDecorations, boolean unlimitedTracking, ResourceKey<Level> dimension) {
|
||||
@@ -101,12 +122,30 @@
|
||||
@@ -101,12 +123,30 @@
|
||||
}
|
||||
|
||||
public static MapItemSavedData load(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
@@ -76,7 +77,7 @@
|
||||
});
|
||||
int i = nbt.getInt("xCenter");
|
||||
int j = nbt.getInt("zCenter");
|
||||
@@ -131,7 +170,8 @@
|
||||
@@ -131,7 +171,8 @@
|
||||
MapBanner mapiconbanner = (MapBanner) iterator.next();
|
||||
|
||||
worldmap.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
|
||||
@@ -86,7 +87,7 @@
|
||||
}
|
||||
|
||||
ListTag nbttaglist = nbt.getList("frames", 10);
|
||||
@@ -150,13 +190,32 @@
|
||||
@@ -150,13 +191,32 @@
|
||||
|
||||
@Override
|
||||
public CompoundTag save(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
@@ -120,7 +121,7 @@
|
||||
nbt.putInt("xCenter", this.centerX);
|
||||
nbt.putInt("zCenter", this.centerZ);
|
||||
nbt.putByte("scale", this.scale);
|
||||
@@ -443,7 +502,7 @@
|
||||
@@ -443,7 +503,7 @@
|
||||
|
||||
if (!this.isTrackedCountOverLimit(256)) {
|
||||
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
|
||||
@@ -129,7 +130,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -554,7 +613,7 @@
|
||||
@@ -554,7 +614,7 @@
|
||||
this.player = entityhuman;
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@
|
||||
int i = this.minDirtyX;
|
||||
int j = this.minDirtyY;
|
||||
int k = this.maxDirtyX + 1 - this.minDirtyX;
|
||||
@@ -563,7 +622,7 @@
|
||||
@@ -563,7 +623,7 @@
|
||||
|
||||
for (int i1 = 0; i1 < k; ++i1) {
|
||||
for (int j1 = 0; j1 < l; ++j1) {
|
||||
@@ -147,7 +148,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,19 +632,29 @@
|
||||
@@ -573,19 +633,29 @@
|
||||
@Nullable
|
||||
Packet<?> nextUpdatePacket(MapId mapId) {
|
||||
MapItemSavedData.MapPatch worldmap_c;
|
||||
@@ -172,7 +173,7 @@
|
||||
+
|
||||
+ for (org.bukkit.map.MapCursor cursor : render.cursors) {
|
||||
+ if (cursor.isVisible()) {
|
||||
+ icons.add(new MapDecoration(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), CraftChatMessage.fromStringOrOptional(cursor.getCaption())));
|
||||
+ icons.add(new MapDecoration(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), Optional.ofNullable(PaperAdventure.asVanilla(cursor.caption()))));
|
||||
+ }
|
||||
+ }
|
||||
+ collection = icons;
|
||||
|
||||
Reference in New Issue
Block a user