Search in sources :

Example 1 with WorldRandomData

use of ivorius.reccomplex.world.gen.feature.WorldRandomData in project RecurrentComplex by Ivorforce.

the class RCForgeEventHandler method onPlayerJoin.

@SubscribeEvent
public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) {
    if (RCConfig.postWorldStatus && event.player.canUseCommand(3, "op")) {
        WorldRandomData randomData = WorldRandomData.get(FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld());
        if (randomData.postWorldStatus(event.player.getName())) {
            event.player.getServer().commandManager.executeCommand(event.player, RCCommands.sanity.getName() + " --silent --short");
            ITextComponent count = new TextComponentString("" + StructureRegistry.INSTANCE.activeIDs().size());
            count.getStyle().setColor(TextFormatting.AQUA);
            ITextComponent list = new TextComponentString("[List]");
            list.getStyle().setColor(TextFormatting.AQUA);
            list.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Show List")));
            list.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/%s", RCCommands.list.getName())));
            ITextComponent add = new TextComponentString("[Add]");
            add.getStyle().setColor(TextFormatting.GREEN);
            add.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Browse Repository")));
            add.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, Repository.browseURL()));
            ITextComponent remove = new TextComponentString("[Remove]");
            remove.getStyle().setColor(TextFormatting.RED);
            remove.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Disabling Structures")));
            remove.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, Wiki.DISABLING_STRUCTURES));
            ITextComponent help = new TextComponentString("[Help]");
            help.getStyle().setColor(TextFormatting.AQUA);
            help.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Open Wiki")));
            help.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, Wiki.HOME));
            ITextComponent statusMessage = ServerTranslations.format("reccomplex.server.status", count, list, add, remove, help);
            event.player.sendMessage(statusMessage);
        }
    }
}
Also used : HoverEvent(net.minecraft.util.text.event.HoverEvent) WorldRandomData(ivorius.reccomplex.world.gen.feature.WorldRandomData) ClickEvent(net.minecraft.util.text.event.ClickEvent) ITextComponent(net.minecraft.util.text.ITextComponent) TextComponentString(net.minecraft.util.text.TextComponentString) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

WorldRandomData (ivorius.reccomplex.world.gen.feature.WorldRandomData)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 TextComponentString (net.minecraft.util.text.TextComponentString)1 ClickEvent (net.minecraft.util.text.event.ClickEvent)1 HoverEvent (net.minecraft.util.text.event.HoverEvent)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1