crwdns156521:0crwdne156521:0
crwdns156523:0crwdne156523:0
crwdns156525:0:javadoc:crwdnd156525:0:javadoc:crwdne156525:0
crwdns156527:0:javadoc:crwdne156527:0
crwdns156529:0crwdne156529:0
crwdns156531:0:javadoc:crwdnd156531:0:javadoc:crwdnd156531:0:javadoc:crwdnd156531:0:javadoc:crwdne156531:0
crwdns156533:0:javadoc:crwdnd156533:0:javadoc:crwdne156533:0
crwdns156535:0crwdne156535:0
import org.spongepowered.api.command.parameter.CommandContext;
import org.spongepowered.api.command.parameter.Parameter;
import org.spongepowered.api.command.Command;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
public Command.Parameterized createMessageCommand(){
Parameter.Value<ServerPlayer> playerParameter = Parameter.player().key("player").build();
Parameter.Value<String> messageParameter = Parameter.remainingJoinedStrings().key("message").build();
return Command
.builder()
.executor((CommandContext context) -> {
ServerPlayer player = context.requireOne(playerParameter);
String message = context.requireOne(messageParameter);
player.sendMessage(Component.text(message));
return CommandResult.success();
})
.addParameter(playerParameter, messageParameter)
.build();
}
Note
crwdns156829:0:javadoc:crwdnd156829:0:javadoc:crwdne156829:0
crwdns156537:0crwdne156537:0
crwdns156539:0crwdne156539:0 |
crwdns156541:0crwdne156541:0 |
crwdns156543:0crwdne156543:0 |
---|---|---|
crwdns156545:0crwdne156545:0 |
crwdns156547:0crwdne156547:0 |
crwdns156549:0crwdne156549:0 |
crwdns156551:0crwdne156551:0 |
crwdns156553:0crwdne156553:0 |
crwdns156549:0crwdne156549:0 |
crwdns156555:0crwdne156555:0 |
crwdns156557:0crwdne156557:0 |
crwdns156559:0crwdne156559:0 |
crwdns156561:0crwdne156561:0 |
crwdns156563:0crwdne156563:0 |
crwdns156565:0crwdne156565:0 |
crwdns156567:0crwdne156567:0 |
crwdns156569:0crwdne156569:0 |
crwdns156565:0crwdne156565:0 |
crwdns156571:0crwdne156571:0 |
crwdns156573:0crwdne156573:0 |
crwdns156575:0crwdne156575:0 |
crwdns156577:0crwdne156577:0 |
crwdns156579:0crwdne156579:0 |
crwdns156575:0crwdne156575:0 |
crwdns156581:0crwdne156581:0 |
crwdns156583:0crwdne156583:0 |
crwdns156585:0crwdne156585:0 |
crwdns156587:0crwdne156587:0 |
crwdns156589:0crwdne156589:0 |
crwdns156591:0crwdne156591:0 |
crwdns156593:0crwdne156593:0 |
crwdns156595:0crwdne156595:0 |
crwdns156597:0crwdne156597:0 |
crwdns156599:0crwdne156599:0 |
crwdns156601:0crwdne156601:0 |
crwdns156603:0crwdne156603:0 |
crwdns156605:0crwdne156605:0 |
crwdns156607:0crwdne156607:0 |
crwdns156609:0crwdne156609:0 |
crwdns156611:0crwdne156611:0 |
crwdns156613:0crwdne156613:0 |
crwdns156615:0crwdne156615:0 |
crwdns156617:0crwdne156617:0 |
crwdns156619:0crwdne156619:0 |
crwdns156615:0crwdne156615:0 |
crwdns156621:0crwdne156621:0 |
crwdns156623:0crwdne156623:0 |
crwdns156625:0crwdne156625:0 |
crwdns156627:0crwdne156627:0 |
crwdns156629:0crwdne156629:0 |
crwdns156631:0crwdne156631:0 |
crwdns156633:0crwdne156633:0 |
crwdns156635:0crwdne156635:0 |
crwdns156637:0crwdne156637:0 |
crwdns156639:0crwdne156639:0 |
crwdns156641:0crwdne156641:0 |
crwdns156643:0crwdne156643:0 |
crwdns156645:0crwdne156645:0 |
crwdns156647:0crwdne156647:0 |
crwdns156649:0crwdne156649:0 |
Tip
crwdns156651:0:javadoc:crwdne156651:0
Warning
crwdns156653:0crwdne156653:0
crwdns156655:0crwdne156655:0
crwdns156657:0:javadoc:crwdnd156657:0:javadoc:crwdne156657:0
crwdns156659:0crwdne156659:0
crwdns156661:0crwdne156661:0
crwdns156663:0crwdne156663:0
Parameter.Value<Vector2i> vectorParameter = Parameter
.builder(Vector2i.class)
.addParser((
Parameter.Key<Vector2i> parameterKey,
ArgumentReader.Mutable reader,
CommandContext.Builder context) -> {
int x = reader.parseInt();
int y = reader.parseInt();
return new Vector2i(x, y);
})
.key("vector")
.build();
Tip
crwdns156665:0:javadoc:crwdne156665:0