13
0
geforkt von Mirrors/Paper

Add component methods to TextDisplay entity

Dieser Commit ist enthalten in:
Jake Potrebic 2023-03-14 16:52:28 -07:00
Ursprung f496b60138
Commit 5900d6bba8
2 geänderte Dateien mit 64 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -2498,6 +2498,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/TextDisplay.java
+++ b/src/main/java/org/bukkit/entity/TextDisplay.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java

Datei anzeigen

@ -3832,6 +3832,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java