Search in sources :

Example 1 with Friend

use of meteordevelopment.meteorclient.systems.friends.Friend in project meteor-client by MeteorDevelopment.

the class BetterTab method getPlayerName.

public Text getPlayerName(PlayerListEntry playerListEntry) {
    Text name;
    Color color = null;
    name = playerListEntry.getDisplayName();
    if (name == null)
        name = new LiteralText(playerListEntry.getProfile().getName());
    if (playerListEntry.getProfile().getId().toString().equals(mc.player.getGameProfile().getId().toString()) && self.get()) {
        color = selfColor.get();
    } else if (friends.get() && Friends.get().get(playerListEntry.getProfile().getName()) != null) {
        Friend friend = Friends.get().get(playerListEntry.getProfile().getName());
        if (friend != null)
            color = Friends.get().color;
    }
    if (color != null) {
        String nameString = name.getString();
        for (Formatting format : Formatting.values()) {
            if (format.isColor())
                nameString = nameString.replace(format.toString(), "");
        }
        name = new LiteralText(nameString).setStyle(name.getStyle().withColor(new TextColor(color.getPacked())));
    }
    return name;
}
Also used : Friend(meteordevelopment.meteorclient.systems.friends.Friend) Color(meteordevelopment.meteorclient.utils.render.color.Color) SettingColor(meteordevelopment.meteorclient.utils.render.color.SettingColor) TextColor(net.minecraft.text.TextColor) Formatting(net.minecraft.util.Formatting) LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text) TextColor(net.minecraft.text.TextColor) LiteralText(net.minecraft.text.LiteralText)

Example 2 with Friend

use of meteordevelopment.meteorclient.systems.friends.Friend in project meteor-client by MeteorDevelopment.

the class FriendsCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.then(literal("add").then(argument("friend", FriendArgumentType.friend()).executes(context -> {
        Friend friend = FriendArgumentType.getFriend(context, "friend");
        if (Friends.get().add(friend))
            info("Added (highlight)%s (default)to friends.", friend.name);
        else
            error("That person is already your friend.");
        return SINGLE_SUCCESS;
    })));
    builder.then(literal("remove").then(argument("friend", FriendArgumentType.friend()).executes(context -> {
        Friend friend = FriendArgumentType.getFriend(context, "friend");
        if (Friends.get().remove(friend))
            info("Removed (highlight)%s (default)from friends.", friend.name);
        else
            error("That person is not your friend.");
        return SINGLE_SUCCESS;
    })));
    builder.then(literal("list").executes(context -> {
        info("--- Friends ((highlight)%s(default)) ---", Friends.get().count());
        Friends.get().forEach(friend -> ChatUtils.info("(highlight)" + friend.name));
        return SINGLE_SUCCESS;
    }));
}
Also used : Arrays(java.util.Arrays) Suggestions(com.mojang.brigadier.suggestion.Suggestions) CommandContext(com.mojang.brigadier.context.CommandContext) Collection(java.util.Collection) CompletableFuture(java.util.concurrent.CompletableFuture) ArgumentType(com.mojang.brigadier.arguments.ArgumentType) Collectors(java.util.stream.Collectors) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) CommandSource(net.minecraft.command.CommandSource) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) Friends(meteordevelopment.meteorclient.systems.friends.Friends) Command(meteordevelopment.meteorclient.systems.commands.Command) CommandSource.suggestMatching(net.minecraft.command.CommandSource.suggestMatching) Friend(meteordevelopment.meteorclient.systems.friends.Friend) ChatUtils(meteordevelopment.meteorclient.utils.player.ChatUtils) StringReader(com.mojang.brigadier.StringReader) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) SuggestionsBuilder(com.mojang.brigadier.suggestion.SuggestionsBuilder) Friend(meteordevelopment.meteorclient.systems.friends.Friend)

Aggregations

Friend (meteordevelopment.meteorclient.systems.friends.Friend)2 SINGLE_SUCCESS (com.mojang.brigadier.Command.SINGLE_SUCCESS)1 StringReader (com.mojang.brigadier.StringReader)1 ArgumentType (com.mojang.brigadier.arguments.ArgumentType)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1 CommandContext (com.mojang.brigadier.context.CommandContext)1 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 Suggestions (com.mojang.brigadier.suggestion.Suggestions)1 SuggestionsBuilder (com.mojang.brigadier.suggestion.SuggestionsBuilder)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 Collectors (java.util.stream.Collectors)1 Command (meteordevelopment.meteorclient.systems.commands.Command)1 Friends (meteordevelopment.meteorclient.systems.friends.Friends)1 ChatUtils (meteordevelopment.meteorclient.utils.player.ChatUtils)1 Color (meteordevelopment.meteorclient.utils.render.color.Color)1 SettingColor (meteordevelopment.meteorclient.utils.render.color.SettingColor)1 CommandSource (net.minecraft.command.CommandSource)1 CommandSource.suggestMatching (net.minecraft.command.CommandSource.suggestMatching)1