T2CodeLib/src/main/java/net/t2code/lib/Spigot/system/languages/SelectLibMsg.java

49 lines
1.9 KiB
Java

package net.t2code.lib.Spigot.system.languages;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.lib.Spigot.system.Main;
import net.t2code.lib.Spigot.system.config.SelectLibConfig;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.File;
public class SelectLibMsg {
private static Plugin plugin = Main.plugin;
private static String prefix = Main.prefix;
public static String selectMSG;
public static String VaultNotSetUp;
public static String SoundNotFound;
public static void onSelect(String Prefix) {
send.debug(plugin, "§4Select language...");
Long long_ = Long.valueOf(System.currentTimeMillis());
File msg;
msg = new File(Main.getPath(), "languages/" + SelectLibConfig.language + "_messages.yml");
if (!msg.isFile()) {
send.console(Prefix);
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.console(Prefix + " §4The selected §c" + SelectLibConfig.language + " §4language file was not found.");
send.console(Prefix + " §6The default language §eEnglish §6is used!");
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.console(Prefix);
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
selectMSG = "english";
} else selectMSG = SelectLibConfig.language;
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
VaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
SoundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
}
}