mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-06 15:12:13 -07:00
Update adventure to 4.13.0
This commit is contained in:
@@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
withJavadocJar()
|
withJavadocJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
+val adventureVersion = "4.12.0"
|
+val adventureVersion = "4.13.0"
|
||||||
+val apiAndDocs: Configuration by configurations.creating {
|
+val apiAndDocs: Configuration by configurations.creating {
|
||||||
+ attributes {
|
+ attributes {
|
||||||
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||||
|
@@ -197,14 +197,6 @@ diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@ import io.papermc.paper.command.subcommands.EntityCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.FixLightCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.ReloadCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.SyncLoadInfoCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.VersionCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.DumpPluginsCommand;
|
|
||||||
import it.unimi.dsi.fastutil.Pair;
|
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
||||||
commands.put(Set.of("fixlight"), new FixLightCommand());
|
commands.put(Set.of("fixlight"), new FixLightCommand());
|
||||||
|
@@ -9,14 +9,6 @@ diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@ package io.papermc.paper.command;
|
|
||||||
|
|
||||||
import io.papermc.paper.command.subcommands.ChunkDebugCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.DumpItemCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.DumpListenersCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.EntityCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.FixLightCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
|
commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
|
||||||
commands.put(Set.of("dumpitem"), new DumpItemCommand());
|
commands.put(Set.of("dumpitem"), new DumpItemCommand());
|
||||||
|
@@ -13,14 +13,6 @@ diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@ import io.papermc.paper.command.subcommands.DumpItemCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.EntityCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.FixLightCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.MobcapsCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.ReloadCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.SyncLoadInfoCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.VersionCommand;
|
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
|
commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
|
||||||
commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
|
commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
|
||||||
|
@@ -1169,6 +1169,109 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ return net.minecraft.network.chat.Component.Serializer.fromJson(GsonComponentSerializer.gson().serializer().toJsonTree(component));
|
+ return net.minecraft.network.chat.Component.Serializer.fromJson(GsonComponentSerializer.gson().serializer().toJsonTree(component));
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/adventure/providers/ClickCallbackProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ClickCallbackProviderImpl.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/adventure/providers/ClickCallbackProviderImpl.java
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
+package io.papermc.paper.adventure.providers;
|
||||||
|
+
|
||||||
|
+import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
|
+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
+import net.kyori.adventure.audience.Audience;
|
||||||
|
+import net.kyori.adventure.text.event.ClickCallback;
|
||||||
|
+import net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+import java.util.Queue;
|
||||||
|
+import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
+import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
+
|
||||||
|
+@SuppressWarnings("UnstableApiUsage") // permitted provider
|
||||||
|
+public class ClickCallbackProviderImpl implements ClickCallback.Provider {
|
||||||
|
+
|
||||||
|
+ public static final CallbackManager CALLBACK_MANAGER = new CallbackManager();
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull ClickEvent create(final @NotNull ClickCallback<Audience> callback, final ClickCallback.@NotNull Options options) {
|
||||||
|
+ return ClickEvent.runCommand("/paper callback " + CALLBACK_MANAGER.addCallback(callback, options));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static final class CallbackManager {
|
||||||
|
+
|
||||||
|
+ private final Long2ObjectMap<StoredCallback> callbacks = new Long2ObjectOpenHashMap<>();
|
||||||
|
+ private final Queue<StoredCallback> queue = new ConcurrentLinkedQueue<>();
|
||||||
|
+ private final AtomicLong current = new AtomicLong();
|
||||||
|
+
|
||||||
|
+ private CallbackManager() {
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public long addCallback(final @NotNull ClickCallback<Audience> callback, final ClickCallback.@NotNull Options options) {
|
||||||
|
+ final long id = current.getAndIncrement();
|
||||||
|
+ this.queue.add(new StoredCallback(callback, options, id));
|
||||||
|
+ return id;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void handleQueue(final int currentTick) {
|
||||||
|
+ // Evict expired entries
|
||||||
|
+ if (currentTick % 100 == 0) {
|
||||||
|
+ this.callbacks.values().removeIf(callback -> !callback.valid());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Add entries from queue
|
||||||
|
+ StoredCallback callback;
|
||||||
|
+ while ((callback = this.queue.poll()) != null) {
|
||||||
|
+ this.callbacks.put(callback.id(), callback);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void runCallback(final @NotNull Audience audience, final long id) {
|
||||||
|
+ final StoredCallback callback = this.callbacks.get(id);
|
||||||
|
+ if (callback != null && callback.valid()) { //TODO Message if expired/invalid?
|
||||||
|
+ callback.takeUse();
|
||||||
|
+ callback.callback.accept(audience);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static final class StoredCallback {
|
||||||
|
+ private final long startedAt = System.nanoTime();
|
||||||
|
+ private final ClickCallback<Audience> callback;
|
||||||
|
+ private final long lifetime;
|
||||||
|
+ private final long id;
|
||||||
|
+ private int remainingUses;
|
||||||
|
+
|
||||||
|
+ private StoredCallback(final @NotNull ClickCallback<Audience> callback, final ClickCallback.@NotNull Options options, final long id) {
|
||||||
|
+ this.callback = callback;
|
||||||
|
+ this.lifetime = options.lifetime().toNanos();
|
||||||
|
+ this.remainingUses = options.uses();
|
||||||
|
+ this.id = id;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void takeUse() {
|
||||||
|
+ if (this.remainingUses != ClickCallback.UNLIMITED_USES) {
|
||||||
|
+ this.remainingUses--;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean hasRemainingUses() {
|
||||||
|
+ return this.remainingUses == ClickCallback.UNLIMITED_USES || this.remainingUses > 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean expired() {
|
||||||
|
+ return System.nanoTime() - this.startedAt >= this.lifetime;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean valid() {
|
||||||
|
+ return hasRemainingUses() && !expired();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public long id() {
|
||||||
|
+ return this.id;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
|
diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
@@ -2023,6 +2126,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private int playerIdleTimeout;
|
private int playerIdleTimeout;
|
||||||
public final long[] tickTimes;
|
public final long[] tickTimes;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
SpigotTimings.schedulerTimer.startTiming(); // Spigot
|
||||||
|
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
||||||
|
SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
||||||
|
+ io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
||||||
|
this.profiler.push("commandFunctions");
|
||||||
|
SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot
|
||||||
|
this.getFunctions().tick();
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
return this.motd;
|
return this.motd;
|
||||||
}
|
}
|
||||||
@@ -4692,6 +4803,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
HashSet<Player> reference = new HashSet<Player>(players.size());
|
HashSet<Player> reference = new HashSet<Player>(players.size());
|
||||||
for (ServerPlayer player : players) {
|
for (ServerPlayer player : players) {
|
||||||
reference.add(player.getBukkitEntity());
|
reference.add(player.getBukkitEntity());
|
||||||
|
diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.event.ClickCallback$Provider b/src/main/resources/META-INF/services/net.kyori.adventure.text.event.ClickCallback$Provider
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.event.ClickCallback$Provider
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+io.papermc.paper.adventure.providers.ClickCallbackProviderImpl
|
||||||
diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider b/src/main/resources/META-INF/services/net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider
|
diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider b/src/main/resources/META-INF/services/net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
@@ -8,18 +8,10 @@ diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@ import io.papermc.paper.command.subcommands.EntityCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.ReloadCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.VersionCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.DumpPluginsCommand;
|
|
||||||
import it.unimi.dsi.fastutil.Pair;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
commands.put(Set.of("entity"), new EntityCommand());
|
|
||||||
commands.put(Set.of("reload"), new ReloadCommand());
|
commands.put(Set.of("reload"), new ReloadCommand());
|
||||||
commands.put(Set.of("version"), new VersionCommand());
|
commands.put(Set.of("version"), new VersionCommand());
|
||||||
|
commands.put(Set.of("callback"), new CallbackCommand());
|
||||||
+ commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
+ commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
||||||
|
|
||||||
return commands.entrySet().stream()
|
return commands.entrySet().stream()
|
||||||
|
@@ -87,10 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
+package io.papermc.paper.command;
|
+package io.papermc.paper.command;
|
||||||
+
|
+
|
||||||
+import io.papermc.paper.command.subcommands.EntityCommand;
|
+import io.papermc.paper.command.subcommands.*;
|
||||||
+import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.ReloadCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.VersionCommand;
|
|
||||||
+import it.unimi.dsi.fastutil.Pair;
|
+import it.unimi.dsi.fastutil.Pair;
|
||||||
+import java.util.ArrayList;
|
+import java.util.ArrayList;
|
||||||
+import java.util.Arrays;
|
+import java.util.Arrays;
|
||||||
@@ -127,11 +124,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ commands.put(Set.of("entity"), new EntityCommand());
|
+ commands.put(Set.of("entity"), new EntityCommand());
|
||||||
+ commands.put(Set.of("reload"), new ReloadCommand());
|
+ commands.put(Set.of("reload"), new ReloadCommand());
|
||||||
+ commands.put(Set.of("version"), new VersionCommand());
|
+ commands.put(Set.of("version"), new VersionCommand());
|
||||||
|
+ commands.put(Set.of("callback"), new CallbackCommand());
|
||||||
+
|
+
|
||||||
+ return commands.entrySet().stream()
|
+ return commands.entrySet().stream()
|
||||||
+ .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue())))
|
+ .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue())))
|
||||||
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
+ });
|
+ });
|
||||||
|
+ private static final Set<String> COMPLETABLE_SUBCOMMANDS = SUBCOMMANDS.entrySet().stream().filter(entry -> entry.getValue().tabCompletes()).map(Map.Entry::getKey).collect(Collectors.toSet());
|
||||||
+ // alias -> subcommand label
|
+ // alias -> subcommand label
|
||||||
+ private static final Map<String, String> ALIASES = Util.make(() -> {
|
+ private static final Map<String, String> ALIASES = Util.make(() -> {
|
||||||
+ final Map<String, Set<String>> aliases = new HashMap<>();
|
+ final Map<String, Set<String>> aliases = new HashMap<>();
|
||||||
@@ -173,7 +172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ final @Nullable Location location
|
+ final @Nullable Location location
|
||||||
+ ) throws IllegalArgumentException {
|
+ ) throws IllegalArgumentException {
|
||||||
+ if (args.length <= 1) {
|
+ if (args.length <= 1) {
|
||||||
+ return CommandUtil.getListMatchingLast(sender, args, SUBCOMMANDS.keySet());
|
+ return CommandUtil.getListMatchingLast(sender, args, COMPLETABLE_SUBCOMMANDS);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ final @Nullable Pair<String, PaperSubcommand> subCommand = resolveCommand(args[0]);
|
+ final @Nullable Pair<String, PaperSubcommand> subCommand = resolveCommand(args[0]);
|
||||||
@@ -284,6 +283,53 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ default List<String> tabComplete(final CommandSender sender, final String subCommand, final String[] args) {
|
+ default List<String> tabComplete(final CommandSender sender, final String subCommand, final String[] args) {
|
||||||
+ return Collections.emptyList();
|
+ return Collections.emptyList();
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ default boolean tabCompletes() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
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..0000000000000000000000000000000000000000
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/command/subcommands/CallbackCommand.java
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
+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 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
|
||||||
|
+ public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
|
||||||
|
+ if (args.length != 1) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ final long id;
|
||||||
|
+ try {
|
||||||
|
+ id = Long.parseLong(args[0]);
|
||||||
|
+ } catch (final NumberFormatException ignored) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ClickCallbackProviderImpl.CALLBACK_MANAGER.runCallback(sender, id);
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean tabCompletes() {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java
|
diff --git a/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
|
@@ -9,14 +9,6 @@ diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
package io.papermc.paper.command;
|
|
||||||
|
|
||||||
import io.papermc.paper.command.subcommands.ChunkDebugCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.DumpItemCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.EntityCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.FixLightCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
commands.put(Set.of("fixlight"), new FixLightCommand());
|
commands.put(Set.of("fixlight"), new FixLightCommand());
|
||||||
commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
|
commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
|
||||||
|
@@ -11558,15 +11558,8 @@ diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
package io.papermc.paper.command;
|
|
||||||
|
|
||||||
+import io.papermc.paper.command.subcommands.ChunkDebugCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.EntityCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.FixLightCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
commands.put(Set.of("version"), new VersionCommand());
|
commands.put(Set.of("callback"), new CallbackCommand());
|
||||||
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
||||||
commands.put(Set.of("fixlight"), new FixLightCommand());
|
commands.put(Set.of("fixlight"), new FixLightCommand());
|
||||||
+ commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
|
+ commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
|
||||||
|
@@ -4334,17 +4334,9 @@ diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
package io.papermc.paper.command;
|
|
||||||
|
|
||||||
import io.papermc.paper.command.subcommands.EntityCommand;
|
|
||||||
+import io.papermc.paper.command.subcommands.FixLightCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.HeapDumpCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.ReloadCommand;
|
|
||||||
import io.papermc.paper.command.subcommands.VersionCommand;
|
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
commands.put(Set.of("reload"), new ReloadCommand());
|
|
||||||
commands.put(Set.of("version"), new VersionCommand());
|
commands.put(Set.of("version"), new VersionCommand());
|
||||||
|
commands.put(Set.of("callback"), new CallbackCommand());
|
||||||
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
||||||
+ commands.put(Set.of("fixlight"), new FixLightCommand());
|
+ commands.put(Set.of("fixlight"), new FixLightCommand());
|
||||||
|
|
||||||
|
@@ -842,6 +842,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
||||||
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
||||||
+ MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
|
+ MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
|
||||||
|
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
||||||
this.profiler.push("commandFunctions");
|
this.profiler.push("commandFunctions");
|
||||||
- SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot
|
- SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot
|
||||||
+ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
|
+ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
|
||||||
|
Reference in New Issue
Block a user