Expanded Adventure support
Adds support for Adventure in a few places where it was previously missing.
This commit is contained in:
@@ -1,20 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lexikiq <noellekiq@gmail.com>
|
||||
Date: Sun, 20 Jun 2021 17:18:07 -0400
|
||||
Date: Fri, 2 Jul 2021 01:33:12 -0400
|
||||
Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index e142072f31a41b25ac637970f79e71ab70c2f28c..2d3160cc96fa3783ec9863ff3f7325a90291ce91 100644
|
||||
index e142072f31a41b25ac637970f79e71ab70c2f28c..3a2e308a5897cd99257ca9e4e836f4eced881246 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -1,4 +1,5 @@
|
||||
import java.util.Locale
|
||||
+import java.net.URI
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
@@ -27,6 +28,7 @@ dependencies {
|
||||
@@ -27,6 +27,7 @@ dependencies {
|
||||
api("org.ow2.asm:asm:9.0")
|
||||
api("org.ow2.asm:asm-commons:9.0")
|
||||
api("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
|
||||
@@ -22,30 +16,3 @@ index e142072f31a41b25ac637970f79e71ab70c2f28c..2d3160cc96fa3783ec9863ff3f7325a9
|
||||
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.8.1")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
|
||||
@@ -46,6 +48,26 @@ configure<PublishingExtension> {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
artifactId = project.name.toLowerCase(Locale.ENGLISH)
|
||||
from(components["java"])
|
||||
+// Parchment start
|
||||
+ groupId = project.group as String?
|
||||
+ artifactId = project.name.toLowerCase(Locale.ENGLISH)
|
||||
+ version = project.version as String?
|
||||
+
|
||||
+ pom {
|
||||
+ name.set(project.name)
|
||||
+ description.set("Minecraft server software forked from Paper")
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ repositories {
|
||||
+ maven {
|
||||
+ credentials {
|
||||
+ username = properties["edenusr"] as String?
|
||||
+ password = properties["edenpwd"] as String?
|
||||
+ }
|
||||
+ url = URI.create("https://sonatype.projecteden.gg/repository/maven-snapshots/")
|
||||
+ }
|
||||
+// Parchment end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lexikiq <noellekiq@gmail.com>
|
||||
Date: Fri, 18 Jun 2021 01:47:40 -0400
|
||||
Subject: [PATCH] Adventure fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Keyed.java b/src/main/java/org/bukkit/Keyed.java
|
||||
index 32c92621c2c15eec14c50965f5ecda00c46e6c80..3876a03ab9df9a0aef7a5c05a38b39b07a6dd285 100644
|
||||
--- a/src/main/java/org/bukkit/Keyed.java
|
||||
+++ b/src/main/java/org/bukkit/Keyed.java
|
||||
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents an object which has a {@link NamespacedKey} attached to it.
|
||||
*/
|
||||
-public interface Keyed {
|
||||
+public interface Keyed extends net.kyori.adventure.key.Keyed { // Parchment
|
||||
|
||||
/**
|
||||
* Return the namespaced identifier for this object.
|
||||
@@ -14,4 +14,11 @@ public interface Keyed {
|
||||
*/
|
||||
@NotNull
|
||||
NamespacedKey getKey();
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ default net.kyori.adventure.key.@org.checkerframework.checker.nullness.qual.NonNull Key key() {
|
||||
+ return getKey();
|
||||
+ }
|
||||
+ // Parchment end
|
||||
}
|
||||
215
patches/api/0006-Expanded-Adventure-support.patch
Normal file
215
patches/api/0006-Expanded-Adventure-support.patch
Normal file
@@ -0,0 +1,215 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lexikiq <noellekiq@gmail.com>
|
||||
Date: Mon, 5 Jul 2021 01:45:49 -0400
|
||||
Subject: [PATCH] Expanded Adventure support
|
||||
|
||||
Adds support for Adventure in a few places where it was previously missing.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
|
||||
index 4594701d77c5d0f744bece871b98d9f6f73eb5a7..136f87f6cd2f3a56cfa645084fd6446a20f2e88e 100644
|
||||
--- a/src/main/java/org/bukkit/ChatColor.java
|
||||
+++ b/src/main/java/org/bukkit/ChatColor.java
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* All supported color values for chat
|
||||
*/
|
||||
-public enum ChatColor {
|
||||
+public enum ChatColor implements net.kyori.adventure.text.format.StyleBuilderApplicable, net.kyori.adventure.text.format.TextFormat { // Parchment
|
||||
/**
|
||||
* Represents black
|
||||
*/
|
||||
@@ -181,6 +181,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.MAGIC;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.OBFUSCATED);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text bold.
|
||||
@@ -191,6 +198,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.BOLD;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.BOLD);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes a line appear through the text.
|
||||
@@ -201,6 +215,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.STRIKETHROUGH;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.STRIKETHROUGH);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text appear underlined.
|
||||
@@ -211,6 +232,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.UNDERLINE;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.UNDERLINED);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text italic.
|
||||
@@ -221,6 +249,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.ITALIC;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.ITALIC);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Resets all previous chat colors or formats.
|
||||
@@ -231,6 +266,16 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.color(null);
|
||||
+ for (net.kyori.adventure.text.format.TextDecoration decoration : net.kyori.adventure.text.format.TextDecoration.values()) {
|
||||
+ style.decoration(decoration, net.kyori.adventure.text.format.TextDecoration.State.NOT_SET);
|
||||
+ }
|
||||
+ }
|
||||
+ // Parchment end
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -263,6 +308,13 @@ public enum ChatColor {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
};
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.color(net.kyori.adventure.text.format.TextColor.color(asBungee().getColor().getRGB()));
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Gets the char value associated with this color
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Color.java b/src/main/java/org/bukkit/Color.java
|
||||
index deae003b7e9a96bbf1c0167d3e1d864e61b07f82..53afcd97fc34bceff741ee118f63226781f9c895 100644
|
||||
--- a/src/main/java/org/bukkit/Color.java
|
||||
+++ b/src/main/java/org/bukkit/Color.java
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* but subject to change.
|
||||
*/
|
||||
@SerializableAs("Color")
|
||||
-public final class Color implements ConfigurationSerializable {
|
||||
+public final class Color implements ConfigurationSerializable, net.kyori.adventure.text.format.TextColor { // Parchment
|
||||
private static final int BIT_MASK = 0xff;
|
||||
|
||||
/**
|
||||
@@ -242,6 +242,13 @@ public final class Color implements ConfigurationSerializable {
|
||||
return getRed() << 16 | getGreen() << 8 | getBlue() << 0;
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public int value() {
|
||||
+ return asRGB();
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Gets the color as an BGR integer.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/DyeColor.java b/src/main/java/org/bukkit/DyeColor.java
|
||||
index bd213cabddd8752e609544f24cfba95405726155..7e89cadecde96f9c2394446669dc4d98df391940 100644
|
||||
--- a/src/main/java/org/bukkit/DyeColor.java
|
||||
+++ b/src/main/java/org/bukkit/DyeColor.java
|
||||
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* All supported color values for dyes and cloth
|
||||
*/
|
||||
-public enum DyeColor {
|
||||
+public enum DyeColor implements net.kyori.adventure.util.RGBLike, net.kyori.adventure.text.format.StyleBuilderApplicable { // Parchment
|
||||
|
||||
/**
|
||||
* Represents white dye.
|
||||
@@ -135,6 +135,28 @@ public enum DyeColor {
|
||||
return firework;
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public @org.jetbrains.annotations.Range(from = 0L, to = 255L) int red() {
|
||||
+ return color.getRed();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @org.jetbrains.annotations.Range(from = 0L, to = 255L) int green() {
|
||||
+ return color.getGreen();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @org.jetbrains.annotations.Range(from = 0L, to = 255L) int blue() {
|
||||
+ return color.getBlue();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@org.jetbrains.annotations.NotNull Builder style) {
|
||||
+ style.color(net.kyori.adventure.text.format.TextColor.color(color));
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Gets the DyeColor with the given wool data value.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Keyed.java b/src/main/java/org/bukkit/Keyed.java
|
||||
index 32c92621c2c15eec14c50965f5ecda00c46e6c80..3876a03ab9df9a0aef7a5c05a38b39b07a6dd285 100644
|
||||
--- a/src/main/java/org/bukkit/Keyed.java
|
||||
+++ b/src/main/java/org/bukkit/Keyed.java
|
||||
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents an object which has a {@link NamespacedKey} attached to it.
|
||||
*/
|
||||
-public interface Keyed {
|
||||
+public interface Keyed extends net.kyori.adventure.key.Keyed { // Parchment
|
||||
|
||||
/**
|
||||
* Return the namespaced identifier for this object.
|
||||
@@ -14,4 +14,11 @@ public interface Keyed {
|
||||
*/
|
||||
@NotNull
|
||||
NamespacedKey getKey();
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ default net.kyori.adventure.key.@org.checkerframework.checker.nullness.qual.NonNull Key key() {
|
||||
+ return getKey();
|
||||
+ }
|
||||
+ // Parchment end
|
||||
}
|
||||
Reference in New Issue
Block a user