From 2dcfb2b11fb0ef9807d01c81e891d90b74ba4750 Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Wed, 15 Jun 2022 23:54:54 -0400 Subject: [PATCH] Nameable Banner API (#7711) --- patches/api/0386-Nameable-Banner-API.patch | 20 +++++++++++ patches/server/0913-Nameable-Banner-API.patch | 36 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 patches/api/0386-Nameable-Banner-API.patch create mode 100644 patches/server/0913-Nameable-Banner-API.patch diff --git a/patches/api/0386-Nameable-Banner-API.patch b/patches/api/0386-Nameable-Banner-API.patch new file mode 100644 index 000000000..eba196daa --- /dev/null +++ b/patches/api/0386-Nameable-Banner-API.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Thu, 7 Apr 2022 17:49:38 -0400 +Subject: [PATCH] Nameable Banner API + +Co-Authored-By: Swedz + +diff --git a/src/main/java/org/bukkit/block/Banner.java b/src/main/java/org/bukkit/block/Banner.java +index e6eb3c04b9fa6cd232f95dd5851d365234972efd..4dfd4bd40cb2f852d01a628994964700b9b20dc9 100644 +--- a/src/main/java/org/bukkit/block/Banner.java ++++ b/src/main/java/org/bukkit/block/Banner.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a captured state of a banner. + */ +-public interface Banner extends TileState { ++public interface Banner extends TileState, org.bukkit.Nameable { // Paper - Nameable API + + /** + * Returns the base color for this banner diff --git a/patches/server/0913-Nameable-Banner-API.patch b/patches/server/0913-Nameable-Banner-API.patch new file mode 100644 index 000000000..78f176be3 --- /dev/null +++ b/patches/server/0913-Nameable-Banner-API.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Thu, 7 Apr 2022 17:49:25 -0400 +Subject: [PATCH] Nameable Banner API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java +index 85f7ed3041befcc37729e9cd25723644600c7f62..31d916bc2364d0c518652b5b5868ab3d45a77ccc 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java +@@ -99,4 +99,25 @@ public class CraftBanner extends CraftBlockEntityState implem + } + banner.itemPatterns = newPatterns; + } ++ // Paper start ++ @Override ++ public net.kyori.adventure.text.Component customName() { ++ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getSnapshot().getCustomName()); ++ } ++ ++ @Override ++ public void customName(net.kyori.adventure.text.Component customName) { ++ this.getSnapshot().setCustomName(io.papermc.paper.adventure.PaperAdventure.asVanilla(customName)); ++ } ++ ++ @Override ++ public String getCustomName() { ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serializeOrNull(this.customName()); ++ } ++ ++ @Override ++ public void setCustomName(String name) { ++ this.customName(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(name)); ++ } ++ // Paper end + }