Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
e2160a18 Make MapCursor#type not depends on deprecated values

CraftBukkit Changes:
6ce172642 SPIGOT-7761: Ender pearl does not damage or spawn endermites
f5a63f734 SPIGOT-7759: Chunk not there when requested in ChunkUnloadEvent
28287259c Remove unused import
eb9a7dde0 SPIGOT-7757: Cannot set item in Stonecutter Inventory
f8be9d752 Move deserialized removed unhandled tags to dedicated removedTags
a7e576186 Fix potential mutability issue with CraftMetaItem copy constructor
995885452 SPIGOT-7741: Vanilla ItemComponent in commands can't remove components
9ef69aa0b PR-1284: Move ItemType <-> ItemMeta linking to a centralized place
3e82eafbe PR-1420: Fix DirectEntity and CausingEntity Damager for Creepers ignited by Player
c23daa71f SPIGOT-7751: Fix crash caused by arrows from trial spawners
Make MapCursor#type not depends on deprecated values
SPIGOT-7761: Ender pearl does not damage or spawn endermites
This commit is contained in:
Nassim Jahnke 2024-06-15 18:28:18 +02:00
parent 5d834b1b71
commit 4bc15f13aa
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
163 changed files with 758 additions and 725 deletions

View file

@ -4804,19 +4804,19 @@ index bd512a7840d4686759097ee4cbd8b375c530956b..f2242ddc4085f7e7cdd748d860857822
+ // Paper end - adventure
}
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
index 7736ef1020b658206056af02fdb8c04de2d55541..4e84e3c5d0fa23bbb063d8429c18abcd7ee6b82a 100644
index e645a65dbd3340a86f5325dbfd515e0a99f31ab0..940066ec529acc4cb9c8136f15345f100ea9467e 100644
--- a/src/main/java/org/bukkit/map/MapCursor.java
+++ b/src/main/java/org/bukkit/map/MapCursor.java
@@ -12,7 +12,7 @@ public final class MapCursor {
@@ -13,7 +13,7 @@ public final class MapCursor {
private byte x, y;
private byte direction, type;
private byte direction;
private boolean visible;
- private String caption;
+ private net.kyori.adventure.text.Component caption; // Paper
private Type type;
/**
* Initialize the map cursor.
@@ -26,7 +26,7 @@ public final class MapCursor {
@@ -28,7 +28,7 @@ public final class MapCursor {
*/
@Deprecated
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible) {
@ -4825,7 +4825,7 @@ index 7736ef1020b658206056af02fdb8c04de2d55541..4e84e3c5d0fa23bbb063d8429c18abcd
}
/**
@@ -39,7 +39,7 @@ public final class MapCursor {
@@ -41,7 +41,7 @@ public final class MapCursor {
* @param visible Whether the cursor is visible by default.
*/
public MapCursor(byte x, byte y, byte direction, @NotNull Type type, boolean visible) {
@ -4834,22 +4834,22 @@ index 7736ef1020b658206056af02fdb8c04de2d55541..4e84e3c5d0fa23bbb063d8429c18abcd
}
/**
@@ -51,7 +51,7 @@ public final class MapCursor {
@@ -53,7 +53,7 @@ public final class MapCursor {
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
* @param caption cursor caption
- * @deprecated Magic value
+ * @deprecated Magic value. Use {@link #MapCursor(byte, byte, byte, byte, boolean, net.kyori.adventure.text.Component)}
- * @deprecated Magic value, use {@link #MapCursor(byte, byte, byte, Type, boolean, String)}
+ * @deprecated Magic value. Use {@link #MapCursor(byte, byte, byte, Type, boolean, net.kyori.adventure.text.Component)}
*/
@Deprecated
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible, @Nullable String caption) {
@@ -60,8 +60,42 @@ public final class MapCursor {
@@ -62,8 +62,42 @@ public final class MapCursor {
setDirection(direction);
setRawType(type);
this.visible = visible;
- this.caption = caption;
+ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper
}
+ }
+ // Paper start
+ /**
+ * Initialize the map cursor.
@ -4867,7 +4867,7 @@ index 7736ef1020b658206056af02fdb8c04de2d55541..4e84e3c5d0fa23bbb063d8429c18abcd
+ this.x = x; this.y = y; this.visible = visible; this.caption = caption;
+ setDirection(direction);
+ setRawType(type);
+ }
}
+ /**
+ * Initialize the map cursor.
+ *
@ -4887,25 +4887,25 @@ index 7736ef1020b658206056af02fdb8c04de2d55541..4e84e3c5d0fa23bbb063d8429c18abcd
/**
* Initialize the map cursor.
@@ -79,7 +113,7 @@ public final class MapCursor {
@@ -81,7 +115,7 @@ public final class MapCursor {
setDirection(direction);
setType(type);
this.type = type;
this.visible = visible;
- this.caption = caption;
+ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper
}
/**
@@ -202,23 +236,45 @@ public final class MapCursor {
@@ -200,23 +234,45 @@ public final class MapCursor {
this.visible = visible;
}
+ // Paper start
+ /**
+ * Gets the caption on this cursor.
+ *
+ * @return caption
+ */
/**
* Gets the caption on this cursor.
*
* @return caption
*/
+ public net.kyori.adventure.text.@Nullable Component caption() {
+ return this.caption;
+ }
@ -4918,12 +4918,12 @@ index 7736ef1020b658206056af02fdb8c04de2d55541..4e84e3c5d0fa23bbb063d8429c18abcd
+ this.caption = caption;
+ }
+ // Paper end
/**
* Gets the caption on this cursor.
*
* @return caption
+ /**
+ * Gets the caption on this cursor.
+ *
+ * @return caption
+ * @deprecated in favour of {@link #caption()}
*/
+ */
@Nullable
+ @Deprecated // Paper
public String getCaption() {

View file

@ -1677,10 +1677,10 @@ index edef478786bb7456af29ca960009873095830050..e8ac449e6280827beb6d2699df75b1d5
/**
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
index 4e84e3c5d0fa23bbb063d8429c18abcd7ee6b82a..a17b755da4eca0370680a9777ff3c7de422f5079 100644
index 940066ec529acc4cb9c8136f15345f100ea9467e..82993302cb3cf62ad4a94a0ebaa7711cc4d8e550 100644
--- a/src/main/java/org/bukkit/map/MapCursor.java
+++ b/src/main/java/org/bukkit/map/MapCursor.java
@@ -158,9 +158,9 @@ public final class MapCursor {
@@ -159,9 +159,9 @@ public final class MapCursor {
* Get the type of this cursor.
*
* @return The type (color/style) of the map cursor.
@ -1690,9 +1690,9 @@ index 4e84e3c5d0fa23bbb063d8429c18abcd7ee6b82a..a17b755da4eca0370680a9777ff3c7de
- @Deprecated
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
public byte getRawType() {
return type;
return type.value;
}
@@ -217,9 +217,9 @@ public final class MapCursor {
@@ -216,9 +216,9 @@ public final class MapCursor {
* Set the type of this cursor.
*
* @param type The type (color/style) of the map cursor.
@ -1702,9 +1702,9 @@ index 4e84e3c5d0fa23bbb063d8429c18abcd7ee6b82a..a17b755da4eca0370680a9777ff3c7de
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper
public void setRawType(byte type) {
if (type < 0 || type > 34) {
throw new IllegalArgumentException("Type must be in the range 0-34");
@@ -339,9 +339,9 @@ public final class MapCursor {
Type enumType = Type.byValue(type);
Preconditions.checkArgument(enumType != null, "Unknown type by id %s", type);
@@ -337,9 +337,9 @@ public final class MapCursor {
* Gets the internal value of the cursor.
*
* @return the value
@ -1716,7 +1716,7 @@ index 4e84e3c5d0fa23bbb063d8429c18abcd7ee6b82a..a17b755da4eca0370680a9777ff3c7de
public byte getValue() {
return value;
}
@@ -351,9 +351,9 @@ public final class MapCursor {
@@ -349,9 +349,9 @@ public final class MapCursor {
*
* @param value the value
* @return the matching type

View file

@ -81,10 +81,10 @@ index e404cd1e2ba44e4c2d09524bc7cf730d8ffbdabd..cea0ebf50876dd32ab7fba6025b30f29
public interface BundleMeta extends ItemMeta {
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
index a17b755da4eca0370680a9777ff3c7de422f5079..aa3b84ef523cd493b89159ed9d81fc19c2285709 100644
index 82993302cb3cf62ad4a94a0ebaa7711cc4d8e550..44773ab211f11e924aadea14b965ec52b0483377 100644
--- a/src/main/java/org/bukkit/map/MapCursor.java
+++ b/src/main/java/org/bukkit/map/MapCursor.java
@@ -311,12 +311,25 @@ public final class MapCursor {
@@ -309,12 +309,25 @@ public final class MapCursor {
BANNER_RED(24, "banner_red"),
BANNER_BLACK(25, "banner_black"),
RED_X(26, "red_x"),

View file

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Fri, 24 May 2024 20:19:07 +0200
Subject: [PATCH] Allow to define new map cursor types
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
index aa3b84ef523cd493b89159ed9d81fc19c2285709..21bc42ea602c7cc4eab5f9ac59a7e539131a2254 100644
--- a/src/main/java/org/bukkit/map/MapCursor.java
+++ b/src/main/java/org/bukkit/map/MapCursor.java
@@ -221,8 +221,8 @@ public final class MapCursor {
*/
@Deprecated(forRemoval = true, since = "1.20.2") // Paper
public void setRawType(byte type) {
- if (type < 0 || type > 34) {
- throw new IllegalArgumentException("Type must be in the range 0-34");
+ if (type < 0 || type > Type.UPPER_MAP_CURSOR_TYPE_BOUND) { // Paper
+ throw new IllegalArgumentException("Type must be in the range 0-" + Type.UPPER_MAP_CURSOR_TYPE_BOUND); // Paper
}
this.type = type;
}
@@ -334,6 +334,8 @@ public final class MapCursor {
TRIAL_CHAMBERS(34, "trial_chambers")
;
+ static final int UPPER_MAP_CURSOR_TYPE_BOUND = Type.values().length - 1; // Paper - cached max value of Type
+
private byte value;
private final NamespacedKey key;