Search in sources :

Example 1 with SpongeCommandSender

use of io.github.wysohn.triggerreactor.sponge.bridge.SpongeCommandSender in project TriggerReactor by wysohn.

the class TriggerReactor method onInitialize.

@Listener
public void onInitialize(GameAboutToStartServerEvent e) {
    Sponge.getCommandManager().register(this, new CommandCallable() {

        @Override
        public CommandResult process(CommandSource src, String args) throws CommandException {
            if (src instanceof Player) {
                onCommand(new SpongePlayer((Player) src), "triggerreactor", args.split(" "));
            } else {
                onCommand(new SpongeCommandSender(src), "triggerreactor", args.split(" "));
            }
            return CommandResult.success();
        }

        @Override
        public List<String> getSuggestions(CommandSource source, String arguments, Location<World> targetPosition) throws CommandException {
            // return io.github.wysohn.triggerreactor.core.main.TriggerReactor.onTabComplete(arguments.split(" "));
            return new ArrayList<>();
        }

        @Override
        public boolean testPermission(CommandSource source) {
            return source.hasPermission("triggerreactor.admin");
        }

        @Override
        public Optional<Text> getShortDescription(CommandSource source) {
            return Optional.of(Text.of("TriggerReactor"));
        }

        @Override
        public Optional<Text> getHelp(CommandSource source) {
            return Optional.of(Text.of("/trg for details"));
        }

        @Override
        public Text getUsage(CommandSource source) {
            return Text.of("/trg for details");
        }
    }, "trg", "trigger");
    migrateOldConfig();
}
Also used : SpongeCommandSender(io.github.wysohn.triggerreactor.sponge.bridge.SpongeCommandSender) IPlayer(io.github.wysohn.triggerreactor.core.bridge.entity.IPlayer) Player(org.spongepowered.api.entity.living.player.Player) DelegatedPlayer(io.github.wysohn.triggerreactor.sponge.tools.DelegatedPlayer) SpongePlayer(io.github.wysohn.triggerreactor.sponge.bridge.entity.SpongePlayer) SpongePlayer(io.github.wysohn.triggerreactor.sponge.bridge.entity.SpongePlayer) Text(org.spongepowered.api.text.Text) CommandException(org.spongepowered.api.command.CommandException) CommandSource(org.spongepowered.api.command.CommandSource) World(org.spongepowered.api.world.World) CommandCallable(org.spongepowered.api.command.CommandCallable) CommandResult(org.spongepowered.api.command.CommandResult) Listener(org.spongepowered.api.event.Listener)

Aggregations

IPlayer (io.github.wysohn.triggerreactor.core.bridge.entity.IPlayer)1 SpongeCommandSender (io.github.wysohn.triggerreactor.sponge.bridge.SpongeCommandSender)1 SpongePlayer (io.github.wysohn.triggerreactor.sponge.bridge.entity.SpongePlayer)1 DelegatedPlayer (io.github.wysohn.triggerreactor.sponge.tools.DelegatedPlayer)1 CommandCallable (org.spongepowered.api.command.CommandCallable)1 CommandException (org.spongepowered.api.command.CommandException)1 CommandResult (org.spongepowered.api.command.CommandResult)1 CommandSource (org.spongepowered.api.command.CommandSource)1 Player (org.spongepowered.api.entity.living.player.Player)1 Listener (org.spongepowered.api.event.Listener)1 Text (org.spongepowered.api.text.Text)1 World (org.spongepowered.api.world.World)1