mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 00:22:08 -07:00
Add Adventure API to ServerLinks (#10891)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user