use of net.minecraft.text.BaseText in project meteor-client by MeteorDevelopment.
the class ModulesCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
ChatUtils.info("--- Modules ((highlight)%d(default)) ---", Modules.get().getCount());
Modules.loopCategories().forEach(category -> {
BaseText categoryMessage = new LiteralText("");
Modules.get().getGroup(category).forEach(module -> categoryMessage.append(getModuleText(module)));
ChatUtils.sendMsg(category.name, categoryMessage);
});
return SINGLE_SUCCESS;
});
}
use of net.minecraft.text.BaseText in project meteor-client by MeteorDevelopment.
the class ModulesCommand method getModuleText.
private BaseText getModuleText(Module module) {
// Hover tooltip
BaseText tooltip = new LiteralText("");
tooltip.append(new LiteralText(module.title).formatted(Formatting.BLUE, Formatting.BOLD)).append("\n");
tooltip.append(new LiteralText(module.name).formatted(Formatting.GRAY)).append("\n\n");
tooltip.append(new LiteralText(module.description).formatted(Formatting.WHITE));
BaseText finalModule = new LiteralText(module.title);
if (!module.equals(Modules.get().getGroup(module.category).get(Modules.get().getGroup(module.category).size() - 1)))
finalModule.append(new LiteralText(", ").formatted(Formatting.GRAY));
finalModule.setStyle(finalModule.getStyle().withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)));
return finalModule;
}
use of net.minecraft.text.BaseText in project meteor-client by MeteorDevelopment.
the class CommandsCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
ChatUtils.info("--- Commands ((highlight)%d(default)) ---", Commands.get().getCount());
BaseText commands = new LiteralText("");
Commands.get().getAll().forEach(command -> commands.append(getCommandText(command)));
ChatUtils.sendMsg(commands);
return SINGLE_SUCCESS;
});
}
use of net.minecraft.text.BaseText in project Client by MatHax.
the class ChatEncryption method onMessageReceive.
@EventHandler
private void onMessageReceive(ReceiveMessageEvent event) {
((ChatHudAccessor) mc.inGameHud.getChatHud()).getVisibleMessages().removeIf((message) -> message.getId() == event.id && event.id != 0);
((ChatHudAccessor) mc.inGameHud.getChatHud()).getMessages().removeIf((message) -> message.getId() == event.id && event.id != 0);
Text message = event.getMessage();
if (message.getString().endsWith(suffix.get()) && !suffix.get().isEmpty()) {
String[] msg = message.getString().split(encryptedPrefix);
try {
String chat = decrypt(msg[1], customKey.get() ? groupKey.get() : password);
BaseText prefixOpenBorder = new LiteralText("[");
prefixOpenBorder.setStyle(prefixOpenBorder.getStyle().withFormatting(Formatting.GRAY));
BaseText prefix = new LiteralText("Encrypted Chat");
prefix.setStyle(prefix.getStyle().withColor(MatHax.INSTANCE.MATHAX_COLOR.getPacked()));
BaseText prefixCloseBorder = new LiteralText("] ");
prefixCloseBorder.setStyle(prefixCloseBorder.getStyle().withFormatting(Formatting.GRAY));
BaseText chatText = new LiteralText(msg[0] + chat);
chatText.setStyle(chatText.getStyle().withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(msg[1]))));
BaseText chatMessage = new LiteralText("");
if (Modules.get().get(BetterChat.class).displayPlayerHeads())
chatMessage.append(" ");
chatMessage.append(prefixOpenBorder);
chatMessage.append(prefix);
chatMessage.append(prefixCloseBorder);
chatMessage.append(chatText);
message = chatMessage;
} catch (Exception exception) {
message = event.getMessage();
}
}
event.setMessage(message);
}
use of net.minecraft.text.BaseText in project Client by MatHax.
the class CommandsCommand method getCommandText.
private BaseText getCommandText(Command command) {
// Hover tooltip
BaseText tooltip = new LiteralText("");
tooltip.append(new LiteralText(Utils.nameToTitle(command.getName())).formatted(Formatting.BLUE, Formatting.BOLD)).append("\n");
BaseText aliases = new LiteralText(Config.get().prefix + command.getName());
if (command.getAliases().size() > 0) {
aliases.append(", ");
for (String alias : command.getAliases()) {
if (alias.isEmpty())
continue;
aliases.append(Config.get().prefix + alias);
if (!alias.equals(command.getAliases().get(command.getAliases().size() - 1)))
aliases.append(", ");
}
}
tooltip.append(aliases.formatted(Formatting.GRAY)).append("\n\n");
tooltip.append(new LiteralText(command.getDescription()).formatted(Formatting.WHITE));
// Text
BaseText text = new LiteralText(Utils.nameToTitle(command.getName()));
if (command != Commands.get().getAll().get(Commands.get().getAll().size() - 1))
text.append(new LiteralText(", ").formatted(Formatting.GRAY));
text.setStyle(text.getStyle().withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)).withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, Config.get().prefix + command.getName())));
return text;
}
Aggregations