mirror of https://github.com/PaperMC/Paper.git
update
This commit is contained in:
parent
35ce2b1608
commit
0e18effa23
|
@ -9,7 +9,7 @@ import java.util.function.Predicate;
|
|||
* Brigadier {@link Command}, {@link SuggestionProvider}, and permission checker for Bukkit {@link Command}s.
|
||||
*
|
||||
* @param <S> command source type
|
||||
* @deprecated For removal, use the new brigadier api.
|
||||
* @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API.
|
||||
*/
|
||||
@Deprecated(forRemoval = true) // Paper
|
||||
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Entity;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @deprecated For removal, use the new brigadier api.
|
||||
* @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API.
|
||||
*/
|
||||
@Deprecated(forRemoval = true) // Paper
|
||||
public interface BukkitBrigadierCommandSource {
|
||||
|
|
|
@ -28,10 +28,10 @@ import org.jetbrains.annotations.NotNull;
|
|||
* <p>If your logic is not safe to run asynchronously, only react to the synchronous version.</p>
|
||||
*
|
||||
* <p>This is a draft/experimental API and is subject to change.</p>
|
||||
* @deprecated For removal, use the new brigadier api.
|
||||
* @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@Deprecated
|
||||
@Deprecated(forRemoval = true)
|
||||
public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSource> extends PlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
|
||||
/**
|
||||
* Helper methods to bridge the gaps between Brigadier and Paper-MojangAPI.
|
||||
* @deprecated For removal, use the new brigadier api.
|
||||
* @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API.
|
||||
*/
|
||||
@Deprecated(forRemoval = true) // Paper
|
||||
public final class PaperBrigadier {
|
||||
|
|
|
@ -5,14 +5,14 @@ Subject: [PATCH] Brigadier based command API
|
|||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 65e67b8726f1e19a6bcb1fe2f448e4ab68df11d1..475487c7d5adb3bebbd26cd571848ed9c2e3b395 100644
|
||||
index 65e67b8726f1e19a6bcb1fe2f448e4ab68df11d1..c252ce446cab6ff7ce530a591e40bf1168d9bc7c 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -27,6 +27,7 @@ configurations.api {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
+ api("com.mojang:brigadier:1.1.8") // Paper, expose!
|
||||
+ api("com.mojang:brigadier:1.1.8") // Paper - Brigadier command api
|
||||
// api dependencies are listed transitively to API consumers
|
||||
api("com.google.guava:guava:32.1.2-jre")
|
||||
api("com.google.code.gson:gson:2.10.1")
|
||||
|
@ -365,10 +365,10 @@ index 0000000000000000000000000000000000000000..c30a6e6924c0d515f6ba1eef63511367
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java b/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e9059ca88cbb1a82356ccb5eae6360a73cfce318
|
||||
index 0000000000000000000000000000000000000000..7aaa70648f26c3aa5ad5b4b9942b78c9df8d23c0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java
|
||||
@@ -0,0 +1,303 @@
|
||||
@@ -0,0 +1,304 @@
|
||||
+package io.papermc.paper.command.brigadier.argument;
|
||||
+
|
||||
+import com.mojang.brigadier.arguments.ArgumentType;
|
||||
|
@ -392,6 +392,7 @@ index 0000000000000000000000000000000000000000..e9059ca88cbb1a82356ccb5eae6360a7
|
|||
+import org.bukkit.World;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.block.structure.Mirror;
|
||||
+import org.bukkit.block.structure.StructureRotation;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.bukkit.scoreboard.Criteria;
|
||||
+import org.bukkit.scoreboard.DisplaySlot;
|
||||
|
@ -667,7 +668,7 @@ index 0000000000000000000000000000000000000000..e9059ca88cbb1a82356ccb5eae6360a7
|
|||
+ *
|
||||
+ * @return argument
|
||||
+ */
|
||||
+ public static @NotNull ArgumentType<Rotation> templateRotation() {
|
||||
+ public static @NotNull ArgumentType<StructureRotation> templateRotation() {
|
||||
+ return PROVIDER.templateRotation();
|
||||
+ }
|
||||
+
|
||||
|
@ -832,10 +833,10 @@ index 0000000000000000000000000000000000000000..07051125a3b4963fb5c7b45bd1d5e93f
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProvider.java b/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProvider.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..45e0e76d276b4ac87eb1ae3b01a10467a71edb11
|
||||
index 0000000000000000000000000000000000000000..a9bf62827d46c795f0b3b12de5bcdd825f4f546a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProvider.java
|
||||
@@ -0,0 +1,86 @@
|
||||
@@ -0,0 +1,87 @@
|
||||
+package io.papermc.paper.command.brigadier.argument;
|
||||
+
|
||||
+import com.mojang.brigadier.arguments.ArgumentType;
|
||||
|
@ -858,6 +859,7 @@ index 0000000000000000000000000000000000000000..45e0e76d276b4ac87eb1ae3b01a10467
|
|||
+import org.bukkit.World;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.block.structure.Mirror;
|
||||
+import org.bukkit.block.structure.StructureRotation;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.bukkit.scoreboard.Criteria;
|
||||
+import org.bukkit.scoreboard.DisplaySlot;
|
||||
|
@ -920,7 +922,7 @@ index 0000000000000000000000000000000000000000..45e0e76d276b4ac87eb1ae3b01a10467
|
|||
+
|
||||
+ ArgumentType<Mirror> templateMirror();
|
||||
+
|
||||
+ ArgumentType<Rotation> templateRotation();
|
||||
+ ArgumentType<StructureRotation> templateRotation();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/predicate/ItemStackPredicate.java b/src/main/java/io/papermc/paper/command/brigadier/argument/predicate/ItemStackPredicate.java
|
||||
new file mode 100644
|
||||
|
|
|
@ -865,10 +865,10 @@ index 0000000000000000000000000000000000000000..5c380b62738244c4045c6678e22f167c
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProviderImpl.java b/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProviderImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5a7e587f5772a8b314cf93f50486c4df78c998e3
|
||||
index 0000000000000000000000000000000000000000..a913f75269d57a51c2e231de8c18a0d4757a7415
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProviderImpl.java
|
||||
@@ -0,0 +1,311 @@
|
||||
@@ -0,0 +1,312 @@
|
||||
+package io.papermc.paper.command.brigadier.argument;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.CraftPlayerProfile;
|
||||
|
@ -941,6 +941,7 @@ index 0000000000000000000000000000000000000000..5a7e587f5772a8b314cf93f50486c4df
|
|||
+import org.bukkit.World;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.block.structure.Mirror;
|
||||
+import org.bukkit.block.structure.StructureRotation;
|
||||
+import org.bukkit.craftbukkit.CraftHeightMap;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlockStates;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
|
@ -1136,8 +1137,8 @@ index 0000000000000000000000000000000000000000..5a7e587f5772a8b314cf93f50486c4df
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArgumentType<Rotation> templateRotation() {
|
||||
+ return this.of(TemplateRotationArgument.templateRotation(), mirror -> Rotation.valueOf(mirror.name()));
|
||||
+ public ArgumentType<StructureRotation> templateRotation() {
|
||||
+ return this.of(TemplateRotationArgument.templateRotation(), mirror -> StructureRotation.valueOf(mirror.name()));
|
||||
+ }
|
||||
+
|
||||
+ private <B, C> ArgumentType<C> of(ArgumentType<B> base, ResultConverter<B, C> converter) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
public class IceCreamTypeArgument implements CustomArgumentType.Converted<IceCreamType, String> {
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull IceCreamType convert(String nativeType) throws CommandSyntaxException {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue