Add LocationArgument to cloud-bukkit (#63)

*  Add LocationArgument to cloud-bukkit

* 🎨 Use the Bukkit CommandSender from the command context in LocationArgument

* 🐛 Fixed quoted parsing in StringArgument

* 📚 Fix code style

Co-authored-by: jmp <jasonpenilla2@me.com>
This commit is contained in:
Alexander Söderberg 2020-10-18 00:22:48 +02:00
parent 1249b74e83
commit 79aefb05b5
14 changed files with 653 additions and 14 deletions

View file

@ -59,6 +59,7 @@ import cloud.commandframework.extra.confirmation.CommandConfirmationManager;
import cloud.commandframework.meta.CommandMeta;
import cloud.commandframework.minecraft.extras.TextColorArgument;
import cloud.commandframework.paper.PaperCommandManager;
import cloud.commandframework.tasks.TaskConsumer;
import cloud.commandframework.types.tuples.Triplet;
import io.leangen.geantyref.TypeToken;
import net.kyori.adventure.identity.Identity;
@ -447,4 +448,13 @@ public final class ExamplePlugin extends JavaPlugin {
);
}
@CommandMethod("example teleport complex <location>")
private void teleportComplex(
final @NonNull Player sender,
final @NonNull @Argument("location") Location location
) {
this.manager.taskRecipe().begin(location).synchronous((@NonNull TaskConsumer<Location>) sender::teleport)
.execute(() -> sender.sendMessage("You have been teleported!"));
}
}