Search in sources :

Example 1 with Config

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

the class DiscordToGameMention method playTitleScreen.

public static void playTitleScreen(String sender, String channelName, String guild, Player reciever) {
    Config config = Config.getConfig(InteractiveChatDiscordSrvAddon.CONFIG_ID);
    String title = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordMention.MentionedTitle").replace("{DiscordUser}", sender).replace("{TextChannel}", "#" + channelName).replace("{Guild}", guild));
    String subtitle = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordMention.DiscordMentionSubtitle").replace("{DiscordUser}", sender).replace("{TextChannel}", "#" + channelName).replace("{Guild}", guild));
    String actionbar = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordMention.DiscordMentionActionbar").replace("{DiscordUser}", sender).replace("{TextChannel}", "#" + channelName).replace("{Guild}", guild));
    String settings = config.getConfiguration().getString("DiscordMention.MentionedSound");
    Sound sound = null;
    float volume = 3.0F;
    float pitch = 1.0F;
    String[] settingsArgs = settings.split(":");
    if (settingsArgs.length == 3) {
        settings = settingsArgs[0];
        try {
            volume = Float.parseFloat(settingsArgs[1]);
        } catch (Exception ignore) {
        }
        try {
            pitch = Float.parseFloat(settingsArgs[2]);
        } catch (Exception ignore) {
        }
    } else if (settingsArgs.length > 0) {
        settings = settingsArgs[0];
    }
    sound = SoundUtils.parseSound(settings);
    if (sound == null) {
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Invalid Sound: " + settings);
    }
    int time = (int) Math.round(config.getConfiguration().getDouble("DiscordMention.MentionedTitleDuration") * 20);
    TitleUtils.sendTitle(reciever, title, subtitle, actionbar, 10, time, 20);
    if (sound != null) {
        reciever.playSound(reciever.getLocation(), sound, volume, pitch);
    }
}
Also used : Config(com.loohp.interactivechat.config.Config) Sound(org.bukkit.Sound)

Example 2 with Config

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

the class InteractiveChatVelocity method loadConfig.

public void loadConfig() {
    Config config = Config.getConfig(CONFIG_ID);
    config.reload();
    parseCommands = config.getConfiguration().getStringList("Settings.CommandsToParse");
    useAccurateSenderFinder = config.getConfiguration().getBoolean("Settings.UseAccurateSenderParser");
    tagEveryIdentifiableMessage = config.getConfiguration().getBoolean("Settings.TagEveryIdentifiableMessage");
    String chatEventPriorityString = config.getConfiguration().getString("Settings.ChatEventPriority").toUpperCase();
    if (chatEventPriorityString.equals("DEFAULT")) {
        chatEventPriorityString = "LATE";
    }
    chatEventPostOrder = PostOrder.valueOf(chatEventPriorityString);
}
Also used : Config(com.loohp.interactivechat.config.Config)

Example 3 with Config

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

the class InteractiveChatBungee method loadConfig.

public static void loadConfig() {
    Config config = Config.getConfig(CONFIG_ID);
    config.reload();
    parseCommands = config.getConfiguration().getStringList("Settings.CommandsToParse");
    useAccurateSenderFinder = config.getConfiguration().getBoolean("Settings.UseAccurateSenderParser");
    tagEveryIdentifiableMessage = config.getConfiguration().getBoolean("Settings.TagEveryIdentifiableMessage");
    String chatEventPriorityString = config.getConfiguration().getString("Settings.ChatEventPriority").toUpperCase();
    if (chatEventPriorityString.equals("DEFAULT")) {
        chatEventPriorityString = "HIGH";
    }
    for (Field field : EventPriority.class.getFields()) {
        if (field.getName().equals(chatEventPriorityString)) {
            try {
                chatEventPriority = field.getByte(null);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : Field(java.lang.reflect.Field) Config(com.loohp.interactivechat.config.Config)

Example 4 with Config

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

the class InteractiveChatDiscordSrvAddon method reloadConfig.

@Override
public void reloadConfig() {
    Config config = Config.getConfig(CONFIG_ID);
    config.reload();
    reloadConfigMessage = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.ReloadConfig"));
    reloadTextureMessage = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.ReloadTexture"));
    linkExpired = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.LinkExpired"));
    previewLoading = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.PreviewLoading"));
    accountNotLinked = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.AccountNotLinked"));
    unableToRetrieveData = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.UnableToRetrieveData"));
    invalidDiscordChannel = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.InvalidDiscordChannel"));
    trueLabel = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.TrueLabel"));
    falseLabel = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.FalseLabel"));
    defaultResourceHashLang = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.StatusCommand.DefaultResourceHash"));
    fontsActiveLang = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.StatusCommand.FontsActive"));
    loadedResourcesLang = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("Messages.StatusCommand.LoadedResources"));
    debug = config.getConfiguration().getBoolean("Debug.PrintInfoToConsole");
    resourceOrder.clear();
    List<String> order = config.getConfiguration().getStringList("Resources.Order");
    ListIterator<String> itr = order.listIterator(order.size());
    while (itr.hasPrevious()) {
        String pack = itr.previous();
        resourceOrder.add(pack);
    }
    itemImage = config.getConfiguration().getBoolean("InventoryImage.Item.Enabled");
    invImage = config.getConfiguration().getBoolean("InventoryImage.Inventory.Enabled");
    enderImage = config.getConfiguration().getBoolean("InventoryImage.EnderChest.Enabled");
    usePlayerInvView = config.getConfiguration().getBoolean("InventoryImage.Inventory.UsePlayerInventoryView");
    renderHandHeldItems = config.getConfiguration().getBoolean("InventoryImage.Inventory.RenderHandHeldItems");
    itemUseTooltipImage = config.getConfiguration().getBoolean("InventoryImage.Item.UseTooltipImage");
    itemUseTooltipImageOnBaseItem = config.getConfiguration().getBoolean("InventoryImage.Item.UseTooltipImageOnBaseItem");
    itemAltAir = config.getConfiguration().getBoolean("InventoryImage.Item.AlternateAirTexture");
    invShowLevel = config.getConfiguration().getBoolean("InventoryImage.Inventory.ShowExperienceLevel");
    hoverEnabled = config.getConfiguration().getBoolean("HoverEventDisplay.Enabled");
    hoverImage = config.getConfiguration().getBoolean("HoverEventDisplay.ShowCursorImage");
    hoverIgnore.clear();
    hoverIgnore = new HashSet<>(config.getConfiguration().getIntegerList("HoverEventDisplay.IgnoredPlaceholderIndexes"));
    hoverUseTooltipImage = config.getConfiguration().getBoolean("HoverEventDisplay.UseTooltipImage");
    convertDiscordAttachments = config.getConfiguration().getBoolean("DiscordAttachments.Convert");
    discordAttachmentsFormattingText = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordAttachments.Formatting.Text"));
    discordAttachmentsFormattingHoverEnabled = config.getConfiguration().getBoolean("DiscordAttachments.Formatting.Hover.Enabled");
    discordAttachmentsFormattingHoverText = ChatColorUtils.translateAlternateColorCodes('&', String.join("\n", config.getConfiguration().getStringList("DiscordAttachments.Formatting.Hover.HoverText")));
    discordAttachmentsImagesUseMaps = config.getConfiguration().getBoolean("DiscordAttachments.ShowImageUsingMaps");
    discordAttachmentsPreviewLimit = config.getConfiguration().getLong("DiscordAttachments.FileSizeLimit");
    discordAttachmentTimeout = config.getConfiguration().getInt("DiscordAttachments.Timeout") * 20;
    discordAttachmentsFormattingImageAppend = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordAttachments.Formatting.ImageOriginal"));
    discordAttachmentsFormattingImageAppendHover = ChatColorUtils.translateAlternateColorCodes('&', String.join("\n", config.getConfiguration().getStringList("DiscordAttachments.Formatting.Hover.ImageOriginalHover")));
    boolean transparent = config.getConfiguration().getBoolean("DiscordAttachments.ImageMapBackground.Transparent");
    if (transparent) {
        discordAttachmentsMapBackgroundColor = null;
    } else {
        discordAttachmentsMapBackgroundColor = ColorUtils.hex2Rgb(config.getConfiguration().getString("DiscordAttachments.ImageMapBackground.Color"));
    }
    imageWhitelistEnabled = config.getConfiguration().getBoolean("DiscordAttachments.RestrictImageUrl.Enabled");
    whitelistedImageUrls = config.getConfiguration().getStringList("DiscordAttachments.RestrictImageUrl.Whitelist");
    updaterEnabled = config.getConfiguration().getBoolean("Options.UpdaterEnabled");
    cacheTimeout = config.getConfiguration().getInt("Settings.CacheTimeout") * 20;
    escapePlaceholdersFromDiscord = config.getConfiguration().getBoolean("Settings.EscapePlaceholdersSentFromDiscord");
    escapeDiscordMarkdownInItems = config.getConfiguration().getBoolean("Settings.EscapeDiscordMarkdownFormattingInItems");
    reducedAssetsDownloadInfo = config.getConfiguration().getBoolean("Settings.ReducedAssetsDownloadInfo");
    itemDisplaySingle = config.getConfiguration().getString("InventoryImage.Item.EmbedDisplay.Single");
    itemDisplayMultiple = config.getConfiguration().getString("InventoryImage.Item.EmbedDisplay.Multiple");
    invColor = ColorUtils.hex2Rgb(config.getConfiguration().getString("InventoryImage.Inventory.EmbedColor"));
    enderColor = ColorUtils.hex2Rgb(config.getConfiguration().getString("InventoryImage.EnderChest.EmbedColor"));
    deathMessageItem = config.getConfiguration().getBoolean("DeathMessage.ShowItems");
    advancementName = config.getConfiguration().getBoolean("Advancements.CorrectAdvancementName");
    advancementItem = config.getConfiguration().getBoolean("Advancements.ChangeToItemIcon");
    advancementDescription = config.getConfiguration().getBoolean("Advancements.ShowDescription");
    translateMentions = config.getConfiguration().getBoolean("DiscordMention.TranslateMentions");
    mentionHighlight = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordMention.MentionHighlight"));
    playbackBarEnabled = config.getConfiguration().getBoolean("DiscordAttachments.PlaybackBar.Enabled");
    playbackBarFilledColor = ColorUtils.hex2Rgb(config.getConfiguration().getString("DiscordAttachments.PlaybackBar.FilledColor"));
    playbackBarEmptyColor = ColorUtils.hex2Rgb(config.getConfiguration().getString("DiscordAttachments.PlaybackBar.EmptyColor"));
    respondToCommandsInInvalidChannels = config.getConfiguration().getBoolean("DiscordCommands.GlobalSettings.RespondToCommandsInInvalidChannels");
    discordMemberLabel = config.getConfiguration().getString("DiscordCommands.GlobalSettings.Messages.MemberLabel").toLowerCase();
    discordMemberDescription = config.getConfiguration().getString("DiscordCommands.GlobalSettings.Messages.MemberDescription");
    discordSlotLabel = config.getConfiguration().getString("DiscordCommands.GlobalSettings.Messages.SlotLabel").toLowerCase();
    discordSlotDescription = config.getConfiguration().getString("DiscordCommands.GlobalSettings.Messages.SlotDescription");
    resourcepackCommandEnabled = config.getConfiguration().getBoolean("DiscordCommands.ResourcePack.Enabled");
    resourcepackCommandDescription = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ResourcePack.Description"));
    resourcepackCommandIsMainServer = config.getConfiguration().getBoolean("DiscordCommands.ResourcePack.IsMainServer");
    resourcepackCommandRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.ResourcePack.Permissions.AllowedRoles"));
    playerlistCommandEnabled = config.getConfiguration().getBoolean("DiscordCommands.PlayerList.Enabled");
    playerlistCommandDescription = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.PlayerList.Description"));
    playerlistCommandIsMainServer = config.getConfiguration().getBoolean("DiscordCommands.PlayerList.IsMainServer");
    playerlistCommandBungeecord = config.getConfiguration().getBoolean("DiscordCommands.PlayerList.ListBungeecordPlayers");
    playerlistCommandDeleteAfter = config.getConfiguration().getInt("DiscordCommands.PlayerList.DeleteAfter");
    playerlistCommandPlayerFormat = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.PlayerList.TablistOptions.PlayerFormat"));
    playerlistCommandAvatar = config.getConfiguration().getBoolean("DiscordCommands.PlayerList.TablistOptions.ShowPlayerAvatar");
    playerlistCommandPing = config.getConfiguration().getBoolean("DiscordCommands.PlayerList.TablistOptions.ShowPlayerPing");
    playerlistCommandHeader = ChatColorUtils.translateAlternateColorCodes('&', String.join("\n", config.getConfiguration().getStringList("DiscordCommands.PlayerList.TablistOptions.HeaderText")));
    playerlistCommandFooter = ChatColorUtils.translateAlternateColorCodes('&', String.join("\n", config.getConfiguration().getStringList("DiscordCommands.PlayerList.TablistOptions.FooterText")));
    playerlistCommandEmptyServer = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.PlayerList.EmptyServer"));
    playerlistCommandColor = ColorUtils.hex2Rgb(config.getConfiguration().getString("DiscordCommands.PlayerList.TablistOptions.SidebarColor"));
    playerlistCommandMinWidth = config.getConfiguration().getInt("DiscordCommands.PlayerList.TablistOptions.PlayerMinWidth");
    playerlistCommandRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.PlayerList.Permissions.AllowedRoles"));
    shareItemCommandEnabled = config.getConfiguration().getBoolean("DiscordCommands.ShareItem.Enabled");
    shareItemCommandAsOthers = config.getConfiguration().getBoolean("DiscordCommands.ShareItem.AllowAsOthers");
    shareItemCommandIsMainServer = config.getConfiguration().getBoolean("DiscordCommands.ShareItem.IsMainServer");
    shareItemCommandInGameMessageText = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ShareItem.InGameMessage.Text"));
    shareItemCommandTitle = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ShareItem.InventoryTitle"));
    shareItemCommandSelfRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.ShareItem.Permissions.SelfAllowedRoles"));
    shareItemCommandOthersRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.ShareItem.Permissions.OtherAllowedRoles"));
    shareInvCommandEnabled = config.getConfiguration().getBoolean("DiscordCommands.ShareInventory.Enabled");
    shareInvCommandAsOthers = config.getConfiguration().getBoolean("DiscordCommands.ShareInventory.AllowAsOthers");
    shareInvCommandIsMainServer = config.getConfiguration().getBoolean("DiscordCommands.ShareInventory.IsMainServer");
    shareInvCommandInGameMessageText = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ShareInventory.InGameMessage.Text"));
    shareInvCommandInGameMessageHover = ChatColorUtils.translateAlternateColorCodes('&', String.join("\n", config.getConfiguration().getStringList("DiscordCommands.ShareInventory.InGameMessage.Hover")));
    shareInvCommandTitle = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ShareInventory.InventoryTitle"));
    shareInvCommandSkullName = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ShareInventory.SkullDisplayName"));
    shareInvCommandSelfRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.ShareInventory.Permissions.SelfAllowedRoles"));
    shareInvCommandOthersRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.ShareInventory.Permissions.OtherAllowedRoles"));
    shareEnderCommandEnabled = config.getConfiguration().getBoolean("DiscordCommands.ShareEnderChest.Enabled");
    shareEnderCommandAsOthers = config.getConfiguration().getBoolean("DiscordCommands.ShareEnderChest.AllowAsOthers");
    shareEnderCommandIsMainServer = config.getConfiguration().getBoolean("DiscordCommands.ShareEnderChest.IsMainServer");
    shareEnderCommandInGameMessageText = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ShareEnderChest.InGameMessage.Text"));
    shareEnderCommandInGameMessageHover = ChatColorUtils.translateAlternateColorCodes('&', String.join("\n", config.getConfiguration().getStringList("DiscordCommands.ShareEnderChest.InGameMessage.Hover")));
    shareEnderCommandTitle = ChatColorUtils.translateAlternateColorCodes('&', config.getConfiguration().getString("DiscordCommands.ShareEnderChest.InventoryTitle"));
    shareEnderCommandSelfRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.ShareEnderChest.Permissions.SelfAllowedRoles"));
    shareEnderCommandOthersRoles = new HashSet<>(config.getConfiguration().getStringList("DiscordCommands.ShareEnderChest.Permissions.OtherAllowedRoles"));
    language = config.getConfiguration().getString("Resources.Language");
    LanguageUtils.loadTranslations(language);
    FontTextureResource.setCacheTime(cacheTimeout);
    discordsrv.reloadRegexes();
}
Also used : Config(com.loohp.interactivechat.config.Config)

Aggregations

Config (com.loohp.interactivechat.config.Config)4 Field (java.lang.reflect.Field)1 Sound (org.bukkit.Sound)1