mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 04:25:26 +01:00
Add component methods to TextDisplay entity
This commit is contained in:
parent
94604b6474
commit
c225146bc9
@ -2498,6 +2498,48 @@ index c60e1fc1cad1b9889a508602df84840723b7b966..baf0887ec941533f8007f2c7f7ab78f1
|
||||
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/TextDisplay.java b/src/main/java/org/bukkit/entity/TextDisplay.java
|
||||
index 766d6f001d4bc59cbe13d67f539bcae3fce67144..b12cb420f919aeafa8e41356f129f82a8e676505 100644
|
||||
--- a/src/main/java/org/bukkit/entity/TextDisplay.java
|
||||
+++ b/src/main/java/org/bukkit/entity/TextDisplay.java
|
||||
@@ -13,17 +13,37 @@ public interface TextDisplay extends Display {
|
||||
* Gets the displayed text.
|
||||
*
|
||||
* @return the displayed text.
|
||||
+ * @deprecated in favour of {@link #text()}
|
||||
*/
|
||||
@Nullable
|
||||
+ @Deprecated // Paper
|
||||
String getText();
|
||||
|
||||
/**
|
||||
* Sets the displayed text.
|
||||
*
|
||||
* @param text the new text
|
||||
+ * @deprecated in favour of {@link #text(net.kyori.adventure.text.Component)}
|
||||
*/
|
||||
+ @Deprecated // Paper
|
||||
void setText(@Nullable String text);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the displayed text.
|
||||
+ *
|
||||
+ * @return the displayed text
|
||||
+ */
|
||||
+ net.kyori.adventure.text.Component text();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the displayed text.
|
||||
+ *
|
||||
+ * @param text the new text
|
||||
+ */
|
||||
+ void text(@Nullable net.kyori.adventure.text.Component text);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the maximum line width before wrapping.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
|
||||
index 63c80b4ee1f7adc8a9efc3b607993104b1991f90..91cab8b13d5bba34007f124838b32a1df58c5ac7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
|
||||
|
@ -3832,6 +3832,28 @@ index 4d341db0daecb5f6ff1f0a1a9238f9dedb4b50d1..27cf140f8a7715caec5637d7b487720c
|
||||
// Spigot start
|
||||
private final Player.Spigot spigot = new Player.Spigot()
|
||||
{
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java
|
||||
index 1bed95ee1af2354b710361f737bffa2ff9ec4f97..1b4277655bded7e560ef4ba8477dd0d701a50cc0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java
|
||||
@@ -38,6 +38,17 @@ public class CraftTextDisplay extends CraftDisplay implements TextDisplay {
|
||||
public void setText(String text) {
|
||||
this.getHandle().setText(CraftChatMessage.fromString(text, true)[0]);
|
||||
}
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component text() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getHandle().getText());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void text(net.kyori.adventure.text.Component text) {
|
||||
+ this.getHandle().setText(text == null ? net.minecraft.network.chat.Component.empty() : io.papermc.paper.adventure.PaperAdventure.asVanilla(text));
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public int getLineWidth() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 09ce43bf982f2da83fc9b10039109f8b76bd6ad3..7bcbd1aac8826c76b74ef0e517b9d94e615df347 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
|
Loading…
Reference in New Issue
Block a user