mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 12:05:16 +01:00
Fixed exception if the enchantment level is null
- Add max reconnects to prevent server slow loading
This commit is contained in:
parent
92e9e9d15b
commit
7c359c6749
@ -2,6 +2,8 @@
|
||||
- Fixed issue when the quest description only showed one lines of list.
|
||||
- Added cost for skipping quests
|
||||
- Fixed SQLException when inserting a job
|
||||
- Adding and taking exp should calculating correctly
|
||||
- Fixed exception if the enchantment level is null
|
||||
|
||||
# 4.14.0
|
||||
- Fixed %titlename% placeholder does not showed anything
|
||||
|
@ -819,7 +819,7 @@ public class ConfigManager {
|
||||
name = itemSection.getString("name");
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (itemSection.contains("lore") && !itemSection.getStringList("lore").isEmpty())
|
||||
if (itemSection.contains("lore"))
|
||||
for (String eachLine : itemSection.getStringList("lore")) {
|
||||
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
||||
}
|
||||
|
@ -208,8 +208,6 @@ public class ShopManager {
|
||||
gui.addButton(new CMIGuiButton(i, GUIitem) {
|
||||
@Override
|
||||
public void click(GUIClickType type) {
|
||||
|
||||
//if (!player.hasPermission("jobs.items.bypass")) {
|
||||
for (String onePerm : item.getRequiredPerm()) {
|
||||
if (!player.hasPermission(onePerm)) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoPermForItem"));
|
||||
@ -376,13 +374,17 @@ public class ShopManager {
|
||||
if (!one.contains("-"))
|
||||
continue;
|
||||
|
||||
String job = one.split("-")[0];
|
||||
int lvl = -1;
|
||||
String[] split = one.split("-");
|
||||
String job = split[0];
|
||||
int lvl = 1;
|
||||
if (split.length > 2) {
|
||||
try {
|
||||
lvl = Integer.parseInt(one.split("-")[1]);
|
||||
lvl = Integer.parseInt(split[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
RequiredJobs.put(job, lvl);
|
||||
}
|
||||
Sitem.setRequiredJobs(RequiredJobs);
|
||||
@ -435,15 +437,18 @@ public class ShopManager {
|
||||
if (!eachLine.contains("="))
|
||||
continue;
|
||||
|
||||
Enchantment ench = CMIEnchantment.getEnchantment(eachLine.split("=")[0]);
|
||||
Integer level = -1;
|
||||
String[] split = eachLine.split("=");
|
||||
Enchantment ench = CMIEnchantment.getEnchantment(split[0]);
|
||||
Integer level = 1;
|
||||
if (split.length > 2) {
|
||||
try {
|
||||
level = Integer.parseInt(eachLine.split("=")[1]);
|
||||
level = Integer.parseInt(split[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ench != null && level != -1)
|
||||
if (ench != null)
|
||||
enchants.put(ench, level);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,8 @@ public class JobsMySQL extends JobsDAO {
|
||||
private String database;
|
||||
|
||||
JobsMySQL(Jobs plugin, String hostname, String database, String username, String password, String prefix, boolean certificate, boolean ssl, boolean autoReconnect) {
|
||||
super(plugin, "com.mysql.jdbc.Driver", "jdbc:mysql://" + hostname + "/" + database + "?useUnicode=true&characterEncoding=UTF-8&autoReconnect=" + autoReconnect + "&useSSL=" + ssl
|
||||
super(plugin, "com.mysql.jdbc.Driver", "jdbc:mysql://" + hostname + "/" + database
|
||||
+ "?maxReconnects=1&useUnicode=true&characterEncoding=UTF-8&autoReconnect=" + autoReconnect + "&useSSL=" + ssl
|
||||
+ "&verifyServerCertificate=" + certificate, username, password, prefix);
|
||||
this.database = database;
|
||||
this.setDbType(DataBaseType.MySQL);
|
||||
@ -111,9 +112,8 @@ public class JobsMySQL extends JobsDAO {
|
||||
|
||||
@Override
|
||||
public boolean createTable(String query) {
|
||||
Jobs.consoleMsg(query);
|
||||
Statement statement = null;
|
||||
if (query == null || query.equals("")) {
|
||||
if (query == null || query.isEmpty()) {
|
||||
Jobs.consoleMsg("&cCould not create table: query is empty or null.");
|
||||
return false;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class JobsSQLite extends JobsDAO {
|
||||
public boolean createTable(String query) {
|
||||
Statement statement = null;
|
||||
try {
|
||||
if (query == null || query.equals("")) {
|
||||
if (query == null || query.isEmpty()) {
|
||||
Jobs.consoleMsg("&cCould not create table: query is empty or null.");
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user