1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00
This commit is contained in:
Zrips 2016-08-04 16:16:35 +03:00
parent c7c1b6113a
commit 6344fc0d6b
3 changed files with 29 additions and 15 deletions

View File

@ -438,6 +438,8 @@ public class Jobs {
int i = 0; int i = 0;
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
for (OfflinePlayer offline : Bukkit.getServer().getOfflinePlayers()) { for (OfflinePlayer offline : Bukkit.getServer().getOfflinePlayers()) {
try {
if (offline.isOnline()) if (offline.isOnline())
continue; continue;
@ -449,6 +451,8 @@ public class Jobs {
JobsPlayer jPlayer = JobsPlayer.loadFromDao(Jobs.getJobsDAO(), offline); JobsPlayer jPlayer = JobsPlayer.loadFromDao(Jobs.getJobsDAO(), offline);
JobsPlayer.loadLogFromDao(jPlayer); JobsPlayer.loadLogFromDao(jPlayer);
Jobs.getPlayerManager().getPlayersCache().put(offline.getName().toLowerCase(), jPlayer); Jobs.getPlayerManager().getPlayersCache().put(offline.getName().toLowerCase(), jPlayer);
} catch (Exception e) {
}
i++; i++;
} }
Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Preloaded " + i + " players data from last week"); Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Preloaded " + i + " players data from last week");

View File

@ -10,6 +10,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.JobsPlugin; import com.gamingmesh.jobs.JobsPlugin;
import com.gamingmesh.jobs.container.LocaleReader; import com.gamingmesh.jobs.container.LocaleReader;
import com.gamingmesh.jobs.stuff.Debug;
public class LanguageManager { public class LanguageManager {
private JobsPlugin plugin; private JobsPlugin plugin;
@ -25,6 +26,8 @@ public class LanguageManager {
*/ */
synchronized void load() { synchronized void load() {
long time = System.currentTimeMillis();
// Just copying default language files, except en, that one will be generated // Just copying default language files, except en, that one will be generated
List<String> languages = new ArrayList<String>(); List<String> languages = new ArrayList<String>();
languages.add("cs"); languages.add("cs");
@ -36,20 +39,26 @@ public class LanguageManager {
languages.add("ru"); languages.add("ru");
languages.add("tr"); languages.add("tr");
Debug.D(System.currentTimeMillis() - time);
for (String lang : languages) { for (String lang : languages) {
YmlMaker langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + lang + ".yml"); YmlMaker langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + lang + ".yml");
if (langFile != null) if (langFile != null)
langFile.saveDefaultConfig(); langFile.saveDefaultConfig();
} }
Debug.D(System.currentTimeMillis() - time);
languages.add("en"); languages.add("en");
File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + Jobs.getGCManager().localeString + ".yml"); File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + Jobs.getGCManager().localeString + ".yml");
if (!customLocaleFile.exists() && !Jobs.getGCManager().localeString.equalsIgnoreCase("en")) if (!customLocaleFile.exists() && !Jobs.getGCManager().localeString.equalsIgnoreCase("en"))
languages.add(Jobs.getGCManager().localeString); languages.add(Jobs.getGCManager().localeString);
Debug.D(System.currentTimeMillis() - time);
for (String lang : languages) { for (String lang : languages) {
Debug.D(lang + " -> " + (System.currentTimeMillis() - time));
File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(f); YamlConfiguration config = YamlConfiguration.loadConfiguration(f);
CommentedYamlConfiguration writer = new CommentedYamlConfiguration(); CommentedYamlConfiguration writer = new CommentedYamlConfiguration();
@ -58,7 +67,6 @@ public class LanguageManager {
c.getC().options().copyDefaults(true); c.getC().options().copyDefaults(true);
Jobs.getGCManager().commandArgs.clear(); Jobs.getGCManager().commandArgs.clear();
c.get("economy.error.nomoney", "&cSorry, no money left in national bank!"); c.get("economy.error.nomoney", "&cSorry, no money left in national bank!");
@ -447,5 +455,7 @@ public class LanguageManager {
e.printStackTrace(); e.printStackTrace();
} }
} }
Debug.D(System.currentTimeMillis() - time);
} }
} }

View File

@ -1,7 +1,7 @@
name: Jobs name: Jobs
description: Jobs Plugin for the BukkitAPI description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.JobsPlugin main: com.gamingmesh.jobs.JobsPlugin
version: 3.5.5 version: 3.5.6
author: phrstbrn author: phrstbrn
depend: [Vault] depend: [Vault]
softdepend: [CoreProtect, MythicMobs, McMMO] softdepend: [CoreProtect, MythicMobs, McMMO]