We're going on an Adventure! (#4842)

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
This commit is contained in:
Riley Park
2021-02-21 11:45:33 -08:00
parent 1f2b6f865b
commit 2e419805ad
115 changed files with 6625 additions and 370 deletions

View File

@@ -12,6 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package org.bukkit.event.command;
+
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Event;
@@ -26,9 +28,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private static final HandlerList handlers = new HandlerList();
+ @NotNull private CommandSender sender;
+ @NotNull private String commandLine;
+ @Nullable private String message;
+ @Nullable private Component message;
+
+ @Deprecated
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) {
+ this(sender, commandLine, message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message));
+ }
+
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) {
+ super(false);
+ this.sender = sender;
+ this.commandLine = commandLine;
@@ -62,12 +69,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * <p>
+ *
+ * @return Unknown command message
+ * @deprecated use {@link #message()}
+ */
+ @Nullable
+ @Deprecated
+ public String getMessage() {
+ return message;
+ return this.message == null ? null : LegacyComponentSerializer.legacySection().serialize(this.message);
+ }
+
+ /**
+ * Sets message that will be returned
+ * <p>
+ * Set to null to avoid any message being sent
+ *
+ * @param message the message to be returned, or null
+ * @deprecated use {@link #message(Component)}
+ */
+ @Deprecated
+ public void setMessage(@Nullable String message) {
+ this.message(message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message));
+ }
+
+ /**
+ * Gets message that will be returned
+ * <p>
+ *
+ * @return Unknown command message
+ */
+ @Nullable
+ public Component message() {
+ return this.message;
+ }
+
+ /**
+ * Sets message that will be returned
@@ -76,7 +108,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param message the message to be returned, or null
+ */
+ public void setMessage(@Nullable String message) {
+ public void message(@Nullable Component message) {
+ this.message = message;
+ }
+