Skip to content

Commit c60dec0

Browse files
author
Im-Fran
committed
+ Added Plugin Version to SuperCoreAPICommand
* Code Improvement
1 parent e64be02 commit c60dec0

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>xyz.theprogramsrc</groupId>
88
<artifactId>SuperCoreAPI</artifactId>
9-
<version>4.3.0</version>
9+
<version>4.4.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>

src/main/java/xyz/theprogramsrc/supercoreapi/global/storage/SQLiteDataBase.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import xyz.theprogramsrc.supercoreapi.SuperPlugin;
44

55
import java.io.File;
6+
import java.io.IOException;
67
import java.sql.Connection;
78
import java.sql.DriverManager;
9+
import java.sql.SQLException;
810

911
public abstract class SQLiteDataBase implements DataBase {
1012

@@ -13,7 +15,6 @@ public abstract class SQLiteDataBase implements DataBase {
1315

1416
public SQLiteDataBase(SuperPlugin<?> plugin){
1517
this.plugin = plugin;
16-
1718
this.createConnection();
1819
}
1920

@@ -23,7 +24,7 @@ private void createConnection() {
2324
if(!file.exists()) file.createNewFile();
2425
Class.forName("org.sqlite.JDBC");
2526
this.connection = DriverManager.getConnection("jdbc:sqlite:" + file.getPath());
26-
}catch (Exception ex){
27+
}catch (SQLException | ClassNotFoundException | IOException ex){
2728
this.plugin.log("&cCannot create SQLite Connection:");
2829
ex.printStackTrace();
2930
}
@@ -47,7 +48,7 @@ public void closeConnection() {
4748
if(this.connection != null){
4849
this.connection.close();
4950
}
50-
}catch (Exception ex){
51+
}catch (SQLException ex){
5152
this.plugin.log("&cCannot close SQLite Connection:");
5253
ex.printStackTrace();
5354
}
@@ -59,21 +60,19 @@ public void closeConnection() {
5960
*/
6061
@Override
6162
public void connect(ConnectionCall call) {
62-
if(this.connection == null){
63-
try{
63+
try{
64+
if(this.connection == null){
65+
this.createConnection();
66+
}else if(this.connection.isClosed()){
6467
this.createConnection();
65-
}catch (Exception ex){
66-
this.plugin.log("&cCannot connect with SQLite DataBase:");
67-
ex.printStackTrace();
6868
}
69+
}catch (SQLException e){
70+
this.plugin.addError(e);
71+
this.plugin.log("&cError while connecting to SQLite:");
72+
e.printStackTrace();
6973
}
7074

71-
try{
72-
call.onConnect(this.connection);
73-
}catch (Exception ex){
74-
this.plugin.log("&cCannot execute ConnectionCall:");
75-
ex.printStackTrace();
76-
}
75+
call.onConnect(this.connection);
7776
}
7877

7978
/**

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/commands/precreated/SuperCoreAPICommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ private void sendInfo(CommandSender player){
110110
lastErrors = this.plugin.getLastErrors().size()+"";
111111
this.getSuperUtils().sendMessage(player, "&bServer information:");
112112
this.getSuperUtils().sendMessage(player, "&7SuperCoreAPI Version: &9" + coreVersion);
113+
this.getSuperUtils().sendMessage(player, String.format("&7%s Version: &9%s", this.plugin.getPluginName(), this.plugin.getPluginVersion()));
113114
this.getSuperUtils().sendMessage(player, "&7Server Version: &9" + serverVersion);
114115
this.getSuperUtils().sendMessage(player, "&7NMS Version: &9" + nmsVersion);
115116
this.getSuperUtils().sendMessage(player, "&7OS: &9" + os);

0 commit comments

Comments
 (0)