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