geforkt von Mirrors/Paper
Add Adventure API to ServerLinks (#10891)
Dieser Commit ist enthalten in:
Ursprung
98682757de
Commit
b6b5a57b8b
@ -1417,6 +1417,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/ServerLinks.java b/src/main/java/org/bukkit/ServerLinks.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/ServerLinks.java
|
||||
+++ b/src/main/java/org/bukkit/ServerLinks.java
|
||||
@@ -0,0 +0,0 @@ public interface ServerLinks {
|
||||
@NotNull
|
||||
ServerLink addLink(@NotNull Type type, @NotNull URI url);
|
||||
|
||||
+ // Paper start - Adventure
|
||||
+ /**
|
||||
+ * Adds the given link to the list of links.
|
||||
+ *
|
||||
+ * @param displayName link name / display text Component
|
||||
+ * @param url link url
|
||||
+ * @return the added link
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ ServerLink addLink(@NotNull net.kyori.adventure.text.Component displayName, @NotNull URI url);
|
||||
+ // Paper end - Adventure
|
||||
+
|
||||
/**
|
||||
* Adds the given link to the list of links.
|
||||
*
|
||||
* @param displayName link name / display text
|
||||
* @param url link url
|
||||
* @return the added link
|
||||
+ * @deprecated in favour of {@link ServerLinks#addLink(net.kyori.adventure.text.Component, URI)}
|
||||
*/
|
||||
+ @Deprecated // Paper - Adventure
|
||||
@NotNull
|
||||
ServerLink addLink(@NotNull String displayName, @NotNull URI url);
|
||||
|
||||
@@ -0,0 +0,0 @@ public interface ServerLinks {
|
||||
@Nullable
|
||||
Type getType();
|
||||
|
||||
+ // Paper start - Adventure
|
||||
+ /**
|
||||
+ * Gets the display name/text Component of this link.
|
||||
+ *
|
||||
+ * @return display name Component
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ net.kyori.adventure.text.Component displayName();
|
||||
+ // Paper end - Adventure
|
||||
+
|
||||
/**
|
||||
* Gets the display name/text of this link.
|
||||
*
|
||||
* @return display name
|
||||
+ * @deprecated in favour of {@link ServerLink#displayName()}
|
||||
*/
|
||||
+ @Deprecated // Paper - Adventure
|
||||
@NotNull
|
||||
String getDisplayName();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Sound.java
|
||||
|
@ -3492,6 +3492,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServerLinks.java b/src/main/java/org/bukkit/craftbukkit/CraftServerLinks.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServerLinks.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServerLinks.java
|
||||
@@ -0,0 +0,0 @@ public class CraftServerLinks implements ServerLinks {
|
||||
return link;
|
||||
}
|
||||
|
||||
+ // Paper start - Adventure
|
||||
+ @Override
|
||||
+ public ServerLink addLink(net.kyori.adventure.text.Component displayName, URI url) {
|
||||
+ Preconditions.checkArgument(displayName != null, "displayName cannot be null");
|
||||
+ Preconditions.checkArgument(url != null, "url cannot be null");
|
||||
+
|
||||
+ CraftServerLink link = new CraftServerLink(net.minecraft.server.ServerLinks.Entry.custom(io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName), url));
|
||||
+ this.addLink(link);
|
||||
+
|
||||
+ return link;
|
||||
+ }
|
||||
+ // Paper end - Adventure
|
||||
+
|
||||
@Override
|
||||
public ServerLink addLink(String displayName, URI url) {
|
||||
Preconditions.checkArgument(displayName != null, "displayName cannot be null");
|
||||
@@ -0,0 +0,0 @@ public class CraftServerLinks implements ServerLinks {
|
||||
return CraftChatMessage.fromComponent(this.handle.displayName());
|
||||
}
|
||||
|
||||
+ // Paper start - Adventure
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component displayName() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.handle.displayName());
|
||||
+ }
|
||||
+ // Paper end - Adventure
|
||||
+
|
||||
@Override
|
||||
public URI getUrl() {
|
||||
return this.handle.link();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren