50 lines
2.2 KiB
Java
50 lines
2.2 KiB
Java
package net.t2code.t2codelib.SPIGOT.system.config.languages;
|
|
|
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
|
import net.t2code.t2codelib.Util;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
import java.io.File;
|
|
|
|
public class SelectLibMsg {
|
|
private static Plugin plugin = T2CodeLibMain.getPlugin();
|
|
|
|
public static String selectMSG;
|
|
|
|
public static String vaultNotSetUp;
|
|
public static String votingPluginNotSetUp;
|
|
public static String soundNotFound;
|
|
|
|
public static void onSelect() {
|
|
String prefix = Util.getPrefix();
|
|
|
|
T2Csend.debug(plugin, "§4Select language...");
|
|
long long_ = System.currentTimeMillis();
|
|
|
|
File msg;
|
|
|
|
msg = new File(T2CodeLibMain.getPath(), "languages/" + SelectLibConfig.getLanguage() + ".yml");
|
|
if (!msg.isFile()) {
|
|
T2Csend.console(prefix);
|
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
T2Csend.console(prefix + " §4The selected §c" + SelectLibConfig.getLanguage() + " §4language file was not found.");
|
|
T2Csend.console(prefix + " §6The default language §eEnglish §6is used!");
|
|
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
T2Csend.console(prefix);
|
|
msg = new File(T2CodeLibMain.getPath(), "languages/" + "english.yml");
|
|
selectMSG = "english";
|
|
} else selectMSG = SelectLibConfig.getLanguage();
|
|
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
|
|
|
vaultNotSetUp = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
|
|
votingPluginNotSetUp = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VotingPluginNotSetUp"));
|
|
soundNotFound = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
|
|
|
|
T2Csend.console(prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
}
|
|
}
|