[Brigadier] Forks and redirects
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 45/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- java
- Ambito
- documentation
Direzione di ricerca
Inizia individuando la pagina degli argomenti avanzati della documentazione di Paper Brigadier ed esamina l’esempio Java fornito insieme a CommandSourceStack#withExecutor/Location. Documenta le differenze tra .fork, .forward e .redirect, includi un esempio e indica la disponibilità a partire dalla versione 1.21.4.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[!NOTE]
This issue is part of a series of issues regarding the extension of the Paper documentation regarding Paper's Brigadier API.
Continuing with the advanced topics, there should also be a page noting the usage of .fork, .forward, and .redirect. Thanks to https://github.com/PaperMC/Paper/pull/11868, this can now be achieved without the usage of internals or userdev.
Basically, the difference between these "flow controlling" methods should be noted and an example should be given. Furthermore, a reference to the CommandSourceStack#withExecutor/Location should be included. The fact that this is only available since the middle of version 1.21.4 could also be helpful.
A possible example could look like this:
final CommandDispatcher<CommandSourceStack> dispatcher = commands.getDispatcher();
final LiteralCommandNode<CommandSourceStack> node = dispatcher.register(Commands.literal("say")
.then(Commands.literal("hi")
.executes(ctx -> {
if (ctx.getSource().getExecutor() instanceof Entity entity) {
Bukkit.broadcast(MiniMessage.miniMessage().deserialize("<aqua><entity></aqua> says hi!",
Placeholder.component("entity", entity.name())
));
}
return 1;
})));
dispatcher.register(Commands.literal("say-five").forward(node, ctx -> {
final List<CommandSourceStack> stacks = new ArrayList<>();
final List<Entity> entities = ctx.getSource().getLocation().getWorld().getEntities().stream().toList();
for (int i = 0; i < 5; i++) {
if (entities.size() < i) {
break;
}
stacks.add(ctx.getSource().withExecutor(entities.get(i)));
}
return stacks;
}, true));
- Lingua principale
- MDX
- Stelle
- 74
- Fork
- 281
- Merge medio
- 6g 52m
- PR unite (30g)
- 6
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PaperMC/docs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Improve Menu Type exampleAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Tutte le issue di PaperMC/docs
Issue simili
-
Link Checker ReportApertaautomated issue report
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
PedestrianDynamics/pyFDS-Evac#475 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ethereum/execution-apis#915 ·
I maintainer di solito rispondono entro 1 giorno
-
area:ansible source:reader type:content-error
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
stephrobert/blog-roadmap#42 ·