Use random UUIDs instead of incrementing long for click callback ids (#9007)
This commit is contained in:
parent
510082222b
commit
662b85e00e
2 changed files with 20 additions and 25 deletions
|
@ -290,23 +290,19 @@ index 0000000000000000000000000000000000000000..7e9e0ff8639be135bf8575e375cbada5
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/CallbackCommand.java b/src/main/java/io/papermc/paper/command/subcommands/CallbackCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..62e121e703716b38162020d34467855a02443d88
|
||||
index 0000000000000000000000000000000000000000..c5111eef4ba85ed96f7496b7db6954106fa05053
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/CallbackCommand.java
|
||||
@@ -0,0 +1,37 @@
|
||||
@@ -0,0 +1,33 @@
|
||||
+package io.papermc.paper.command.subcommands;
|
||||
+
|
||||
+import io.papermc.paper.adventure.providers.ClickCallbackProviderImpl;
|
||||
+import io.papermc.paper.command.PaperSubcommand;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.event.ClickCallback;
|
||||
+import net.kyori.adventure.text.event.ClickEvent;
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+import java.time.Duration;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class CallbackCommand implements PaperSubcommand {
|
||||
+ @Override
|
||||
|
@ -315,10 +311,10 @@ index 0000000000000000000000000000000000000000..62e121e703716b38162020d34467855a
|
|||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ final long id;
|
||||
+ final UUID id;
|
||||
+ try {
|
||||
+ id = Long.parseLong(args[0]);
|
||||
+ } catch (final NumberFormatException ignored) {
|
||||
+ id = UUID.fromString(args[0]);
|
||||
+ } catch (final IllegalArgumentException ignored) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue