mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 21:47:55 +01:00
Nameable Banner API (#7711)
This commit is contained in:
parent
94ef34cd0f
commit
2dcfb2b11f
20
patches/api/0386-Nameable-Banner-API.patch
Normal file
20
patches/api/0386-Nameable-Banner-API.patch
Normal file
@ -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 <me@swedz.net>
|
||||
|
||||
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
|
36
patches/server/0913-Nameable-Banner-API.patch
Normal file
36
patches/server/0913-Nameable-Banner-API.patch
Normal file
@ -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<BannerBlockEntity> 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user