1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Fixing issue with database table existence detection (Thanks to CrySis)

This commit is contained in:
Zrips 2022-04-22 12:16:58 +03:00
parent a984589dce
commit 1b85ade74a
3 changed files with 8 additions and 3 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId>
<artifactId>jobs</artifactId>
<version>5.0.2.1</version>
<version>5.0.2.2</version>
<name>Jobs</name>
<url>http://maven.apache.org</url>

View File

@ -1,5 +1,7 @@
package com.gamingmesh.jobs.commands.list;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -44,7 +46,7 @@ public class stats implements Cmd {
String pref = JobsCommands.LABEL + " " + info.class.getSimpleName() + " ";
for (JobProgression jobProg : jPlayer.progression) {
for (JobProgression jobProg : jPlayer.getJobProgression()) {
for (String msg : Jobs.getCommandManager().jobStatsMessage(jobProg).split("\n")) {
new RawMessage().addText(msg).addHover(leftClick).addCommand(pref + jobProg.getJob().getName()).show(sender);
}

View File

@ -21,6 +21,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,
String characterEncoding, String encoding) {
super(plugin, path, "jdbc:mysql://" + hostname + "/" + database
@ -38,6 +40,7 @@ public class JobsMySQL extends JobsDAO {
String characterEncoding, String encoding) {
JobsMySQL dao = new JobsMySQL(plugin, hostname, database, username, password, prefix, certificate, ssl, autoReconnect,
characterEncoding, encoding);
this.database = database;
dao.setUp();
return dao;
}
@ -97,7 +100,7 @@ public class JobsMySQL extends JobsDAO {
return false;
try {
ResultSet tables = conn.getMetaData().getTables(null, null, table, null);
ResultSet tables = conn.getMetaData().getTables(database, null, table, new String[] {"TABLE"});
if (tables.next()) {
tables.close();
return true;