use of ivorius.reccomplex.world.gen.feature.structure.generic.Metadata in project RecurrentComplex by Ivorforce.
the class CommandLookupStructure method execute.
@Override
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException {
RCParameters parameters = RCParameters.of(args);
String id = parameters.get().first().require();
GenericStructure structure = parameters.rc().genericStructure().require();
Metadata metadata = structure.metadata;
boolean hasWeblink = !metadata.weblink.trim().isEmpty();
ITextComponent weblink = hasWeblink ? new TextComponentString(RCStrings.abbreviateFormatted(metadata.weblink, 30)) : ServerTranslations.format("commands.rclookup.reply.nolink");
if (hasWeblink) {
weblink.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, metadata.weblink));
weblink.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(metadata.weblink)));
}
ITextComponent level = new TextComponentString(StructureRegistry.INSTANCE.status(id).getLevel().toString());
level.getStyle().setColor(TextFormatting.YELLOW);
commandSender.sendMessage(ServerTranslations.format(StructureRegistry.INSTANCE.hasActive(id) ? "commands.rclookup.reply.generates" : "commands.rclookup.reply.silent", id, RCTextStyle.users(metadata.authors), level, weblink));
if (!metadata.comment.trim().isEmpty())
commandSender.sendMessage(ServerTranslations.format("commands.rclookup.reply.comment", metadata.comment));
}
Aggregations