Search in sources :

Example 1 with ChaosAwakens

use of io.github.chaosawakens.ChaosAwakens in project ChaosAwakens by ChaosAwakens.

the class CACommand method register.

public static int register(CommandDispatcher<CommandSource> dispatcher) {
    dispatcher.register(Commands.literal("chaosawakens").requires((commandSource) -> commandSource.hasPermission(1)).then(Commands.literal("website").executes((commandSource) -> {
        ITextComponent itextcomponent = new StringTextComponent("https://chaosawakens.github.io").withStyle((style) -> style.withColor(TextFormatting.LIGHT_PURPLE).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://chaosawakens.github.io")));
        commandSource.getSource().getServer().getPlayerList().broadcastMessage(itextcomponent, ChatType.SYSTEM, Util.NIL_UUID);
        return 0;
    })).then(Commands.literal("discord").executes((commandSource) -> {
        ITextComponent itextcomponent = new StringTextComponent("https://discord.com/invite/TmVqnT5Zmj").withStyle((style) -> style.withColor(TextFormatting.BLUE).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://discord.com/invite/TmVqnT5Zmj")));
        commandSource.getSource().getServer().getPlayerList().broadcastMessage(itextcomponent, ChatType.SYSTEM, Util.NIL_UUID);
        return 0;
    })).then(Commands.literal("github").executes((commandSource) -> {
        ITextComponent itextcomponent = new StringTextComponent("https://github.com/ChaosAwakens/ChaosAwakens").withStyle((style) -> style.withColor(TextFormatting.DARK_PURPLE).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/ChaosAwakens/ChaosAwakens")));
        commandSource.getSource().getServer().getPlayerList().broadcastMessage(itextcomponent, ChatType.SYSTEM, Util.NIL_UUID);
        return 0;
    })).then(Commands.literal("wiki").executes((commandSource) -> {
        ITextComponent itextcomponent = new StringTextComponent("https://chaos-awakens.fandom.com/wiki/Chaos_Awakens_Wiki").withStyle((style) -> style.withColor(TextFormatting.DARK_GRAY).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://chaos-awakens.fandom.com/wiki/Chaos_Awakens_Wiki")));
        commandSource.getSource().getServer().getPlayerList().broadcastMessage(itextcomponent, ChatType.SYSTEM, Util.NIL_UUID);
        return 0;
    })).then(Commands.literal("reddit").executes((commandSource) -> {
        ITextComponent itextcomponent = new StringTextComponent("https://www.reddit.com/r/ChaosAwakens").withStyle((style) -> style.withColor(TextFormatting.RED).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.reddit.com/r/ChaosAwakens")));
        commandSource.getSource().getServer().getPlayerList().broadcastMessage(itextcomponent, ChatType.SYSTEM, Util.NIL_UUID);
        return 0;
    })).then(Commands.literal("version").executes((commandSource) -> {
        ITextComponent itextcomponent = new StringTextComponent(ChaosAwakens.MODNAME + " Version is: " + ChaosAwakens.VERSION).withStyle((style) -> style.withColor(TextFormatting.DARK_RED));
        commandSource.getSource().getServer().getPlayerList().broadcastMessage(itextcomponent, ChatType.SYSTEM, Util.NIL_UUID);
        return 0;
    })));
    return 0;
}
Also used : ChaosAwakens(io.github.chaosawakens.ChaosAwakens) CommandSource(net.minecraft.command.CommandSource) CommandDispatcher(com.mojang.brigadier.CommandDispatcher) Util(net.minecraft.util.Util) TextFormatting(net.minecraft.util.text.TextFormatting) ClickEvent(net.minecraft.util.text.event.ClickEvent) StringTextComponent(net.minecraft.util.text.StringTextComponent) ChatType(net.minecraft.util.text.ChatType) Commands(net.minecraft.command.Commands) ITextComponent(net.minecraft.util.text.ITextComponent) ClickEvent(net.minecraft.util.text.event.ClickEvent) ITextComponent(net.minecraft.util.text.ITextComponent) StringTextComponent(net.minecraft.util.text.StringTextComponent)

Aggregations

CommandDispatcher (com.mojang.brigadier.CommandDispatcher)1 ChaosAwakens (io.github.chaosawakens.ChaosAwakens)1 CommandSource (net.minecraft.command.CommandSource)1 Commands (net.minecraft.command.Commands)1 Util (net.minecraft.util.Util)1 ChatType (net.minecraft.util.text.ChatType)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 StringTextComponent (net.minecraft.util.text.StringTextComponent)1 TextFormatting (net.minecraft.util.text.TextFormatting)1 ClickEvent (net.minecraft.util.text.event.ClickEvent)1