1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +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,17 +438,21 @@ public class Jobs {
int i = 0;
long time = System.currentTimeMillis();
for (OfflinePlayer offline : Bukkit.getServer().getOfflinePlayers()) {
if (offline.isOnline())
continue;
long lastPlayed = offline.getLastPlayed();
int dif = (int) ((time - lastPlayed) / 1000 / 60 / 60 / 24);
if (dif >= 7)
continue;
try {
if (offline.isOnline())
continue;
JobsPlayer jPlayer = JobsPlayer.loadFromDao(Jobs.getJobsDAO(), offline);
JobsPlayer.loadLogFromDao(jPlayer);
Jobs.getPlayerManager().getPlayersCache().put(offline.getName().toLowerCase(), jPlayer);
long lastPlayed = offline.getLastPlayed();
int dif = (int) ((time - lastPlayed) / 1000 / 60 / 60 / 24);
if (dif >= 7)
continue;
JobsPlayer jPlayer = JobsPlayer.loadFromDao(Jobs.getJobsDAO(), offline);
JobsPlayer.loadLogFromDao(jPlayer);
Jobs.getPlayerManager().getPlayersCache().put(offline.getName().toLowerCase(), jPlayer);
} catch (Exception e) {
}
i++;
}
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.JobsPlugin;
import com.gamingmesh.jobs.container.LocaleReader;
import com.gamingmesh.jobs.stuff.Debug;
public class LanguageManager {
private JobsPlugin plugin;
@ -25,6 +26,8 @@ public class LanguageManager {
*/
synchronized void load() {
long time = System.currentTimeMillis();
// Just copying default language files, except en, that one will be generated
List<String> languages = new ArrayList<String>();
languages.add("cs");
@ -36,20 +39,26 @@ public class LanguageManager {
languages.add("ru");
languages.add("tr");
Debug.D(System.currentTimeMillis() - time);
for (String lang : languages) {
YmlMaker langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + lang + ".yml");
if (langFile != null)
langFile.saveDefaultConfig();
}
Debug.D(System.currentTimeMillis() - time);
languages.add("en");
File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + Jobs.getGCManager().localeString + ".yml");
if (!customLocaleFile.exists() && !Jobs.getGCManager().localeString.equalsIgnoreCase("en"))
languages.add(Jobs.getGCManager().localeString);
Debug.D(System.currentTimeMillis() - time);
for (String lang : languages) {
Debug.D(lang + " -> " + (System.currentTimeMillis() - time));
File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(f);
CommentedYamlConfiguration writer = new CommentedYamlConfiguration();
@ -58,7 +67,6 @@ public class LanguageManager {
c.getC().options().copyDefaults(true);
Jobs.getGCManager().commandArgs.clear();
c.get("economy.error.nomoney", "&cSorry, no money left in national bank!");
@ -447,5 +455,7 @@ public class LanguageManager {
e.printStackTrace();
}
}
Debug.D(System.currentTimeMillis() - time);
}
}

View File

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