mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-06 00:08:13 +01:00
Now if the localestring is empty or not found then create a default message file
- Now if execute the /jobs reload command then load the furnacebrewinghandling event. - Fix language double loading when plugin startup
This commit is contained in:
parent
b682f1f8c1
commit
ac77148230
@ -600,6 +600,7 @@ public class Jobs extends JavaPlugin {
|
||||
GconfigManager.reload();
|
||||
lManager.reload();
|
||||
configManager.reload();
|
||||
FurnaceBrewingHandling.load();
|
||||
usedSlots.clear();
|
||||
for (Job job : jobs) {
|
||||
usedSlots.put(job, dao.getSlotsTaken(job));
|
||||
@ -785,7 +786,7 @@ public class Jobs extends JavaPlugin {
|
||||
|
||||
YmlMaker restrictedBlocks = new YmlMaker(this, "restrictedBlocks.yml");
|
||||
restrictedBlocks.saveDefaultConfig();
|
||||
|
||||
|
||||
setPermissionHandler(new PermissionHandler(this));
|
||||
setJobsClassloader();
|
||||
setPlayerManager();
|
||||
@ -838,10 +839,7 @@ public class Jobs extends JavaPlugin {
|
||||
dao.loadBlockProtection();
|
||||
exploreManager.load();
|
||||
|
||||
FurnaceBrewingHandling.load();
|
||||
|
||||
consoleMsg("&e[Jobs] Plugin has been enabled successfully.");
|
||||
lManager.reload();
|
||||
|
||||
cManager.fillCommands();
|
||||
|
||||
|
@ -90,27 +90,41 @@ public class LanguageManager {
|
||||
|
||||
String ls = Jobs.getGCManager().localeString;
|
||||
|
||||
if (ls == null || ls.equals(""))
|
||||
return;
|
||||
|
||||
YmlMaker langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + ls + ".yml");
|
||||
langFile.saveDefaultConfig();
|
||||
|
||||
languages.clear();
|
||||
languages.add("en");
|
||||
|
||||
File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + ls + ".yml");
|
||||
if (!customLocaleFile.exists() && !ls.equalsIgnoreCase("en"))
|
||||
languages.add(ls);
|
||||
YmlMaker langFile = null;
|
||||
if (ls == null || ls.equals("")) {
|
||||
langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_en.yml");
|
||||
langFile.saveDefaultConfig();
|
||||
} else {
|
||||
langFile = new YmlMaker(plugin, "locale" + File.separator + "messages_" + ls + ".yml");
|
||||
langFile.saveDefaultConfig();
|
||||
|
||||
File customLocaleFile = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + ls + ".yml");
|
||||
if (!customLocaleFile.exists() && !ls.equalsIgnoreCase("en"))
|
||||
languages.add(ls);
|
||||
}
|
||||
|
||||
for (String lang : languages) {
|
||||
File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
File f = null;
|
||||
if (ls == null || ls.equals("")) {
|
||||
f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_en.yml");
|
||||
|
||||
// Fail safe if file get corrupted and being created with corrupted data, we need to recreate it
|
||||
if ((f.length() / 1024) > 1024) {
|
||||
f.delete();
|
||||
f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
}
|
||||
// Fail safe if file get corrupted and being created with corrupted data, we need to re-create it
|
||||
if ((f.length() / 1024) > 1024) {
|
||||
f.delete();
|
||||
f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_en.yml");
|
||||
}
|
||||
} else {
|
||||
f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
|
||||
// Fail safe if file get corrupted and being created with corrupted data, we need to re-create it
|
||||
if ((f.length() / 1024) > 1024) {
|
||||
f.delete();
|
||||
f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||
}
|
||||
}
|
||||
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(f);
|
||||
CommentedYamlConfiguration writer = new CommentedYamlConfiguration();
|
||||
@ -152,11 +166,11 @@ public class LanguageManager {
|
||||
c.get("command.help.output.info", "Type /jobs [cmd] ? for more information about a command.");
|
||||
c.get("command.help.output.cmdUsage", "&2Usage: &7[command]");
|
||||
c.get("command.help.output.label", "Jobs");
|
||||
|
||||
|
||||
c.get("command.help.output.cmdInfoFormat", "[command] &f- &2[description]");
|
||||
c.get("command.help.output.cmdFormat", "&7/[command]&f[arguments]");
|
||||
c.get("command.help.output.helpPageDescription", "&2* [description]");
|
||||
|
||||
|
||||
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------");
|
||||
c.get("command.help.output.page", "&e-----&e ====== Page &6[1] &eof &6[2] &e====== &e-----");
|
||||
c.get("command.help.output.fliperSimbols", "&e----------");
|
||||
@ -461,7 +475,7 @@ public class LanguageManager {
|
||||
c.get("command.clearownership.help.info", "Clear block ownership");
|
||||
c.get("command.clearownership.help.args", "(playername)");
|
||||
c.get("command.clearownership.output.cleared", "&2Removed &7[furnaces] &2furnaces and &7[brewing] &2brewing stands");
|
||||
|
||||
|
||||
c.get("command.quests.help.info", "List available quests");
|
||||
c.get("command.quests.help.args", "(playername)");
|
||||
c.get("command.quests.error.noquests", "&cThere are no quests");
|
||||
|
@ -31,7 +31,6 @@ public class JobsConnectionPool {
|
||||
}
|
||||
|
||||
if (connection == null) {
|
||||
@SuppressWarnings("resource")
|
||||
Connection conn = DriverManager.getConnection(url, username, password);
|
||||
connection = new JobsConnection(conn);
|
||||
}
|
||||
|
@ -113,7 +113,6 @@ public class JobsMySQL extends JobsDAO {
|
||||
return prest;
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean createTable(String query) {
|
||||
Jobs.consoleMsg(query);
|
||||
@ -137,7 +136,6 @@ public class JobsMySQL extends JobsDAO {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean isTable(String table) {
|
||||
Statement statement;
|
||||
@ -158,7 +156,6 @@ public class JobsMySQL extends JobsDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean isCollumn(String table, String collumn) {
|
||||
Statement statement;
|
||||
@ -180,7 +177,6 @@ public class JobsMySQL extends JobsDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean addCollumn(String table, String collumn, String type) {
|
||||
Statement statement;
|
||||
@ -202,7 +198,6 @@ public class JobsMySQL extends JobsDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean truncate(String table) {
|
||||
Statement statement = null;
|
||||
@ -226,7 +221,6 @@ public class JobsMySQL extends JobsDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean drop(String table) {
|
||||
Statement statement = null;
|
||||
|
@ -113,7 +113,6 @@ public class JobsSQLite extends JobsDAO {
|
||||
return prest;
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean createTable(String query) {
|
||||
Statement statement = null;
|
||||
@ -170,7 +169,6 @@ public class JobsSQLite extends JobsDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean addCollumn(String table, String collumn, String type) {
|
||||
Statement statement;
|
||||
@ -190,7 +188,6 @@ public class JobsSQLite extends JobsDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
public boolean truncate(String table) {
|
||||
Statement statement = null;
|
||||
|
@ -140,9 +140,8 @@ public class BufferedEconomy {
|
||||
this.ServerTaxesAccount = Bukkit.getOfflinePlayer(ServerTaxesAccountname);
|
||||
|
||||
if (Jobs.getGCManager().UseTaxes && Jobs.getGCManager().TransferToServerAccount && ServerTaxesAccount != null) {
|
||||
if(TaxesAmount > 0) {
|
||||
if (TaxesAmount > 0)
|
||||
economy.depositPlayer(ServerTaxesAccount, TaxesAmount);
|
||||
}
|
||||
if (ServerTaxesAccount.isOnline()) {
|
||||
if (!Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getGCManager().ActionBarsMessageByDefault)
|
||||
Jobs.getActionbarToggleList().put(ServerTaxesAccountname, true);
|
||||
|
@ -219,7 +219,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null || !player.isOnline())
|
||||
if (!player.isOnline())
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().CowMilkingTimer > 0)
|
||||
@ -284,7 +284,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null || !player.isOnline())
|
||||
if (!player.isOnline())
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
@ -1500,7 +1500,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (p == null || !p.isOnline())
|
||||
if (!p.isOnline())
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
@ -1534,7 +1534,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null || !player.isOnline())
|
||||
if (!player.isOnline())
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().payExploringWhenFlying() && player.isFlying())
|
||||
|
Loading…
Reference in New Issue
Block a user