Search in sources :

Example 1 with ValueTrios

use of com.loohp.interactivechat.objectholders.ValueTrios in project InteractiveChat by LOOHP.

the class BungeeMessageListener method onPluginMessageReceived.

@SuppressWarnings("deprecation")
@Override
public void onPluginMessageReceived(String channel, Player pluginMessagingPlayer, byte[] bytes) {
    if (!channel.equals("interchat:main")) {
        return;
    }
    ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
    int packetNumber = in.readInt();
    int packetId = in.readShort();
    boolean isEnding = in.readBoolean();
    byte[] data = new byte[bytes.length - 7];
    in.readFully(data);
    byte[] chain = incoming.remove(packetNumber);
    if (chain != null) {
        ByteBuffer buff = ByteBuffer.allocate(chain.length + data.length);
        buff.put(chain);
        buff.put(data);
        data = buff.array();
    }
    if (!isEnding) {
        incoming.put(packetNumber, data);
        return;
    }
    try {
        ByteArrayDataInput input = ByteStreams.newDataInput(data);
        switch(packetId) {
            case 0x00:
                int playerAmount = input.readInt();
                Set<UUID> localUUID = Bukkit.getOnlinePlayers().stream().map(each -> each.getUniqueId()).collect(Collectors.toSet());
                Set<UUID> current = new HashSet<>(ICPlayerFactory.getRemoteUUIDs());
                Set<UUID> newSet = new HashSet<>();
                for (int i = 0; i < playerAmount; i++) {
                    String server = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                    UUID uuid = DataTypeIO.readUUID(input);
                    String name = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                    ICPlayer player = ICPlayerFactory.getICPlayer(uuid);
                    if (player != null) {
                        if (!player.getRemoteServer().equals(server)) {
                            player.setRemoteServer(server);
                        }
                    }
                    if (!localUUID.contains(uuid) && !ICPlayerFactory.getRemoteUUIDs().contains(uuid)) {
                        ICPlayerFactory.createOrUpdateRemoteICPlayer(server, name, uuid, true, 0, 0, Bukkit.createInventory(null, 45), Bukkit.createInventory(null, 36));
                    }
                    newSet.add(uuid);
                }
                current.removeAll(newSet);
                for (UUID uuid : current) {
                    ICPlayerFactory.removeRemoteICPlayer(uuid);
                }
                for (UUID uuid : localUUID) {
                    ICPlayerFactory.removeRemoteICPlayer(uuid);
                }
                break;
            case 0x01:
                int delay = input.readInt();
                short itemStackScheme = input.readShort();
                short inventoryScheme = input.readShort();
                InteractiveChat.remoteDelay = delay;
                BungeeMessageSender.itemStackScheme = itemStackScheme;
                BungeeMessageSender.inventoryScheme = inventoryScheme;
                break;
            case 0x02:
                UUID sender = DataTypeIO.readUUID(input);
                UUID receiver = DataTypeIO.readUUID(input);
                InteractiveChat.mentionPair.add(new MentionPair(sender, receiver));
                break;
            case 0x03:
                UUID uuid = DataTypeIO.readUUID(input);
                ICPlayer player = ICPlayerFactory.getICPlayer(uuid);
                if (player == null) {
                    break;
                }
                boolean rightHanded = input.readBoolean();
                player.setRemoteRightHanded(rightHanded);
                int selectedSlot = input.readByte();
                player.setRemoteSelectedSlot(selectedSlot);
                int level = input.readInt();
                player.setRemoteExperienceLevel(level);
                int size = input.readByte();
                ItemStack[] equipment = new ItemStack[size];
                for (int i = 0; i < equipment.length; i++) {
                    equipment[i] = DataTypeIO.readItemStack(input, StandardCharsets.UTF_8);
                }
                player.getEquipment().setHelmet(equipment[0]);
                player.getEquipment().setChestplate(equipment[1]);
                player.getEquipment().setLeggings(equipment[2]);
                player.getEquipment().setBoots(equipment[3]);
                if (InteractiveChat.version.isOld()) {
                    player.getEquipment().setItemInHand(equipment[4]);
                } else {
                    player.getEquipment().setItemInMainHand(equipment[4]);
                    player.getEquipment().setItemInOffHand(equipment[5]);
                }
                break;
            case 0x04:
                UUID uuid1 = DataTypeIO.readUUID(input);
                ICPlayer player1 = ICPlayerFactory.getICPlayer(uuid1);
                if (player1 == null) {
                    break;
                }
                boolean rightHanded1 = input.readBoolean();
                player1.setRemoteRightHanded(rightHanded1);
                int selectedSlot1 = input.readByte();
                player1.setRemoteSelectedSlot(selectedSlot1);
                int level1 = input.readInt();
                player1.setRemoteExperienceLevel(level1);
                int type = input.readByte();
                if (type == 0) {
                    player1.setRemoteInventory(DataTypeIO.readInventory(input, StandardCharsets.UTF_8));
                } else {
                    player1.setRemoteEnderChest(DataTypeIO.readInventory(input, StandardCharsets.UTF_8));
                }
                break;
            case 0x05:
                UUID uuid2 = DataTypeIO.readUUID(input);
                ICPlayer player2 = ICPlayerFactory.getICPlayer(uuid2);
                if (player2 == null) {
                    break;
                }
                int size1 = input.readInt();
                for (int i = 0; i < size1; i++) {
                    String placeholder = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                    String text = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                    player2.getRemotePlaceholdersMapping().put(placeholder, text);
                }
                break;
            case 0x06:
                String message = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                UUID uuid3 = DataTypeIO.readUUID(input);
                ICPlayer player3 = ICPlayerFactory.getICPlayer(uuid3);
                if (player3 == null) {
                    break;
                }
                InteractiveChat.messages.put(message, uuid3);
                Bukkit.getScheduler().runTaskLater(InteractiveChat.plugin, () -> InteractiveChat.messages.remove(message), 60);
                break;
            case 0x07:
                int cooldownType = input.readByte();
                switch(cooldownType) {
                    case 0:
                        UUID uuid4 = DataTypeIO.readUUID(input);
                        long time = input.readLong();
                        InteractiveChat.placeholderCooldownManager.setPlayerUniversalLastTimestampRaw(uuid4, time);
                        break;
                    case 1:
                        uuid4 = DataTypeIO.readUUID(input);
                        UUID internalId = DataTypeIO.readUUID(input);
                        time = input.readLong();
                        Optional<ICPlaceholder> optPlaceholder = InteractiveChat.placeholderList.values().stream().filter(each -> each.getInternalId().equals(internalId)).findFirst();
                        if (optPlaceholder.isPresent()) {
                            InteractiveChat.placeholderCooldownManager.setPlayerPlaceholderLastTimestampRaw(uuid4, optPlaceholder.get(), time);
                        }
                        break;
                }
                break;
            case 0x08:
                UUID messageId = DataTypeIO.readUUID(input);
                UUID uuid5 = DataTypeIO.readUUID(input);
                Player bukkitplayer1 = Bukkit.getPlayer(uuid5);
                if (bukkitplayer1 == null) {
                    break;
                }
                String component = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                Bukkit.getScheduler().runTaskAsynchronously(InteractiveChat.plugin, () -> {
                    try {
                        String processed = ProcessExternalMessage.processAndRespond(bukkitplayer1, component);
                        BungeeMessageSender.respondProcessedMessage(System.currentTimeMillis(), processed, messageId);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                });
                break;
            case 0x09:
                String server = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                int size2 = input.readInt();
                List<ICPlaceholder> list = new ArrayList<>(size2);
                for (int i = 0; i < size2; i++) {
                    boolean isBulitIn = input.readBoolean();
                    if (isBulitIn) {
                        String keyword = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        String name = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        String description = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        String permission = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        long cooldown = input.readLong();
                        list.add(new BuiltInPlaceholder(Pattern.compile(keyword), name, description, permission, cooldown));
                    } else {
                        int customNo = input.readInt();
                        ParsePlayer parseplayer = ParsePlayer.fromOrder(input.readByte());
                        String placeholder = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        boolean parseKeyword = input.readBoolean();
                        long cooldown = input.readLong();
                        boolean hoverEnabled = input.readBoolean();
                        String hoverText = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        boolean clickEnabled = input.readBoolean();
                        String clickAction = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        String clickValue = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        boolean replaceEnabled = input.readBoolean();
                        String replaceText = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        String name = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        String description = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                        list.add(new CustomPlaceholder(customNo, parseplayer, Pattern.compile(placeholder), parseKeyword, cooldown, new CustomPlaceholderHoverEvent(hoverEnabled, hoverText), new CustomPlaceholderClickEvent(clickEnabled, clickEnabled ? ClickEventAction.valueOf(clickAction) : null, clickValue), new CustomPlaceholderReplaceText(replaceEnabled, replaceText), name, description));
                    }
                }
                InteractiveChat.remotePlaceholderList.put(server, list);
                break;
            case 0x0A:
                BungeeMessageSender.resetAndForwardPlaceholderList(System.currentTimeMillis(), InteractiveChat.placeholderList.values());
                break;
            case 0x0B:
                int id = input.readInt();
                UUID playerUUID = DataTypeIO.readUUID(input);
                String permission = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                Player player5 = Bukkit.getPlayer(playerUUID);
                BungeeMessageSender.permissionCheckResponse(System.currentTimeMillis(), id, player5 != null && player5.hasPermission(permission));
                break;
            case 0x0D:
                UUID playerUUID1 = DataTypeIO.readUUID(input);
                PlayerData pd = InteractiveChat.playerDataManager.getPlayerData(playerUUID1);
                if (pd != null) {
                    pd.reload();
                }
                break;
            case 0x0E:
                SharedType sharedType = SharedType.fromValue(input.readByte());
                String sha1 = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                Inventory inventory = DataTypeIO.readInventory(input, StandardCharsets.UTF_8);
                InteractiveChatAPI.addInventoryToItemShareList(sharedType, sha1, inventory);
                break;
            case 0x0F:
                int requestType = input.readByte();
                UUID playerUUID2 = DataTypeIO.readUUID(input);
                Player player6 = Bukkit.getPlayer(playerUUID2);
                if (player6 != null) {
                    ICPlayer player7 = ICPlayerFactory.getICPlayer(player6);
                    switch(requestType) {
                        case 0:
                            BungeeMessageSender.forwardInventory(System.currentTimeMillis(), player7.getUniqueId(), player7.isRightHanded(), player7.getSelectedSlot(), player7.getExperienceLevel(), null, player7.getInventory());
                            break;
                        case 1:
                            BungeeMessageSender.forwardEnderchest(System.currentTimeMillis(), player7.getUniqueId(), player7.isRightHanded(), player7.getSelectedSlot(), player7.getExperienceLevel(), null, player7.getEnderChest());
                            break;
                    }
                }
                break;
            case 0x10:
                UUID requestUUID = DataTypeIO.readUUID(input);
                int requestType2 = input.readByte();
                // noinspection SwitchStatementWithTooFewBranches
                switch(requestType2) {
                    case 0:
                        List<ValueTrios<UUID, String, Integer>> playerlist = new ArrayList<>();
                        int playerListSize = input.readInt();
                        for (int i = 0; i < playerListSize; i++) {
                            playerlist.add(new ValueTrios<>(DataTypeIO.readUUID(input), DataTypeIO.readString(input, StandardCharsets.UTF_8), input.readInt()));
                        }
                        @SuppressWarnings("unchecked") CompletableFuture<List<ValueTrios<UUID, String, Integer>>> future = (CompletableFuture<List<ValueTrios<UUID, String, Integer>>>) toComplete.remove(requestUUID);
                        if (future != null) {
                            future.complete(playerlist);
                        }
                        break;
                    default:
                        break;
                }
                break;
            case 0x11:
                UUID playerUUID3 = DataTypeIO.readUUID(input);
                int nicknameSize = input.readInt();
                Set<String> remoteNicknames = new HashSet<>();
                for (int i = 0; i < nicknameSize; i++) {
                    remoteNicknames.add(DataTypeIO.readString(input, StandardCharsets.UTF_8));
                }
                ICPlayer icPlayer = ICPlayerFactory.getICPlayer(playerUUID3);
                if (icPlayer != null) {
                    icPlayer.setRemoteNicknames(remoteNicknames);
                }
                break;
            case 0x12:
                UUID playerUUID4 = DataTypeIO.readUUID(input);
                String placeholders = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                ICPlayer icPlayer1 = ICPlayerFactory.getICPlayer(playerUUID4);
                if (icPlayer1 != null && icPlayer1.isLocal()) {
                    PlaceholderParser.parse(icPlayer1, placeholders);
                }
                break;
            case 0xFF:
                String customChannel = DataTypeIO.readString(input, StandardCharsets.UTF_8);
                int dataLength = input.readInt();
                byte[] customData = new byte[dataLength];
                input.readFully(customData);
                ProxyCustomDataRecievedEvent dataEvent = new ProxyCustomDataRecievedEvent(customChannel, customData);
                Bukkit.getPluginManager().callEvent(dataEvent);
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : CustomPlaceholder(com.loohp.interactivechat.objectholders.CustomPlaceholder) InteractiveChatAPI(com.loohp.interactivechat.api.InteractiveChatAPI) PlayerData(com.loohp.interactivechat.data.PlayerDataManager.PlayerData) DataTypeIO(com.loohp.interactivechat.utils.DataTypeIO) TimeoutException(java.util.concurrent.TimeoutException) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) BuiltInPlaceholder(com.loohp.interactivechat.objectholders.BuiltInPlaceholder) Player(org.bukkit.entity.Player) ParsePlayer(com.loohp.interactivechat.objectholders.CustomPlaceholder.ParsePlayer) Inventory(org.bukkit.inventory.Inventory) ByteBuffer(java.nio.ByteBuffer) CustomPlaceholderReplaceText(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderReplaceText) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) PluginMessageListener(org.bukkit.plugin.messaging.PluginMessageListener) ProcessExternalMessage(com.loohp.interactivechat.modules.ProcessExternalMessage) Map(java.util.Map) ByteArrayDataInput(com.google.common.io.ByteArrayDataInput) MentionPair(com.loohp.interactivechat.objectholders.MentionPair) SharedType(com.loohp.interactivechat.api.InteractiveChatAPI.SharedType) ICPlaceholder(com.loohp.interactivechat.objectholders.ICPlaceholder) Bukkit(org.bukkit.Bukkit) ProxyCustomDataRecievedEvent(com.loohp.interactivechat.api.events.ProxyCustomDataRecievedEvent) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) ItemStack(org.bukkit.inventory.ItemStack) InteractiveChat(com.loohp.interactivechat.InteractiveChat) List(java.util.List) ValueTrios(com.loohp.interactivechat.objectholders.ValueTrios) ClickEventAction(com.loohp.interactivechat.objectholders.CustomPlaceholder.ClickEventAction) CustomPlaceholderHoverEvent(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderHoverEvent) ICPlayerFactory(com.loohp.interactivechat.objectholders.ICPlayerFactory) ByteStreams(com.google.common.io.ByteStreams) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) CustomPlaceholderClickEvent(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderClickEvent) PlaceholderParser(com.loohp.interactivechat.utils.PlaceholderParser) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) CustomPlaceholderHoverEvent(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderHoverEvent) ArrayList(java.util.ArrayList) CustomPlaceholderReplaceText(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderReplaceText) CompletableFuture(java.util.concurrent.CompletableFuture) ICPlaceholder(com.loohp.interactivechat.objectholders.ICPlaceholder) CustomPlaceholder(com.loohp.interactivechat.objectholders.CustomPlaceholder) ArrayList(java.util.ArrayList) List(java.util.List) UUID(java.util.UUID) HashSet(java.util.HashSet) Player(org.bukkit.entity.Player) ParsePlayer(com.loohp.interactivechat.objectholders.CustomPlaceholder.ParsePlayer) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) ProxyCustomDataRecievedEvent(com.loohp.interactivechat.api.events.ProxyCustomDataRecievedEvent) SharedType(com.loohp.interactivechat.api.InteractiveChatAPI.SharedType) CustomPlaceholderClickEvent(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderClickEvent) ByteArrayDataInput(com.google.common.io.ByteArrayDataInput) ByteBuffer(java.nio.ByteBuffer) TimeoutException(java.util.concurrent.TimeoutException) ParsePlayer(com.loohp.interactivechat.objectholders.CustomPlaceholder.ParsePlayer) BuiltInPlaceholder(com.loohp.interactivechat.objectholders.BuiltInPlaceholder) MentionPair(com.loohp.interactivechat.objectholders.MentionPair) ItemStack(org.bukkit.inventory.ItemStack) PlayerData(com.loohp.interactivechat.data.PlayerDataManager.PlayerData) Inventory(org.bukkit.inventory.Inventory) ValueTrios(com.loohp.interactivechat.objectholders.ValueTrios)

Example 2 with ValueTrios

use of com.loohp.interactivechat.objectholders.ValueTrios in project InteractiveChat-DiscordSRV-Addon by LOOHP.

the class DiscordCommands method onSlashCommand.

@Override
public void onSlashCommand(SlashCommandEvent event) {
    if (!(event.getChannel() instanceof TextChannel)) {
        return;
    }
    TextChannel channel = (TextChannel) event.getChannel();
    String label = event.getName();
    if (InteractiveChatDiscordSrvAddon.plugin.resourcepackCommandEnabled && label.equalsIgnoreCase(RESOURCEPACK_LABEL)) {
        if (InteractiveChatDiscordSrvAddon.plugin.resourcepackCommandIsMainServer) {
            event.deferReply().setEphemeral(true).queue();
            List<MessageEmbed> messageEmbeds = new ArrayList<>();
            Map<String, byte[]> attachments = new HashMap<>();
            int i = 0;
            for (ResourcePackInfo packInfo : InteractiveChatDiscordSrvAddon.plugin.resourceManager.getResourcePackInfo()) {
                i++;
                String packName = packInfo.getName();
                Component description = packInfo.getDescription();
                EmbedBuilder builder = new EmbedBuilder().setAuthor(packName).setThumbnail("attachment://" + i + ".png");
                if (packInfo.getStatus()) {
                    builder.setDescription(PlainTextComponentSerializer.plainText().serialize(description));
                    ChatColor firstColor = ChatColorUtils.getColor(LegacyComponentSerializer.builder().useUnusualXRepeatedCharacterHexFormat().character(ChatColorUtils.COLOR_CHAR).build().serialize(description));
                    Color color = ColorUtils.getColor(firstColor);
                    if (color == null) {
                        color = new Color(0xAAAAAA);
                    } else if (color.equals(Color.WHITE)) {
                        color = new Color(0xFFFFFE);
                    }
                    builder.setColor(color);
                    if (packInfo.comparePackFormat() > 0) {
                        builder.setFooter(LanguageUtils.getTranslation(TranslationKeyUtils.getNewIncompatiblePack(), InteractiveChatDiscordSrvAddon.plugin.language));
                    } else if (packInfo.comparePackFormat() < 0) {
                        builder.setFooter(LanguageUtils.getTranslation(TranslationKeyUtils.getOldIncompatiblePack(), InteractiveChatDiscordSrvAddon.plugin.language));
                    }
                } else {
                    builder.setColor(0xFF0000).setDescription(packInfo.getRejectedReason());
                }
                messageEmbeds.add(builder.build());
                try {
                    attachments.put(i + ".png", ImageUtils.toArray(ImageUtils.resizeImageAbs(packInfo.getIcon(), 128, 128)));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            WebhookMessageUpdateAction<Message> action = event.getHook().setEphemeral(true).editOriginal("**" + LanguageUtils.getTranslation(TranslationKeyUtils.getServerResourcePack(), InteractiveChatDiscordSrvAddon.plugin.language) + "**").setEmbeds(messageEmbeds);
            for (Entry<String, byte[]> entry : attachments.entrySet()) {
                action = action.addFile(entry.getValue(), entry.getKey());
            }
            action.queue();
        }
    } else if (InteractiveChatDiscordSrvAddon.plugin.playerlistCommandEnabled && label.equalsIgnoreCase(PLAYERLIST_LABEL)) {
        String minecraftChannel = discordsrv.getChannels().entrySet().stream().filter(entry -> channel.getId().equals(entry.getValue())).map(Map.Entry::getKey).findFirst().orElse(null);
        if (minecraftChannel == null) {
            if (InteractiveChatDiscordSrvAddon.plugin.respondToCommandsInInvalidChannels && InteractiveChatDiscordSrvAddon.plugin.playerlistCommandIsMainServer) {
                event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.invalidDiscordChannel)).setEphemeral(true).queue();
            }
            return;
        }
        AtomicBoolean deleted = new AtomicBoolean(false);
        event.deferReply().queue(hook -> {
            if (InteractiveChatDiscordSrvAddon.plugin.playerlistCommandDeleteAfter > 0) {
                Bukkit.getScheduler().runTaskLaterAsynchronously(InteractiveChatDiscordSrvAddon.plugin, () -> {
                    if (!deleted.get()) {
                        hook.deleteOriginal().queue();
                    }
                }, InteractiveChatDiscordSrvAddon.plugin.playerlistCommandDeleteAfter * 20L);
            }
        });
        Map<OfflinePlayer, Integer> players;
        if (InteractiveChat.bungeecordMode && InteractiveChatDiscordSrvAddon.plugin.playerlistCommandBungeecord && !Bukkit.getOnlinePlayers().isEmpty()) {
            try {
                List<ValueTrios<UUID, String, Integer>> bungeePlayers = InteractiveChatAPI.getBungeecordPlayerList().get();
                players = new LinkedHashMap<>(bungeePlayers.size());
                for (ValueTrios<UUID, String, Integer> playerinfo : bungeePlayers) {
                    if (!VanishUtils.isVanished(playerinfo.getFirst())) {
                        players.put(Bukkit.getOfflinePlayer(playerinfo.getFirst()), playerinfo.getThird());
                    }
                }
            } catch (InterruptedException | ExecutionException e) {
                e.printStackTrace();
                event.getHook().editOriginal(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (-1)").queue();
                return;
            }
        } else {
            players = Bukkit.getOnlinePlayers().stream().filter(each -> !VanishUtils.isVanished(each.getUniqueId())).collect(Collectors.toMap(each -> each, each -> PlayerUtils.getPing(each)));
        }
        if (players.isEmpty()) {
            event.getHook().editOriginal(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.playerlistCommandEmptyServer)).queue();
        } else {
            int errorCode = -2;
            try {
                String[] groups = getGroups();
                List<ValueTrios<UUID, Component, Integer>> player = new ArrayList<>();
                Map<UUID, Integer> playerGroups = new HashMap<>();
                for (Entry<OfflinePlayer, Integer> entry : players.entrySet()) {
                    OfflinePlayer bukkitOfflinePlayer = entry.getKey();
                    @SuppressWarnings("deprecation") OfflineICPlayer offlinePlayer = ICPlayerFactory.getUnsafe().getOfflineICPPlayerWithoutInitialization(bukkitOfflinePlayer.getUniqueId());
                    playerGroups.put(offlinePlayer.getUniqueId(), getPlayerGroupOrder(groups, bukkitOfflinePlayer));
                    player.add(new ValueTrios<>(offlinePlayer.getUniqueId(), LegacyComponentSerializer.legacySection().deserialize(ChatColorUtils.translateAlternateColorCodes('&', PlaceholderParser.parse(offlinePlayer, InteractiveChatDiscordSrvAddon.plugin.playerlistCommandPlayerFormat))), entry.getValue()));
                }
                errorCode--;
                player.sort(Comparator.comparing(each -> playerGroups.getOrDefault(((ValueTrios<UUID, Component, Integer>) each).getFirst(), Integer.MIN_VALUE)).thenComparing(each -> ((ValueTrios<UUID, Component, Integer>) each).getFirst()));
                errorCode--;
                @SuppressWarnings("deprecation") OfflineICPlayer firstPlayer = ICPlayerFactory.getUnsafe().getOfflineICPPlayerWithoutInitialization(players.keySet().iterator().next().getUniqueId());
                List<Component> header = new ArrayList<>();
                if (!InteractiveChatDiscordSrvAddon.plugin.playerlistCommandHeader.isEmpty()) {
                    header = ComponentStyling.splitAtLineBreaks(LegacyComponentSerializer.legacySection().deserialize(ChatColorUtils.translateAlternateColorCodes('&', PlaceholderParser.parse(firstPlayer, InteractiveChatDiscordSrvAddon.plugin.playerlistCommandHeader.replace("{OnlinePlayers}", players.size() + "")))));
                }
                errorCode--;
                List<Component> footer = new ArrayList<>();
                if (!InteractiveChatDiscordSrvAddon.plugin.playerlistCommandFooter.isEmpty()) {
                    footer = ComponentStyling.splitAtLineBreaks(LegacyComponentSerializer.legacySection().deserialize(ChatColorUtils.translateAlternateColorCodes('&', PlaceholderParser.parse(firstPlayer, InteractiveChatDiscordSrvAddon.plugin.playerlistCommandFooter.replace("{OnlinePlayers}", players.size() + "")))));
                }
                errorCode--;
                BufferedImage image = ImageGeneration.getTabListImage(header, footer, player, InteractiveChatDiscordSrvAddon.plugin.playerlistCommandAvatar, InteractiveChatDiscordSrvAddon.plugin.playerlistCommandPing);
                errorCode--;
                byte[] data = ImageUtils.toArray(image);
                errorCode--;
                event.getHook().editOriginalEmbeds(new EmbedBuilder().setImage("attachment://Tablist.png").setColor(InteractiveChatDiscordSrvAddon.plugin.playerlistCommandColor).build()).addFile(data, "Tablist.png").queue(success -> {
                    if (InteractiveChatDiscordSrvAddon.plugin.playerlistCommandDeleteAfter > 0) {
                        deleted.set(true);
                        success.delete().queueAfter(InteractiveChatDiscordSrvAddon.plugin.playerlistCommandDeleteAfter, TimeUnit.SECONDS);
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
                event.getHook().editOriginal(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (" + errorCode + ")").queue();
                return;
            }
        }
    } else if (InteractiveChatDiscordSrvAddon.plugin.shareItemCommandEnabled && (label.equalsIgnoreCase(ITEM_LABEL) || label.equalsIgnoreCase(ITEM_OTHER_LABEL))) {
        String minecraftChannel = discordsrv.getChannels().entrySet().stream().filter(entry -> channel.getId().equals(entry.getValue())).map(Map.Entry::getKey).findFirst().orElse(null);
        if (minecraftChannel == null) {
            if (InteractiveChatDiscordSrvAddon.plugin.respondToCommandsInInvalidChannels && InteractiveChatDiscordSrvAddon.plugin.shareInvCommandIsMainServer) {
                event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.invalidDiscordChannel)).setEphemeral(true).queue();
            }
            return;
        }
        String discordUserId = event.getUser().getId();
        List<OptionMapping> options = event.getOptionsByType(OptionType.USER);
        if (options.size() > 0) {
            discordUserId = options.get(0).getAsUser().getId();
        }
        UUID uuid = discordsrv.getAccountLinkManager().getUuid(discordUserId);
        if (uuid == null) {
            if (InteractiveChatDiscordSrvAddon.plugin.shareItemCommandIsMainServer) {
                event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.accountNotLinked)).setEphemeral(true).queue();
            }
            return;
        }
        int errorCode = -1;
        try {
            OfflineICPlayer offlineICPlayer = ICPlayerFactory.getOfflineICPlayer(uuid);
            if (offlineICPlayer == null) {
                if (InteractiveChatDiscordSrvAddon.plugin.shareItemCommandIsMainServer) {
                    event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (" + errorCode + ")").setEphemeral(true).queue();
                }
                return;
            }
            errorCode--;
            if (InteractiveChatDiscordSrvAddon.plugin.shareItemCommandIsMainServer) {
                event.deferReply().queue();
            }
            errorCode--;
            ICPlayer icplayer = offlineICPlayer.getPlayer();
            if (InteractiveChat.bungeecordMode && icplayer != null) {
                if (icplayer.isLocal()) {
                    ItemStack[] equipment;
                    if (InteractiveChat.version.isOld()) {
                        // noinspection deprecation
                        equipment = new ItemStack[] { icplayer.getEquipment().getHelmet(), icplayer.getEquipment().getChestplate(), icplayer.getEquipment().getLeggings(), icplayer.getEquipment().getBoots(), icplayer.getEquipment().getItemInHand() };
                    } else {
                        equipment = new ItemStack[] { icplayer.getEquipment().getHelmet(), icplayer.getEquipment().getChestplate(), icplayer.getEquipment().getLeggings(), icplayer.getEquipment().getBoots(), icplayer.getEquipment().getItemInMainHand(), icplayer.getEquipment().getItemInOffHand() };
                    }
                    try {
                        BungeeMessageSender.forwardEquipment(System.currentTimeMillis(), icplayer.getUniqueId(), icplayer.isRightHanded(), icplayer.getSelectedSlot(), icplayer.getExperienceLevel(), equipment);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } else {
                    TimeUnit.MILLISECONDS.sleep(InteractiveChat.remoteDelay);
                }
            }
            errorCode--;
            ItemStack itemStack = resolveItemStack(event, offlineICPlayer);
            if (itemStack == null) {
                itemStack = new ItemStack(Material.AIR);
            }
            errorCode--;
            BufferedImage itemImage = ImageGeneration.getItemStackImage(itemStack, offlineICPlayer, true);
            errorCode--;
            String title = ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.shareItemCommandTitle.replace("{Player}", offlineICPlayer.getName()));
            errorCode--;
            Component itemTag = ItemDisplay.createItemDisplay(offlineICPlayer, itemStack, title, true, null);
            Component resolvedItemTag = ComponentStringUtils.convertTranslatables(ComponentModernizing.modernize(itemTag), InteractiveChatDiscordSrvAddon.plugin.resourceManager.getLanguageManager().getTranslateFunction().ofLanguage(InteractiveChatDiscordSrvAddon.plugin.language));
            Component component = LegacyComponentSerializer.legacySection().deserialize(InteractiveChatDiscordSrvAddon.plugin.shareItemCommandInGameMessageText.replace("{Player}", offlineICPlayer.getName())).replaceText(TextReplacementConfig.builder().matchLiteral("{ItemTag}").replacement(itemTag).build());
            Component resolvedComponent = LegacyComponentSerializer.legacySection().deserialize(InteractiveChatDiscordSrvAddon.plugin.shareItemCommandInGameMessageText.replace("{Player}", offlineICPlayer.getName())).replaceText(TextReplacementConfig.builder().matchLiteral("{ItemTag}").replacement(resolvedItemTag).build());
            errorCode--;
            String key = "<DiscordShare=" + UUID.randomUUID() + ">";
            components.put(key, component);
            Bukkit.getScheduler().runTaskLater(InteractiveChatDiscordSrvAddon.plugin, () -> components.remove(key), 100);
            errorCode--;
            discordsrv.broadcastMessageToMinecraftServer(minecraftChannel, ComponentStringUtils.toDiscordSRVComponent(Component.text(key)), event.getUser());
            if (InteractiveChatDiscordSrvAddon.plugin.shareItemCommandIsMainServer) {
                errorCode--;
                Player bukkitPlayer = icplayer == null || !icplayer.isLocal() ? null : icplayer.getLocalPlayer();
                DiscordDescription description = DiscordItemStackUtils.getDiscordDescription(itemStack, bukkitPlayer);
                errorCode--;
                Color color = DiscordItemStackUtils.getDiscordColor(itemStack);
                if (color == null || color.equals(Color.WHITE)) {
                    color = new Color(0xFFFFFE);
                }
                EmbedBuilder embedBuilder = new EmbedBuilder().setAuthor(description.getName(), null, "attachment://Item.png").setColor(color);
                WebhookMessageUpdateAction<Message> action = event.getHook().editOriginal(PlainTextComponentSerializer.plainText().serialize(resolvedComponent));
                errorCode--;
                byte[] data = ImageUtils.toArray(itemImage);
                action.addFile(data, "Item.png");
                errorCode--;
                if (InteractiveChatDiscordSrvAddon.plugin.itemUseTooltipImage) {
                    DiscordToolTip discordToolTip = DiscordItemStackUtils.getToolTip(itemStack, bukkitPlayer);
                    if (!discordToolTip.isBaseItem() || InteractiveChatDiscordSrvAddon.plugin.itemUseTooltipImageOnBaseItem) {
                        BufferedImage tooltip = ImageGeneration.getToolTipImage(discordToolTip.getComponents());
                        byte[] tooltipData = ImageUtils.toArray(tooltip);
                        action.addFile(tooltipData, "ToolTip.png");
                        embedBuilder.setImage("attachment://ToolTip.png");
                    } else {
                        embedBuilder.setDescription(description.getDescription().orElse(null));
                    }
                } else {
                    embedBuilder.setDescription(description.getDescription().orElse(null));
                }
                errorCode--;
                action.setEmbeds(embedBuilder.build()).queue();
            }
        } catch (Exception e) {
            e.printStackTrace();
            event.getHook().editOriginal(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (" + errorCode + ")").queue();
            return;
        }
    } else if (InteractiveChatDiscordSrvAddon.plugin.shareInvCommandEnabled && (label.equalsIgnoreCase(INVENTORY_LABEL) || label.equalsIgnoreCase(INVENTORY_OTHER_LABEL))) {
        String minecraftChannel = discordsrv.getChannels().entrySet().stream().filter(entry -> channel.getId().equals(entry.getValue())).map(Map.Entry::getKey).findFirst().orElse(null);
        if (minecraftChannel == null) {
            if (InteractiveChatDiscordSrvAddon.plugin.respondToCommandsInInvalidChannels && InteractiveChatDiscordSrvAddon.plugin.shareInvCommandIsMainServer) {
                event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.invalidDiscordChannel)).setEphemeral(true).queue();
            }
            return;
        }
        String discordUserId = event.getUser().getId();
        List<OptionMapping> options = event.getOptionsByType(OptionType.USER);
        if (options.size() > 0) {
            discordUserId = options.get(0).getAsUser().getId();
        }
        UUID uuid = discordsrv.getAccountLinkManager().getUuid(discordUserId);
        if (uuid == null) {
            if (InteractiveChatDiscordSrvAddon.plugin.shareInvCommandIsMainServer) {
                event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.accountNotLinked)).setEphemeral(true).queue();
            }
            return;
        }
        int errorCode = -1;
        try {
            OfflineICPlayer offlineICPlayer = ICPlayerFactory.getOfflineICPlayer(uuid);
            if (offlineICPlayer == null) {
                if (InteractiveChatDiscordSrvAddon.plugin.shareInvCommandIsMainServer) {
                    event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (" + errorCode + ")").setEphemeral(true).queue();
                }
                return;
            }
            errorCode--;
            if (InteractiveChatDiscordSrvAddon.plugin.shareInvCommandIsMainServer) {
                event.deferReply().queue();
            }
            errorCode--;
            ICPlayer icplayer = offlineICPlayer.getPlayer();
            if (InteractiveChat.bungeecordMode && icplayer != null) {
                if (icplayer.isLocal()) {
                    BungeeMessageSender.forwardInventory(System.currentTimeMillis(), uuid, icplayer.isRightHanded(), icplayer.getSelectedSlot(), icplayer.getExperienceLevel(), null, icplayer.getInventory());
                } else {
                    TimeUnit.MILLISECONDS.sleep(InteractiveChat.remoteDelay);
                }
            }
            errorCode--;
            BufferedImage image = InteractiveChatDiscordSrvAddon.plugin.usePlayerInvView ? ImageGeneration.getPlayerInventoryImage(offlineICPlayer.getInventory(), offlineICPlayer) : ImageGeneration.getInventoryImage(offlineICPlayer.getInventory(), Component.translatable(TranslationKeyUtils.getDefaultContainerTitle()), offlineICPlayer);
            errorCode--;
            Component component = LegacyComponentSerializer.legacySection().deserialize(InteractiveChatDiscordSrvAddon.plugin.shareInvCommandInGameMessageText.replace("{Player}", offlineICPlayer.getName()));
            errorCode--;
            String title = ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.shareInvCommandTitle.replace("{Player}", offlineICPlayer.getName()));
            errorCode--;
            String sha1 = HashUtils.createSha1(true, offlineICPlayer.getSelectedSlot(), offlineICPlayer.getExperienceLevel(), title, offlineICPlayer.getInventory());
            errorCode--;
            layout0(offlineICPlayer, sha1, title);
            errorCode--;
            layout1(offlineICPlayer, sha1, title);
            errorCode--;
            component = component.hoverEvent(HoverEvent.showText(LegacyComponentSerializer.legacySection().deserialize(InteractiveChatDiscordSrvAddon.plugin.shareInvCommandInGameMessageHover)));
            component = component.clickEvent(ClickEvent.runCommand("/interactivechat viewinv " + sha1));
            errorCode--;
            String key = "<DiscordShare=" + UUID.randomUUID() + ">";
            components.put(key, component);
            Bukkit.getScheduler().runTaskLater(InteractiveChatDiscordSrvAddon.plugin, () -> components.remove(key), 100);
            errorCode--;
            discordsrv.broadcastMessageToMinecraftServer(minecraftChannel, ComponentStringUtils.toDiscordSRVComponent(Component.text(key)), event.getUser());
            if (InteractiveChatDiscordSrvAddon.plugin.shareInvCommandIsMainServer) {
                errorCode--;
                EmbedBuilder embedBuilder = new EmbedBuilder().setAuthor(title).setImage("attachment://Inventory.png").setColor(InteractiveChatDiscordSrvAddon.plugin.invColor);
                WebhookMessageUpdateAction<Message> action = event.getHook().editOriginal(PlainTextComponentSerializer.plainText().serialize(component));
                errorCode--;
                byte[] data = ImageUtils.toArray(image);
                action.addFile(data, "Inventory.png");
                errorCode--;
                if (InteractiveChatDiscordSrvAddon.plugin.invShowLevel) {
                    int level = offlineICPlayer.getExperienceLevel();
                    byte[] bottleData = ImageUtils.toArray(InteractiveChatDiscordSrvAddon.plugin.modelRenderer.render(32, 32, InteractiveChatDiscordSrvAddon.plugin.resourceManager, InteractiveChat.version.isOld(), "minecraft:item/experience_bottle", ModelDisplayPosition.GUI, false).getImage());
                    embedBuilder.setFooter(LanguageUtils.getTranslation(TranslationKeyUtils.getLevelTranslation(level), InteractiveChatDiscordSrvAddon.plugin.language).replaceFirst("%s|%d", level + ""), "attachment://Level.png");
                    action.addFile(bottleData, "Level.png");
                }
                errorCode--;
                action.setEmbeds(embedBuilder.build()).queue();
            }
        } catch (Exception e) {
            e.printStackTrace();
            event.getHook().editOriginal(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (" + errorCode + ")").queue();
            return;
        }
    } else if (InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandEnabled && (label.equals(ENDERCHEST_LABEL) || label.equals(ENDERCHEST_OTHER_LABEL))) {
        String minecraftChannel = discordsrv.getChannels().entrySet().stream().filter(entry -> channel.getId().equals(entry.getValue())).map(Map.Entry::getKey).findFirst().orElse(null);
        if (minecraftChannel == null) {
            if (InteractiveChatDiscordSrvAddon.plugin.respondToCommandsInInvalidChannels && InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandIsMainServer) {
                event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.invalidDiscordChannel)).setEphemeral(true).queue();
            }
            return;
        }
        String discordUserId = event.getUser().getId();
        List<OptionMapping> options = event.getOptionsByType(OptionType.USER);
        if (options.size() > 0) {
            discordUserId = options.get(0).getAsUser().getId();
        }
        UUID uuid = discordsrv.getAccountLinkManager().getUuid(discordUserId);
        if (uuid == null) {
            if (InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandIsMainServer) {
                event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.accountNotLinked)).setEphemeral(true).queue();
            }
            return;
        }
        int errorCode = -1;
        try {
            OfflineICPlayer offlineICPlayer = ICPlayerFactory.getOfflineICPlayer(uuid);
            if (offlineICPlayer == null) {
                if (InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandIsMainServer) {
                    event.reply(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (" + errorCode + ")").setEphemeral(true).queue();
                }
                return;
            }
            errorCode--;
            if (InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandIsMainServer) {
                event.deferReply().queue();
            }
            errorCode--;
            ICPlayer icplayer = offlineICPlayer.getPlayer();
            if (InteractiveChat.bungeecordMode && icplayer != null) {
                if (icplayer.isLocal()) {
                    BungeeMessageSender.forwardEnderchest(System.currentTimeMillis(), uuid, icplayer.isRightHanded(), icplayer.getSelectedSlot(), icplayer.getExperienceLevel(), null, icplayer.getEnderChest());
                } else {
                    TimeUnit.MILLISECONDS.sleep(InteractiveChat.remoteDelay);
                }
            }
            errorCode--;
            BufferedImage image = ImageGeneration.getInventoryImage(offlineICPlayer.getEnderChest(), Component.translatable(TranslationKeyUtils.getEnderChestContainerTitle()), offlineICPlayer);
            errorCode--;
            Component component = LegacyComponentSerializer.legacySection().deserialize(InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandInGameMessageText.replace("{Player}", offlineICPlayer.getName()));
            errorCode--;
            String title = ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandTitle.replace("{Player}", offlineICPlayer.getName()));
            errorCode--;
            String sha1 = HashUtils.createSha1(true, offlineICPlayer.getSelectedSlot(), offlineICPlayer.getExperienceLevel(), title, offlineICPlayer.getEnderChest());
            errorCode--;
            ender(offlineICPlayer, sha1, title);
            errorCode--;
            component = component.hoverEvent(HoverEvent.showText(LegacyComponentSerializer.legacySection().deserialize(InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandInGameMessageHover)));
            component = component.clickEvent(ClickEvent.runCommand("/interactivechat viewender " + sha1));
            errorCode--;
            String key = "<DiscordShare=" + UUID.randomUUID() + ">";
            components.put(key, component);
            Bukkit.getScheduler().runTaskLater(InteractiveChatDiscordSrvAddon.plugin, () -> components.remove(key), 100);
            errorCode--;
            discordsrv.broadcastMessageToMinecraftServer(minecraftChannel, ComponentStringUtils.toDiscordSRVComponent(Component.text(key)), event.getUser());
            if (InteractiveChatDiscordSrvAddon.plugin.shareEnderCommandIsMainServer) {
                errorCode--;
                byte[] data = ImageUtils.toArray(image);
                errorCode--;
                event.getHook().editOriginal(PlainTextComponentSerializer.plainText().serialize(component)).setEmbeds(new EmbedBuilder().setAuthor(title).setImage("attachment://Inventory.png").setColor(InteractiveChatDiscordSrvAddon.plugin.enderColor).build()).addFile(data, "Inventory.png").queue();
            }
        } catch (Exception e) {
            e.printStackTrace();
            event.getHook().editOriginal(ChatColorUtils.stripColor(InteractiveChatDiscordSrvAddon.plugin.unableToRetrieveData) + " (" + errorCode + ")").queue();
            return;
        }
    }
}
Also used : Color(java.awt.Color) Arrays(java.util.Arrays) InventoryUtils(com.loohp.interactivechat.utils.InventoryUtils) PlayerUtils(com.loohp.interactivechat.utils.PlayerUtils) ResourcePackInfo(com.loohp.interactivechatdiscordsrvaddon.resources.ResourcePackInfo) TextChannel(github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) Map(java.util.Map) ComponentStringUtils(com.loohp.interactivechatdiscordsrvaddon.utils.ComponentStringUtils) Material(org.bukkit.Material) EquipmentSlot(org.bukkit.inventory.EquipmentSlot) DiscordToolTip(com.loohp.interactivechatdiscordsrvaddon.utils.DiscordItemStackUtils.DiscordToolTip) Message(github.scarsz.discordsrv.dependencies.jda.api.entities.Message) Guild(github.scarsz.discordsrv.dependencies.jda.api.entities.Guild) Set(java.util.Set) OfflinePlayer(org.bukkit.OfflinePlayer) ItemStack(org.bukkit.inventory.ItemStack) InteractiveChat(com.loohp.interactivechat.InteractiveChat) MessageEmbed(github.scarsz.discordsrv.dependencies.jda.api.entities.MessageEmbed) CustomStringUtils(com.loohp.interactivechat.utils.CustomStringUtils) OptionData(github.scarsz.discordsrv.dependencies.jda.api.interactions.commands.build.OptionData) Chat(net.milkbowl.vault.chat.Chat) EmbedBuilder(github.scarsz.discordsrv.dependencies.jda.api.EmbedBuilder) ImageUtils(com.loohp.interactivechatdiscordsrvaddon.graphics.ImageUtils) BungeeMessageSender(com.loohp.interactivechat.bungeemessaging.BungeeMessageSender) MCVersion(com.loohp.interactivechat.utils.MCVersion) HoverEvent(com.loohp.interactivechat.libs.net.kyori.adventure.text.event.HoverEvent) PostPacketComponentProcessEvent(com.loohp.interactivechat.api.events.PostPacketComponentProcessEvent) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) LanguageUtils(com.loohp.interactivechat.utils.LanguageUtils) ColorUtils(com.loohp.interactivechat.utils.ColorUtils) InteractiveChatDiscordSRVConfigReloadEvent(com.loohp.interactivechatdiscordsrvaddon.api.events.InteractiveChatDiscordSRVConfigReloadEvent) OptionType(github.scarsz.discordsrv.dependencies.jda.api.interactions.commands.OptionType) Component(com.loohp.interactivechat.libs.net.kyori.adventure.text.Component) DiscordDescription(com.loohp.interactivechatdiscordsrvaddon.utils.DiscordItemStackUtils.DiscordDescription) IOException(java.io.IOException) WebhookMessageUpdateAction(github.scarsz.discordsrv.dependencies.jda.api.requests.restaction.WebhookMessageUpdateAction) Field(java.lang.reflect.Field) ExecutionException(java.util.concurrent.ExecutionException) ValueTrios(com.loohp.interactivechat.objectholders.ValueTrios) TextReplacementConfig(com.loohp.interactivechat.libs.net.kyori.adventure.text.TextReplacementConfig) PlaceholderParser(com.loohp.interactivechat.utils.PlaceholderParser) RegisteredServiceProvider(org.bukkit.plugin.RegisteredServiceProvider) LegacyComponentSerializer(com.loohp.interactivechat.libs.net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer) DiscordItemStackUtils(com.loohp.interactivechatdiscordsrvaddon.utils.DiscordItemStackUtils) VanishUtils(com.loohp.interactivechat.utils.VanishUtils) ComponentReplacing(com.loohp.interactivechat.utils.ComponentReplacing) InteractiveChatAPI(com.loohp.interactivechat.api.InteractiveChatAPI) ListenerAdapter(github.scarsz.discordsrv.dependencies.jda.api.hooks.ListenerAdapter) Player(org.bukkit.entity.Player) Inventory(org.bukkit.inventory.Inventory) ComponentModernizing(com.loohp.interactivechat.utils.ComponentModernizing) EventHandler(org.bukkit.event.EventHandler) InteractiveChatComponentSerializer(com.loohp.interactivechat.utils.InteractiveChatComponentSerializer) SlashCommandEvent(github.scarsz.discordsrv.dependencies.jda.api.events.interaction.SlashCommandEvent) OptionMapping(github.scarsz.discordsrv.dependencies.jda.api.interactions.commands.OptionMapping) InventoryDisplay(com.loohp.interactivechat.modules.InventoryDisplay) TranslatableComponent(com.loohp.interactivechat.libs.net.kyori.adventure.text.TranslatableComponent) XMaterial(com.loohp.interactivechat.libs.com.cryptomorin.xseries.XMaterial) Bukkit(org.bukkit.Bukkit) BufferedImage(java.awt.image.BufferedImage) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ClickEvent(com.loohp.interactivechat.libs.net.kyori.adventure.text.event.ClickEvent) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) ImageGeneration(com.loohp.interactivechatdiscordsrvaddon.graphics.ImageGeneration) List(java.util.List) ErrorResponseException(github.scarsz.discordsrv.dependencies.jda.api.exceptions.ErrorResponseException) SubcommandData(github.scarsz.discordsrv.dependencies.jda.api.interactions.commands.build.SubcommandData) TextDecoration(com.loohp.interactivechat.libs.net.kyori.adventure.text.format.TextDecoration) JDAUtils(com.loohp.interactivechatdiscordsrvaddon.utils.JDAUtils) Entry(java.util.Map.Entry) Optional(java.util.Optional) NBTEditor(com.loohp.interactivechat.libs.io.github.bananapuncher714.nbteditor.NBTEditor) ArrayUtils(com.loohp.interactivechat.libs.org.apache.commons.lang3.ArrayUtils) Permission(net.milkbowl.vault.permission.Permission) ItemMeta(org.bukkit.inventory.meta.ItemMeta) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) InteractiveChatDiscordSrvAddon(com.loohp.interactivechatdiscordsrvaddon.InteractiveChatDiscordSrvAddon) SkinUtils(com.loohp.interactivechat.utils.SkinUtils) ComponentStyling(com.loohp.interactivechat.utils.ComponentStyling) HashSet(java.util.HashSet) PlainTextComponentSerializer(com.loohp.interactivechat.libs.net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer) DiscordSRV(github.scarsz.discordsrv.DiscordSRV) SharedType(com.loohp.interactivechat.api.InteractiveChatAPI.SharedType) ICPlaceholder(com.loohp.interactivechat.objectholders.ICPlaceholder) OfflineICPlayer(com.loohp.interactivechat.objectholders.OfflineICPlayer) ChatColor(net.md_5.bungee.api.ChatColor) Listener(org.bukkit.event.Listener) ItemDisplay(com.loohp.interactivechat.modules.ItemDisplay) TimeUnit(java.util.concurrent.TimeUnit) ICPlayerFactory(com.loohp.interactivechat.objectholders.ICPlayerFactory) ChatColorUtils(com.loohp.interactivechat.utils.ChatColorUtils) TranslationKeyUtils(com.loohp.interactivechatdiscordsrvaddon.utils.TranslationKeyUtils) NamedTextColor(com.loohp.interactivechat.libs.net.kyori.adventure.text.format.NamedTextColor) Comparator(java.util.Comparator) HashUtils(com.loohp.interactivechat.utils.HashUtils) ModelDisplayPosition(com.loohp.interactivechatdiscordsrvaddon.resources.models.ModelDisplay.ModelDisplayPosition) Collections(java.util.Collections) OptionMapping(github.scarsz.discordsrv.dependencies.jda.api.interactions.commands.OptionMapping) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) OfflineICPlayer(com.loohp.interactivechat.objectholders.OfflineICPlayer) MessageEmbed(github.scarsz.discordsrv.dependencies.jda.api.entities.MessageEmbed) DiscordDescription(com.loohp.interactivechatdiscordsrvaddon.utils.DiscordItemStackUtils.DiscordDescription) Message(github.scarsz.discordsrv.dependencies.jda.api.entities.Message) LinkedHashMap(java.util.LinkedHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) WebhookMessageUpdateAction(github.scarsz.discordsrv.dependencies.jda.api.requests.restaction.WebhookMessageUpdateAction) DiscordToolTip(com.loohp.interactivechatdiscordsrvaddon.utils.DiscordItemStackUtils.DiscordToolTip) ArrayList(java.util.ArrayList) ResourcePackInfo(com.loohp.interactivechatdiscordsrvaddon.resources.ResourcePackInfo) BufferedImage(java.awt.image.BufferedImage) LinkedHashMap(java.util.LinkedHashMap) TextChannel(github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel) Entry(java.util.Map.Entry) OfflinePlayer(org.bukkit.OfflinePlayer) ArrayList(java.util.ArrayList) List(java.util.List) Component(com.loohp.interactivechat.libs.net.kyori.adventure.text.Component) TranslatableComponent(com.loohp.interactivechat.libs.net.kyori.adventure.text.TranslatableComponent) UUID(java.util.UUID) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) OfflinePlayer(org.bukkit.OfflinePlayer) Player(org.bukkit.entity.Player) OfflineICPlayer(com.loohp.interactivechat.objectholders.OfflineICPlayer) Color(java.awt.Color) ChatColor(net.md_5.bungee.api.ChatColor) NamedTextColor(com.loohp.interactivechat.libs.net.kyori.adventure.text.format.NamedTextColor) IOException(java.io.IOException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) ErrorResponseException(github.scarsz.discordsrv.dependencies.jda.api.exceptions.ErrorResponseException) OfflineICPlayer(com.loohp.interactivechat.objectholders.OfflineICPlayer) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) EmbedBuilder(github.scarsz.discordsrv.dependencies.jda.api.EmbedBuilder) ItemStack(org.bukkit.inventory.ItemStack) ChatColor(net.md_5.bungee.api.ChatColor) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ValueTrios(com.loohp.interactivechat.objectholders.ValueTrios)

Aggregations

InteractiveChat (com.loohp.interactivechat.InteractiveChat)2 InteractiveChatAPI (com.loohp.interactivechat.api.InteractiveChatAPI)2 SharedType (com.loohp.interactivechat.api.InteractiveChatAPI.SharedType)2 ICPlaceholder (com.loohp.interactivechat.objectholders.ICPlaceholder)2 ICPlayer (com.loohp.interactivechat.objectholders.ICPlayer)2 ICPlayerFactory (com.loohp.interactivechat.objectholders.ICPlayerFactory)2 ValueTrios (com.loohp.interactivechat.objectholders.ValueTrios)2 PlaceholderParser (com.loohp.interactivechat.utils.PlaceholderParser)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Optional (java.util.Optional)2 Set (java.util.Set)2 UUID (java.util.UUID)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Collectors (java.util.stream.Collectors)2 Bukkit (org.bukkit.Bukkit)2 Player (org.bukkit.entity.Player)2