mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-19 11:44:59 +00:00
49 lines
2.7 KiB
Diff
49 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Telesphoreo <me@telesphoreo.me>
|
|
Date: Sat, 30 Sep 2023 18:41:40 -0500
|
|
Subject: [PATCH] Limit map decorations
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
index e4c4948e076cd64686dfd16ae0568fafc1437140..eff53c21b18574750b691b784fb1688885d4ace7 100644
|
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
@@ -361,6 +361,11 @@ public class MapItemSavedData extends SavedData {
|
|
}
|
|
|
|
private void addDecoration(MapDecoration.Type type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) {
|
|
+ // Scissors start - Limit decoration count
|
|
+ if (this.decorations.size() > 32) {
|
|
+ return;
|
|
+ }
|
|
+ // Scissors end
|
|
int i = 1 << this.scale;
|
|
float f = (float) (x - (double) this.centerX) / (float) i;
|
|
float f1 = (float) (z - (double) this.centerZ) / (float) i;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
|
|
index 2d2bf5c37709b8e747fbfa2db5ce86f258e86224..eeffb546dfa6a094089d322e46e44a8a69238680 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
|
|
@@ -1,5 +1,6 @@
|
|
package org.bukkit.craftbukkit.map;
|
|
|
|
+import net.minecraft.network.chat.Component;
|
|
import net.minecraft.world.level.saveddata.maps.MapDecoration;
|
|
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
|
import org.bukkit.Bukkit;
|
|
@@ -42,7 +43,13 @@ public class CraftMapRenderer extends MapRenderer {
|
|
}
|
|
|
|
MapDecoration decoration = worldMap.decorations.get(key);
|
|
- cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, decoration.name() == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.name())); // Paper
|
|
+ // Scissors start - Limit decoration text length
|
|
+ Component name = decoration.name();
|
|
+ if (decoration.name() != null && decoration.name().getString().length() > 32) {
|
|
+ name = null;
|
|
+ }
|
|
+ cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, name == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.name())); // Paper
|
|
+ // Scissors end
|
|
}
|
|
}
|
|
|