Search in sources :

Example 1 with InteractiveChat

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

the class InteractiveChatDiscordSrvAddon method onEnable.

@Override
public void onEnable() {
    plugin = this;
    interactivechat = InteractiveChat.plugin;
    discordsrv = DiscordSRV.getPlugin();
    if (!getDataFolder().exists()) {
        getDataFolder().mkdirs();
    }
    AssetsDownloader.loadLibraries(getDataFolder());
    try {
        Config.loadConfig(CONFIG_ID, new File(getDataFolder(), "config.yml"), getClass().getClassLoader().getResourceAsStream("config.yml"), getClass().getClassLoader().getResourceAsStream("config.yml"), true);
    } catch (IOException e) {
        e.printStackTrace();
        getServer().getPluginManager().disablePlugin(this);
        return;
    }
    reloadConfig();
    metrics = new Metrics(this, BSTATS_PLUGIN_ID);
    Charts.setup(metrics);
    DiscordSRV.api.subscribe(new DiscordReadyEvents());
    DiscordSRV.api.subscribe(new OutboundToDiscordEvents());
    DiscordSRV.api.subscribe(new InboundToGameEvents());
    getServer().getPluginManager().registerEvents(this, this);
    getServer().getPluginManager().registerEvents(new InboundToGameEvents(), this);
    getServer().getPluginManager().registerEvents(new OutboundToDiscordEvents(), this);
    getServer().getPluginManager().registerEvents(new ICPlayerEvents(), this);
    getServer().getPluginManager().registerEvents(new Debug(), this);
    getServer().getPluginManager().registerEvents(new Updater(), this);
    getCommand("interactivechatdiscordsrv").setExecutor(new Commands());
    File resourcepacks = new File(getDataFolder(), "resourcepacks");
    if (!resourcepacks.exists()) {
        File resources = new File(getDataFolder(), "resources");
        if (resources.exists() && resources.isDirectory()) {
            try {
                Files.move(resources.toPath(), resourcepacks.toPath(), StandardCopyOption.ATOMIC_MOVE);
            } catch (IOException e) {
                getServer().getConsoleSender().sendMessage(ChatColor.RED + "[ICDiscordSrvAddon] Unable to move folder, are any files opened?");
                e.printStackTrace();
                getServer().getPluginManager().disablePlugin(this);
                return;
            }
        } else {
            resourcepacks.mkdirs();
        }
    }
    if (!compatible()) {
        for (int i = 0; i < 10; i++) {
            getServer().getConsoleSender().sendMessage(ChatColor.RED + "[ICDiscordSrvAddon] VERSION NOT COMPATIBLE WITH INSTALLED INTERACTIVECHAT VERSION, PLEASE UPDATE BOTH TO LATEST!!!!");
        }
        getServer().getPluginManager().disablePlugin(this);
        return;
    } else {
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[ICDiscordSrvAddon] InteractiveChat DiscordSRV Addon has been Enabled!");
    }
    reloadTextures(false, false);
    modelRenderer = new ModelRenderer(str -> new ThreadFactoryBuilder().setNameFormat(str).build(), () -> InteractiveChatDiscordSrvAddon.plugin.cacheTimeout, image -> ImageGeneration.getEnchantedImage(image), image -> ImageGeneration.getRawEnchantedImage(image), () -> 8, () -> Runtime.getRuntime().availableProcessors());
    ThreadFactory factory = new ThreadFactoryBuilder().setNameFormat("InteractiveChatDiscordSRVAddon Async Media Reading Thread #%d").build();
    mediaReadingService = Executors.newFixedThreadPool(4, factory);
    Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
        for (ICPlayer player : ICPlayerFactory.getOnlineICPlayers()) {
            cachePlayerSkin(player);
        }
        AssetsDownloader.loadExtras();
    }, 600, 6000);
}
Also used : Color(java.awt.Color) Charts(com.loohp.interactivechatdiscordsrvaddon.metrics.Charts) Arrays(java.util.Arrays) FontTextureResource(com.loohp.interactivechatdiscordsrvaddon.resources.fonts.FontTextureResource) ListIterator(java.util.ListIterator) ResourcePackInfo(com.loohp.interactivechatdiscordsrvaddon.resources.ResourcePackInfo) JSONParser(com.loohp.interactivechat.libs.org.json.simple.parser.JSONParser) EventHandler(org.bukkit.event.EventHandler) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) Map(java.util.Map) ThreadFactory(java.util.concurrent.ThreadFactory) PlaceholderCooldownManager(com.loohp.interactivechat.objectholders.PlaceholderCooldownManager) Debug(com.loohp.interactivechatdiscordsrvaddon.debug.Debug) Bukkit(org.bukkit.Bukkit) InboundToGameEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.InboundToGameEvents) PlayerJoinEvent(org.bukkit.event.player.PlayerJoinEvent) CommandSender(org.bukkit.command.CommandSender) BufferedImage(java.awt.image.BufferedImage) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) UUID(java.util.UUID) Executors(java.util.concurrent.Executors) InteractiveChat(com.loohp.interactivechat.InteractiveChat) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) ImageGeneration(com.loohp.interactivechatdiscordsrvaddon.graphics.ImageGeneration) List(java.util.List) Stream(java.util.stream.Stream) Entry(java.util.Map.Entry) Queue(java.util.Queue) Permission(github.scarsz.discordsrv.dependencies.jda.api.Permission) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) DiscordReadyEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.DiscordReadyEvents) ImageUtils(com.loohp.interactivechatdiscordsrvaddon.graphics.ImageUtils) ResourceManager(com.loohp.interactivechatdiscordsrvaddon.resources.ResourceManager) Registry(com.loohp.interactivechat.registry.Registry) Config(com.loohp.interactivechat.config.Config) ModelRenderer(com.loohp.interactivechatdiscordsrvaddon.resources.ModelRenderer) SkinUtils(com.loohp.interactivechat.utils.SkinUtils) StandardCopyOption(java.nio.file.StandardCopyOption) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) DiscordSRV(github.scarsz.discordsrv.DiscordSRV) LanguageUtils(com.loohp.interactivechat.utils.LanguageUtils) InteractiveChatRegistry(com.loohp.interactivechatdiscordsrvaddon.registry.InteractiveChatRegistry) Metrics(com.loohp.interactivechatdiscordsrvaddon.metrics.Metrics) JSONObject(com.loohp.interactivechat.libs.org.json.simple.JSONObject) OutboundToDiscordEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.OutboundToDiscordEvents) ExecutorService(java.util.concurrent.ExecutorService) ChatColor(net.md_5.bungee.api.ChatColor) Listener(org.bukkit.event.Listener) ColorUtils(com.loohp.interactivechat.utils.ColorUtils) ReentrantLock(java.util.concurrent.locks.ReentrantLock) Files(java.nio.file.Files) IOException(java.io.IOException) ICPlayerEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.ICPlayerEvents) File(java.io.File) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) ICPlayerFactory(com.loohp.interactivechat.objectholders.ICPlayerFactory) ChatColorUtils(com.loohp.interactivechat.utils.ChatColorUtils) Collections(java.util.Collections) Updater(com.loohp.interactivechatdiscordsrvaddon.updater.Updater) ThreadFactory(java.util.concurrent.ThreadFactory) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) DiscordReadyEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.DiscordReadyEvents) OutboundToDiscordEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.OutboundToDiscordEvents) ICPlayerEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.ICPlayerEvents) IOException(java.io.IOException) InboundToGameEvents(com.loohp.interactivechatdiscordsrvaddon.listeners.InboundToGameEvents) Metrics(com.loohp.interactivechatdiscordsrvaddon.metrics.Metrics) ModelRenderer(com.loohp.interactivechatdiscordsrvaddon.resources.ModelRenderer) Updater(com.loohp.interactivechatdiscordsrvaddon.updater.Updater) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) File(java.io.File) Debug(com.loohp.interactivechatdiscordsrvaddon.debug.Debug)

Example 2 with InteractiveChat

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

the class OutChatPacket method processPacket.

private static void processPacket(Player receiver, PacketContainer packet, UUID messageUUID, boolean isFiltered) {
    PacketContainer originalPacket = packet.deepClone();
    try {
        Component component = null;
        ChatComponentType type = null;
        int field = -1;
        search: for (ChatComponentType t : ChatComponentType.byPriority()) {
            for (int i = 0; i < packet.getModifier().size(); i++) {
                if (!CustomArrayUtils.allNull(packet.getModifier().read(i)) && packet.getModifier().getField(i).getType().getName().matches(t.getMatchingRegex())) {
                    try {
                        component = t.convertFrom(packet.getModifier().read(i));
                    } catch (Throwable e) {
                        System.err.println(t.toString(packet.getModifier().read(i)));
                        e.printStackTrace();
                        service.send(packet, receiver, messageUUID);
                        return;
                    }
                    field = i;
                    type = t;
                    break search;
                }
            }
        }
        if (field < 0 || type == null || component == null) {
            service.send(packet, receiver, messageUUID);
            return;
        }
        String legacyText = LegacyComponentSerializer.legacySection().serializeOr(component, "");
        try {
            if (legacyText.equals("") || InteractiveChat.messageToIgnore.stream().anyMatch(each -> legacyText.matches(each))) {
                service.send(packet, receiver, messageUUID);
                return;
            }
        } catch (Exception e) {
            service.send(packet, receiver, messageUUID);
            return;
        }
        if (InteractiveChat.version.isOld() && JsonUtils.containsKey(InteractiveChatComponentSerializer.gson().serialize(component), "translate")) {
            service.send(packet, receiver, messageUUID);
            return;
        }
        boolean isCommand = false;
        boolean isChat = false;
        Optional<ICPlayer> sender = Optional.empty();
        String rawMessageKey = PlainTextComponentSerializer.plainText().serializeOr(component, "");
        InteractiveChat.keyTime.putIfAbsent(rawMessageKey, System.currentTimeMillis());
        Long timeKey = InteractiveChat.keyTime.get(rawMessageKey);
        long unix = timeKey == null ? System.currentTimeMillis() : timeKey;
        ProcessSenderResult commandSender = ProcessCommands.process(component);
        if (commandSender.getSender() != null) {
            ICPlayer icplayer = ICPlayerFactory.getICPlayer(commandSender.getSender());
            if (icplayer != null) {
                sender = Optional.of(icplayer);
                // noinspection UnusedAssignment
                isCommand = true;
            }
        }
        ProcessSenderResult chatSender = null;
        if (!sender.isPresent()) {
            if (InteractiveChat.useAccurateSenderFinder) {
                chatSender = ProcessAccurateSender.process(component);
                if (chatSender.getSender() != null) {
                    ICPlayer icplayer = ICPlayerFactory.getICPlayer(chatSender.getSender());
                    if (icplayer != null) {
                        sender = Optional.of(icplayer);
                        // noinspection UnusedAssignment
                        isChat = true;
                    }
                }
            }
        }
        if (!sender.isPresent() && !InteractiveChat.useAccurateSenderFinder) {
            sender = SenderFinder.getSender(component, rawMessageKey);
        }
        if (sender.isPresent() && !sender.get().isLocal()) {
            if (isFiltered) {
                Bukkit.getScheduler().runTaskLaterAsynchronously(InteractiveChat.plugin, () -> {
                    service.execute(() -> {
                        processPacket(receiver, packet, messageUUID, false);
                    }, receiver, messageUUID);
                }, (int) Math.ceil((double) InteractiveChat.remoteDelay / 50));
                return;
            }
        }
        component = commandSender.getComponent();
        if (chatSender != null) {
            component = chatSender.getComponent();
        }
        if (sender.isPresent()) {
            InteractiveChat.keyPlayer.put(rawMessageKey, sender.get());
        }
        component = ComponentModernizing.modernize(component);
        component = component.replaceText(TextReplacementConfig.builder().match(Registry.ID_PATTERN).replacement("").build());
        UUID preEventSenderUUID = sender.isPresent() ? sender.get().getUniqueId() : null;
        PrePacketComponentProcessEvent preEvent = new PrePacketComponentProcessEvent(true, receiver, component, preEventSenderUUID);
        Bukkit.getPluginManager().callEvent(preEvent);
        if (preEvent.getSender() != null) {
            Player newsender = Bukkit.getPlayer(preEvent.getSender());
            if (newsender != null) {
                sender = Optional.of(ICPlayerFactory.getICPlayer(newsender));
            }
        }
        component = preEvent.getComponent();
        if (InteractiveChat.translateHoverableItems && InteractiveChat.itemGUI) {
            component = HoverableItemDisplay.process(component, receiver);
        }
        if (InteractiveChat.usePlayerName) {
            component = PlayernameDisplay.process(component, sender, receiver, unix);
        }
        if (InteractiveChat.allowMention && sender.isPresent()) {
            PlayerData data = InteractiveChat.playerDataManager.getPlayerData(receiver);
            if (data == null || !data.isMentionDisabled()) {
                component = MentionDisplay.process(component, receiver, sender.get(), unix, true);
            }
        }
        component = ComponentReplacing.replace(component, Registry.MENTION_TAG_CONVERTER.getReversePattern().pattern(), true, (result, components) -> {
            return LegacyComponentSerializer.legacySection().deserialize(result.group(2));
        });
        component = CustomPlaceholderDisplay.process(component, sender, receiver, InteractiveChat.placeholderList.values(), unix);
        if (InteractiveChat.useItem) {
            component = ItemDisplay.process(component, sender, receiver, unix);
        }
        if (InteractiveChat.useInventory) {
            component = InventoryDisplay.process(component, sender, receiver, unix);
        }
        if (InteractiveChat.useEnder) {
            component = EnderchestDisplay.process(component, sender, receiver, unix);
        }
        if (InteractiveChat.clickableCommands) {
            component = CommandsDisplay.process(component);
        }
        if (InteractiveChat.version.isNewerOrEqualTo(MCVersion.V1_16) && InteractiveChat.fontTags) {
            if (!sender.isPresent() || (sender.isPresent() && PlayerUtils.hasPermission(sender.get().getUniqueId(), "interactivechat.customfont.translate", true, 250))) {
                component = ComponentFont.parseFont(component);
            }
        }
        if (PlayerUtils.getColorSettings(receiver).equals(ColorSettings.OFF)) {
            component = ComponentStyling.stripColor(component);
        }
        PostPacketComponentProcessEvent postEvent = new PostPacketComponentProcessEvent(true, receiver, component, preEventSenderUUID);
        Bukkit.getPluginManager().callEvent(postEvent);
        component = postEvent.getComponent();
        boolean legacyRGB = InteractiveChat.version.isLegacyRGB();
        String json = legacyRGB ? InteractiveChatComponentSerializer.legacyGson().serialize(component) : InteractiveChatComponentSerializer.gson().serialize(component);
        boolean longerThanMaxLength = InteractiveChat.sendOriginalIfTooLong && json.length() > InteractiveChat.packetStringMaxLength;
        try {
            packet.getModifier().write(field, type.convertTo(component, legacyRGB));
        } catch (Throwable e) {
            for (int i = 0; i < chatFieldsSize; i++) {
                packet.getModifier().write(i, null);
            }
            packet.getChatComponents().write(0, WrappedChatComponent.fromJson(json));
        }
        UUID postEventSenderUUID = sender.isPresent() ? sender.get().getUniqueId() : new UUID(0, 0);
        if (packet.getUUIDs().size() > 0) {
            packet.getUUIDs().write(0, postEventSenderUUID);
        }
        PreChatPacketSendEvent sendEvent = new PreChatPacketSendEvent(true, receiver, packet, postEventSenderUUID, originalPacket, InteractiveChat.sendOriginalIfTooLong, longerThanMaxLength);
        Bukkit.getPluginManager().callEvent(sendEvent);
        Bukkit.getScheduler().runTaskLater(InteractiveChat.plugin, () -> {
            InteractiveChat.keyTime.remove(rawMessageKey);
            InteractiveChat.keyPlayer.remove(rawMessageKey);
        }, 10);
        if (sendEvent.isCancelled()) {
            if (sendEvent.sendOriginalIfCancelled()) {
                if (longerThanMaxLength && InteractiveChat.cancelledMessage) {
                    Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[InteractiveChat] " + ChatColor.RED + "Cancelled a chat packet bounded to " + receiver.getName() + " that is " + json.length() + " characters long (Longer than maximum allowed in a chat packet), sending original unmodified message instead! [THIS IS NOT A BUG]");
                }
                PacketContainer originalPacketModified = sendEvent.getOriginal();
                service.send(originalPacketModified, receiver, messageUUID);
                return;
            }
            if (longerThanMaxLength && InteractiveChat.cancelledMessage) {
                Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[InteractiveChat] " + ChatColor.RED + "Cancelled a chat packet bounded to " + receiver.getName() + " that is " + json.length() + " characters long (Longer than maximum allowed in a chat packet) [THIS IS NOT A BUG]");
            }
            service.discard(receiver.getUniqueId(), messageUUID);
            return;
        }
        service.send(packet, receiver, messageUUID);
    } catch (Exception e) {
        e.printStackTrace();
        service.send(originalPacket, receiver, messageUUID);
    }
}
Also used : ComponentReplacing(com.loohp.interactivechat.utils.ComponentReplacing) PlayerUtils(com.loohp.interactivechat.utils.PlayerUtils) PlayerData(com.loohp.interactivechat.data.PlayerDataManager.PlayerData) Player(org.bukkit.entity.Player) PreChatPacketSendEvent(com.loohp.interactivechat.api.events.PreChatPacketSendEvent) ComponentModernizing(com.loohp.interactivechat.utils.ComponentModernizing) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) ComponentFont(com.loohp.interactivechat.utils.ComponentFont) InteractiveChatComponentSerializer(com.loohp.interactivechat.utils.InteractiveChatComponentSerializer) HoverableItemDisplay(com.loohp.interactivechat.modules.HoverableItemDisplay) InventoryDisplay(com.loohp.interactivechat.modules.InventoryDisplay) Bukkit(org.bukkit.Bukkit) ProcessAccurateSender(com.loohp.interactivechat.modules.ProcessAccurateSender) CustomArrayUtils(com.loohp.interactivechat.utils.CustomArrayUtils) CustomPlaceholderDisplay(com.loohp.interactivechat.modules.CustomPlaceholderDisplay) ListenerPriority(com.comphenix.protocol.events.ListenerPriority) UUID(java.util.UUID) PacketType(com.comphenix.protocol.PacketType) Collectors(java.util.stream.Collectors) InteractiveChat(com.loohp.interactivechat.InteractiveChat) PacketContainer(com.comphenix.protocol.events.PacketContainer) List(java.util.List) AsyncChatSendingExecutor(com.loohp.interactivechat.objectholders.AsyncChatSendingExecutor) CommandsDisplay(com.loohp.interactivechat.modules.CommandsDisplay) TextReplacementConfig(net.kyori.adventure.text.TextReplacementConfig) PrePacketComponentProcessEvent(com.loohp.interactivechat.api.events.PrePacketComponentProcessEvent) ColorSettings(com.loohp.interactivechat.utils.PlayerUtils.ColorSettings) Optional(java.util.Optional) ProcessSenderResult(com.loohp.interactivechat.objectholders.ProcessSenderResult) WrappedChatComponent(com.comphenix.protocol.wrappers.WrappedChatComponent) MCVersion(com.loohp.interactivechat.utils.MCVersion) Registry(com.loohp.interactivechat.registry.Registry) MentionDisplay(com.loohp.interactivechat.modules.MentionDisplay) JsonUtils(com.loohp.interactivechat.utils.JsonUtils) PostPacketComponentProcessEvent(com.loohp.interactivechat.api.events.PostPacketComponentProcessEvent) ComponentStyling(com.loohp.interactivechat.utils.ComponentStyling) PacketAdapter(com.comphenix.protocol.events.PacketAdapter) Component(net.kyori.adventure.text.Component) LegacyComponentSerializer(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer) VentureChatInjection(com.loohp.interactivechat.hooks.venturechat.VentureChatInjection) ChatColor(net.md_5.bungee.api.ChatColor) Listener(org.bukkit.event.Listener) PacketEvent(com.comphenix.protocol.events.PacketEvent) ChatComponentType(com.loohp.interactivechat.utils.ChatComponentType) ProcessCommands(com.loohp.interactivechat.modules.ProcessCommands) ItemDisplay(com.loohp.interactivechat.modules.ItemDisplay) EnderchestDisplay(com.loohp.interactivechat.modules.EnderchestDisplay) ChatType(com.comphenix.protocol.wrappers.EnumWrappers.ChatType) PlayernameDisplay(com.loohp.interactivechat.modules.PlayernameDisplay) PlainTextComponentSerializer(net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer) ICPlayerFactory(com.loohp.interactivechat.objectholders.ICPlayerFactory) SenderFinder(com.loohp.interactivechat.modules.SenderFinder) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) ProcessSenderResult(com.loohp.interactivechat.objectholders.ProcessSenderResult) PacketContainer(com.comphenix.protocol.events.PacketContainer) PrePacketComponentProcessEvent(com.loohp.interactivechat.api.events.PrePacketComponentProcessEvent) Player(org.bukkit.entity.Player) ICPlayer(com.loohp.interactivechat.objectholders.ICPlayer) ChatComponentType(com.loohp.interactivechat.utils.ChatComponentType) PostPacketComponentProcessEvent(com.loohp.interactivechat.api.events.PostPacketComponentProcessEvent) PreChatPacketSendEvent(com.loohp.interactivechat.api.events.PreChatPacketSendEvent) WrappedChatComponent(com.comphenix.protocol.wrappers.WrappedChatComponent) Component(net.kyori.adventure.text.Component) UUID(java.util.UUID) PlayerData(com.loohp.interactivechat.data.PlayerDataManager.PlayerData)

Example 3 with InteractiveChat

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

the class InteractiveChatBungee method onPlayerConnected.

@EventHandler
public void onPlayerConnected(PostLoginEvent event) {
    if (!filtersAdded) {
        addFilters();
    }
    ProxiedPlayer player = event.getPlayer();
    forwardedMessages.put(player.getUniqueId(), new ConcurrentHashMap<>());
    if (player.hasPermission("interactivechat.backendinfo")) {
        String proxyVersion = plugin.getDescription().getVersion();
        for (BackendInteractiveChatData data : serverInteractiveChatInfo.values()) {
            if (data.isOnline() && data.getProtocolVersion() != Registry.PLUGIN_MESSAGING_PROTOCOL_VERSION) {
                String msg = ChatColor.RED + "[InteractiveChat] Warning: Backend Server " + data.getServer() + " is not running a version of InteractiveChat which has the same plugin messaging protocol version as the proxy!";
                Component text = LegacyComponentSerializer.legacySection().deserialize(msg);
                text = text.hoverEvent(HoverEvent.showText(LegacyComponentSerializer.legacySection().deserialize(ChatColor.YELLOW + "Proxy Version: " + proxyVersion + " (" + Registry.PLUGIN_MESSAGING_PROTOCOL_VERSION + ")\n" + ChatColor.RED + data.getServer() + " Version: " + data.getVersion() + " (" + data.getProtocolVersion() + ")")));
                sendMessage(player, text);
                sendMessage(ProxyServer.getInstance().getConsole(), text);
            }
        }
    }
    UserConnection userConnection = (UserConnection) player;
    ChannelWrapper channelWrapper;
    Field channelField = null;
    try {
        channelField = userConnection.getClass().getDeclaredField("ch");
        channelField.setAccessible(true);
        channelWrapper = (ChannelWrapper) channelField.get(userConnection);
    } catch (NoSuchFieldException | IllegalAccessException e) {
        throw new RuntimeException(e);
    } finally {
        if (channelField != null) {
            channelField.setAccessible(false);
        }
    }
    ChannelPipeline pipeline = channelWrapper.getHandle().pipeline();
    pipeline.addBefore(PipelineUtils.BOSS_HANDLER, "interactivechat_interceptor", new ChannelDuplexHandler() {

        @Override
        public void write(ChannelHandlerContext channelHandlerContext, Object obj, ChannelPromise channelPromise) throws Exception {
            try {
                if (obj instanceof Chat) {
                    Chat packet = (Chat) obj;
                    String message = packet.getMessage();
                    byte position = packet.getPosition();
                    if ((position == 0 || position == 1) && message != null) {
                        if (message.contains("<QUxSRUFEWVBST0NFU1NFRA==>")) {
                            message = message.replace("<QUxSRUFEWVBST0NFU1NFRA==>", "");
                            if (Registry.ID_PATTERN.matcher(message).find()) {
                                message = Registry.ID_PATTERN.matcher(message).replaceAll("").trim();
                            }
                            packet.setMessage(message);
                        } else if (hasInteractiveChat(player.getServer())) {
                            messageForwardingHandler.processMessage(player.getUniqueId(), message, position);
                            return;
                        }
                    }
                }
            } catch (Throwable e) {
                e.printStackTrace();
            }
            super.write(channelHandlerContext, obj, channelPromise);
        }
    });
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) BackendInteractiveChatData(com.loohp.interactivechat.proxy.objectholders.BackendInteractiveChatData) ChannelWrapper(net.md_5.bungee.netty.ChannelWrapper) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) ChannelPromise(io.netty.channel.ChannelPromise) UserConnection(net.md_5.bungee.UserConnection) ChannelPipeline(io.netty.channel.ChannelPipeline) IOException(java.io.IOException) Field(java.lang.reflect.Field) ChannelDuplexHandler(io.netty.channel.ChannelDuplexHandler) Chat(net.md_5.bungee.protocol.packet.Chat) InteractiveChat(com.loohp.interactivechat.InteractiveChat) Component(net.kyori.adventure.text.Component) EventHandler(net.md_5.bungee.event.EventHandler)

Example 4 with InteractiveChat

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

the class InteractiveChatBungee method onEnable.

@Override
public void onEnable() {
    plugin = this;
    if (!getDataFolder().exists()) {
        getDataFolder().mkdir();
    }
    try {
        Config.loadConfig(CONFIG_ID, new File(getDataFolder(), "bungeeconfig.yml"), getResourceAsStream("config_proxy.yml"), getResourceAsStream("config_proxy.yml"), true);
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }
    loadConfig();
    getProxy().registerChannel("interchat:main");
    getProxy().getPluginManager().registerListener(this, this);
    getProxy().getPluginManager().registerCommand(this, new CommandsBungee());
    if (ProxyServer.getInstance().getPluginManager().getPlugin("ViaVersion") != null) {
        viaVersionHook = true;
        ProxyServer.getInstance().getLogger().info(ChatColor.AQUA + "[InteractiveChat] InteractiveChatBungee has hooked into ViaVersion!");
    }
    ProxyServer.getInstance().getLogger().info(ChatColor.GREEN + "[InteractiveChat] Registered Plugin Messaging Channels!");
    metrics = new Metrics(plugin, BSTATS_PLUGIN_ID);
    Charts.setup(metrics);
    playerCooldownManager = new ProxyPlayerCooldownManager(placeholderList.values().stream().flatMap(each -> each.stream()).distinct().collect(Collectors.toList()));
    run();
    messageForwardingHandler = new ProxyMessageForwardingHandler((info, component) -> {
        ProxiedPlayer player = ProxyServer.getInstance().getPlayer(info.getPlayer());
        Server server = player.getServer();
        ProxyServer.getInstance().getScheduler().schedule(plugin, () -> {
            try {
                if (player != null && server != null) {
                    PluginMessageSendingBungee.requestMessageProcess(player, server.getInfo(), component, info.getId());
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }, delay + 50, TimeUnit.MILLISECONDS);
    }, (info, component) -> {
        Chat chatPacket = new Chat(component + "<QUxSRUFEWVBST0NFU1NFRA==>", info.getPosition());
        UserConnection userConnection = (UserConnection) ProxyServer.getInstance().getPlayer(info.getPlayer());
        ChannelWrapper channelWrapper;
        Field channelField = null;
        if (userConnection == null) {
            return;
        }
        try {
            channelField = userConnection.getClass().getDeclaredField("ch");
            channelField.setAccessible(true);
            channelWrapper = (ChannelWrapper) channelField.get(userConnection);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            throw new RuntimeException(e);
        } finally {
            if (channelField != null) {
                channelField.setAccessible(false);
            }
        }
        channelWrapper.write(chatPacket);
    }, uuid -> {
        return ProxyServer.getInstance().getPlayer(uuid) != null;
    }, uuid -> {
        return hasInteractiveChat(ProxyServer.getInstance().getPlayer(uuid).getServer());
    }, () -> (long) delay + 2000);
    ThreadFactory factory = new ThreadFactoryBuilder().setNameFormat("InteractiveChatProxy Async PluginMessage Processing Thread #%d").build();
    pluginMessageHandlingExecutor = new ThreadPoolExecutor(8, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(true), factory);
    ProxyServer.getInstance().getLogger().info(ChatColor.GREEN + "[InteractiveChat] InteractiveChat (Bungeecord) has been enabled!");
    addFilters();
}
Also used : Charts(com.loohp.interactivechat.proxy.bungee.metrics.Charts) Arrays(java.util.Arrays) PlayerUtils(com.loohp.interactivechat.utils.PlayerUtils) SocketAddress(java.net.SocketAddress) PostLoginEvent(net.md_5.bungee.api.event.PostLoginEvent) Random(java.util.Random) ParsePlayer(com.loohp.interactivechat.objectholders.CustomPlaceholder.ParsePlayer) UserConnection(net.md_5.bungee.UserConnection) ByteBuffer(java.nio.ByteBuffer) Via(us.myles.ViaVersion.api.Via) EventPriority(net.md_5.bungee.event.EventPriority) InteractiveChatComponentSerializer(com.loohp.interactivechat.utils.InteractiveChatComponentSerializer) Matcher(java.util.regex.Matcher) ChannelPromise(io.netty.channel.ChannelPromise) Chat(net.md_5.bungee.protocol.packet.Chat) Map(java.util.Map) ThreadFactory(java.util.concurrent.ThreadFactory) Material(org.bukkit.Material) ChannelDuplexHandler(io.netty.channel.ChannelDuplexHandler) Listener(net.md_5.bungee.api.plugin.Listener) CommandSender(net.md_5.bungee.api.CommandSender) Filter(java.util.logging.Filter) SynchronousQueue(java.util.concurrent.SynchronousQueue) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ChannelPipeline(io.netty.channel.ChannelPipeline) UUID(java.util.UUID) LogRecord(java.util.logging.LogRecord) Logger(java.util.logging.Logger) PlaceholderAPI(me.clip.placeholderapi.PlaceholderAPI) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) InteractiveChat(com.loohp.interactivechat.InteractiveChat) ChatEvent(net.md_5.bungee.api.event.ChatEvent) ComponentSerializer(net.md_5.bungee.chat.ComponentSerializer) List(java.util.List) ClickEventAction(com.loohp.interactivechat.objectholders.CustomPlaceholder.ClickEventAction) Server(net.md_5.bungee.api.connection.Server) ChannelWrapper(net.md_5.bungee.netty.ChannelWrapper) ByteStreams(com.google.common.io.ByteStreams) Entry(java.util.Map.Entry) ServerConnection(net.md_5.bungee.ServerConnection) Plugin(net.md_5.bungee.api.plugin.Plugin) Pattern(java.util.regex.Pattern) CustomPlaceholderClickEvent(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderClickEvent) HoverEvent(net.kyori.adventure.text.event.HoverEvent) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) ProxyPlayerCooldownManager(com.loohp.interactivechat.proxy.objectholders.ProxyPlayerCooldownManager) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) CustomPlaceholder(com.loohp.interactivechat.objectholders.CustomPlaceholder) Registry(com.loohp.interactivechat.registry.Registry) Config(com.loohp.interactivechat.config.Config) DataTypeIO(com.loohp.interactivechat.utils.DataTypeIO) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) BuiltInPlaceholder(com.loohp.interactivechat.objectholders.BuiltInPlaceholder) ServerInfo(net.md_5.bungee.api.config.ServerInfo) CustomPlaceholderReplaceText(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderReplaceText) ArrayList(java.util.ArrayList) ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) LinkedHashMap(java.util.LinkedHashMap) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) Component(net.kyori.adventure.text.Component) ServerConnectedEvent(net.md_5.bungee.api.event.ServerConnectedEvent) ByteArrayDataInput(com.google.common.io.ByteArrayDataInput) Metrics(com.loohp.interactivechat.proxy.bungee.metrics.Metrics) PlayerDisconnectEvent(net.md_5.bungee.api.event.PlayerDisconnectEvent) ICPlaceholder(com.loohp.interactivechat.objectholders.ICPlaceholder) LegacyComponentSerializer(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer) ChatColor(net.md_5.bungee.api.ChatColor) Iterator(java.util.Iterator) BackendInteractiveChatData(com.loohp.interactivechat.proxy.objectholders.BackendInteractiveChatData) PluginMessageEvent(net.md_5.bungee.api.event.PluginMessageEvent) IOException(java.io.IOException) PipelineUtils(net.md_5.bungee.netty.PipelineUtils) ProxyServer(net.md_5.bungee.api.ProxyServer) Field(java.lang.reflect.Field) ServerSwitchEvent(net.md_5.bungee.api.event.ServerSwitchEvent) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) AtomicLong(java.util.concurrent.atomic.AtomicLong) CustomPlaceholderHoverEvent(com.loohp.interactivechat.objectholders.CustomPlaceholder.CustomPlaceholderHoverEvent) ChatColorUtils(com.loohp.interactivechat.utils.ChatColorUtils) EventHandler(net.md_5.bungee.event.EventHandler) Collections(java.util.Collections) ProxyMessageForwardingHandler(com.loohp.interactivechat.proxy.objectholders.ProxyMessageForwardingHandler) ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) ThreadFactory(java.util.concurrent.ThreadFactory) Server(net.md_5.bungee.api.connection.Server) ProxyServer(net.md_5.bungee.api.ProxyServer) ProxyPlayerCooldownManager(com.loohp.interactivechat.proxy.objectholders.ProxyPlayerCooldownManager) ChannelWrapper(net.md_5.bungee.netty.ChannelWrapper) IOException(java.io.IOException) UserConnection(net.md_5.bungee.UserConnection) Field(java.lang.reflect.Field) Metrics(com.loohp.interactivechat.proxy.bungee.metrics.Metrics) ProxyMessageForwardingHandler(com.loohp.interactivechat.proxy.objectholders.ProxyMessageForwardingHandler) SynchronousQueue(java.util.concurrent.SynchronousQueue) Chat(net.md_5.bungee.protocol.packet.Chat) InteractiveChat(com.loohp.interactivechat.InteractiveChat) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) File(java.io.File)

Example 5 with InteractiveChat

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

the class LanguageUtils method loadTranslations.

@SuppressWarnings("unchecked")
public static void loadTranslations(String language) {
    Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[InteractiveChat] Loading languages...");
    Bukkit.getScheduler().runTaskAsynchronously(InteractiveChat.plugin, () -> {
        while (lock.get()) {
            try {
                TimeUnit.MILLISECONDS.sleep(1);
            } catch (InterruptedException ignored) {
            }
        }
        lock.set(true);
        try {
            File langFolder = new File(InteractiveChat.plugin.getDataFolder(), "lang");
            langFolder.mkdirs();
            File langFileFolder = new File(langFolder, "languages");
            langFileFolder.mkdirs();
            File hashFile = new File(langFolder, "hashes.json");
            if (!hashFile.exists()) {
                PrintWriter pw = new PrintWriter(hashFile, "UTF-8");
                pw.print("{");
                pw.print("}");
                pw.flush();
                pw.close();
            }
            InputStreamReader hashStream = new InputStreamReader(new FileInputStream(hashFile), StandardCharsets.UTF_8);
            JSONObject data = (JSONObject) new JSONParser().parse(hashStream);
            hashStream.close();
            try {
                JSONObject manifest = HTTPRequestUtils.getJSONResponse(VERSION_MANIFEST_URL);
                if (manifest == null) {
                    Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to fetch version_manifest from " + VERSION_MANIFEST_URL);
                } else {
                    String mcVersion = InteractiveChat.exactMinecraftVersion;
                    Object urlObj = ((JSONArray) manifest.get("versions")).stream().filter(each -> ((JSONObject) each).get("id").toString().equalsIgnoreCase(mcVersion)).map(each -> ((JSONObject) each).get("url").toString()).findFirst().orElse(null);
                    if (urlObj == null) {
                        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to find " + mcVersion + " from version_manifest");
                    } else {
                        JSONObject versionData = HTTPRequestUtils.getJSONResponse(urlObj.toString());
                        if (versionData == null) {
                            Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to fetch version data from " + urlObj);
                        } else {
                            String clientUrl = ((JSONObject) ((JSONObject) versionData.get("downloads")).get("client")).get("url").toString();
                            try (ZipArchiveInputStream zip = new ZipArchiveInputStream(new ByteArrayInputStream(HTTPRequestUtils.download(clientUrl)), StandardCharsets.UTF_8.toString(), false, true, true)) {
                                while (true) {
                                    ZipArchiveEntry entry = zip.getNextZipEntry();
                                    if (entry == null) {
                                        break;
                                    }
                                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                                    byte[] byteChunk = new byte[4096];
                                    int n;
                                    while ((n = zip.read(byteChunk)) > 0) {
                                        baos.write(byteChunk, 0, n);
                                    }
                                    byte[] currentEntry = baos.toByteArray();
                                    String name = entry.getName().toLowerCase();
                                    if (name.matches("^.*assets/minecraft/lang/en_us.(json|lang)$")) {
                                        String enUsFileHash = HashUtils.createSha1String(new ByteArrayInputStream(currentEntry));
                                        String enUsExtension = name.substring(name.indexOf(".") + 1);
                                        if (data.containsKey("en_us")) {
                                            JSONObject values = (JSONObject) data.get("en_us");
                                            File fileToSave = new File(langFileFolder, "en_us" + "." + enUsExtension);
                                            if (!values.get("hash").toString().equals(enUsFileHash) || !fileToSave.exists()) {
                                                values.put("hash", enUsFileHash);
                                                if (fileToSave.exists()) {
                                                    fileToSave.delete();
                                                }
                                                FileUtils.copy(new ByteArrayInputStream(currentEntry), fileToSave);
                                            }
                                        } else {
                                            JSONObject values = new JSONObject();
                                            values.put("hash", enUsFileHash);
                                            File fileToSave = new File(langFileFolder, "en_us" + "." + enUsExtension);
                                            if (fileToSave.exists()) {
                                                fileToSave.delete();
                                            }
                                            FileUtils.copy(new ByteArrayInputStream(currentEntry), fileToSave);
                                            data.put("en_us", values);
                                        }
                                        zip.close();
                                        break;
                                    }
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            String indexUrl = ((JSONObject) versionData.get("assetIndex")).get("url").toString();
                            JSONObject assets = HTTPRequestUtils.getJSONResponse(indexUrl);
                            if (assets == null) {
                                Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to fetch assets data from " + indexUrl);
                            } else {
                                JSONObject objects = (JSONObject) assets.get("objects");
                                for (Object obj : objects.keySet()) {
                                    String key = obj.toString().toLowerCase();
                                    if (key.matches("^minecraft\\/lang\\/" + language + ".(json|lang)$")) {
                                        String lang = key.substring(key.lastIndexOf("/") + 1, key.indexOf("."));
                                        String extension = key.substring(key.indexOf(".") + 1);
                                        String hash = ((JSONObject) objects.get(obj.toString())).get("hash").toString();
                                        String fileUrl = RESOURCES_URL + hash.substring(0, 2) + "/" + hash;
                                        if (data.containsKey(lang)) {
                                            JSONObject values = (JSONObject) data.get(lang);
                                            File fileToSave = new File(langFileFolder, lang + "." + extension);
                                            if (!values.get("hash").toString().equals(hash) || !fileToSave.exists()) {
                                                values.put("hash", hash);
                                                if (fileToSave.exists()) {
                                                    fileToSave.delete();
                                                }
                                                if (!HTTPRequestUtils.download(fileToSave, fileUrl)) {
                                                    Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to download " + key + " from " + fileUrl);
                                                }
                                            }
                                        } else {
                                            JSONObject values = new JSONObject();
                                            values.put("hash", hash);
                                            File fileToSave = new File(langFileFolder, lang + "." + extension);
                                            if (fileToSave.exists()) {
                                                fileToSave.delete();
                                            }
                                            if (!HTTPRequestUtils.download(fileToSave, fileUrl)) {
                                                Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to download " + key + " from " + fileUrl);
                                            }
                                            data.put(lang, values);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                JsonUtils.saveToFilePretty(data, hashFile);
            } catch (Exception e) {
                Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to download latest languages files from Mojang");
                e.printStackTrace();
            }
            String langRegex = "(en_us|" + language + ")";
            for (File file : langFileFolder.listFiles()) {
                try {
                    if (file.getName().matches("^" + langRegex + ".json$")) {
                        InputStreamReader reader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8);
                        JSONObject json = (JSONObject) new JSONParser().parse(reader);
                        reader.close();
                        Map<String, String> mapping = new HashMap<>();
                        for (Object obj : json.keySet()) {
                            try {
                                String key = (String) obj;
                                mapping.put(key, (String) json.get(key));
                            } catch (Exception e) {
                            }
                        }
                        translations.put(file.getName().substring(0, file.getName().lastIndexOf(".")), mapping);
                    } else if (file.getName().matches("^" + langRegex + ".lang$")) {
                        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
                        Map<String, String> mapping = new HashMap<>();
                        br.lines().forEach(line -> {
                            if (line.contains("=")) {
                                mapping.put(line.substring(0, line.indexOf("=")), line.substring(line.indexOf("=") + 1));
                            }
                        });
                        br.close();
                        translations.put(file.getName().substring(0, file.getName().lastIndexOf(".")), mapping);
                    }
                } catch (Exception e) {
                    Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to load " + file.getName());
                    e.printStackTrace();
                }
            }
            if (translations.isEmpty()) {
                throw new RuntimeException();
            }
            for (Map<String, Map<String, String>> pluginLanguageMapping : pluginTranslations.values()) {
                for (Entry<String, Map<String, String>> entry : pluginLanguageMapping.entrySet()) {
                    String lang = entry.getKey();
                    Map<String, String> mapping = entry.getValue();
                    Map<String, String> existingMapping = translations.get(lang);
                    if (existingMapping == null) {
                        translations.put(lang, new HashMap<>(mapping));
                    } else {
                        existingMapping.putAll(mapping);
                    }
                }
            }
            Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[InteractiveChat] Loaded all " + translations.size() + " languages!");
        } catch (Exception e) {
            Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[InteractiveChat] Unable to setup languages");
            e.printStackTrace();
        }
        lock.set(false);
    });
}
Also used : Plugin(org.bukkit.plugin.Plugin) ZipArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry) Arrays(java.util.Arrays) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) BannerMeta(org.bukkit.inventory.meta.BannerMeta) JSONArray(org.json.simple.JSONArray) NBTEditor(io.github.bananapuncher714.nbteditor.NBTEditor) Matcher(java.util.regex.Matcher) ByteArrayInputStream(java.io.ByteArrayInputStream) Banner(org.bukkit.block.Banner) Map(java.util.Map) PotionMeta(org.bukkit.inventory.meta.PotionMeta) Method(java.lang.reflect.Method) Material(org.bukkit.Material) BlockStateMeta(org.bukkit.inventory.meta.BlockStateMeta) ChatColor(net.md_5.bungee.api.ChatColor) Bukkit(org.bukkit.Bukkit) PrintWriter(java.io.PrintWriter) JSONParser(org.json.simple.parser.JSONParser) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ZipArchiveInputStream(org.apache.commons.compress.archivers.zip.ZipArchiveInputStream) FileInputStream(java.io.FileInputStream) InputStreamReader(java.io.InputStreamReader) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) ItemStack(org.bukkit.inventory.ItemStack) InvocationTargetException(java.lang.reflect.InvocationTargetException) InteractiveChat(com.loohp.interactivechat.InteractiveChat) TimeUnit(java.util.concurrent.TimeUnit) JSONObject(org.json.simple.JSONObject) Entry(java.util.Map.Entry) BufferedReader(java.io.BufferedReader) Pattern(java.util.regex.Pattern) DyeColor(org.bukkit.DyeColor) XMaterial(com.cryptomorin.xseries.XMaterial) Collections(java.util.Collections) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ZipArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry) PrintWriter(java.io.PrintWriter) InputStreamReader(java.io.InputStreamReader) ZipArchiveInputStream(org.apache.commons.compress.archivers.zip.ZipArchiveInputStream) JSONArray(org.json.simple.JSONArray) ByteArrayOutputStream(java.io.ByteArrayOutputStream) FileInputStream(java.io.FileInputStream) InvocationTargetException(java.lang.reflect.InvocationTargetException) JSONObject(org.json.simple.JSONObject) ByteArrayInputStream(java.io.ByteArrayInputStream) BufferedReader(java.io.BufferedReader) JSONParser(org.json.simple.parser.JSONParser) JSONObject(org.json.simple.JSONObject) File(java.io.File) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

InteractiveChat (com.loohp.interactivechat.InteractiveChat)6 ChatColor (net.md_5.bungee.api.ChatColor)4 ICPlayer (com.loohp.interactivechat.objectholders.ICPlayer)3 ICPlayerFactory (com.loohp.interactivechat.objectholders.ICPlayerFactory)3 Registry (com.loohp.interactivechat.registry.Registry)3 ChatColorUtils (com.loohp.interactivechat.utils.ChatColorUtils)3 InteractiveChatComponentSerializer (com.loohp.interactivechat.utils.InteractiveChatComponentSerializer)3 PlayerUtils (com.loohp.interactivechat.utils.PlayerUtils)3 File (java.io.File)3 IOException (java.io.IOException)3 Arrays (java.util.Arrays)3 Collections (java.util.Collections)3 List (java.util.List)3 Map (java.util.Map)3 Entry (java.util.Map.Entry)3 UUID (java.util.UUID)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 TimeUnit (java.util.concurrent.TimeUnit)3 Component (net.kyori.adventure.text.Component)3 Bukkit (org.bukkit.Bukkit)3