diff --git a/Assembly/dependency-reduced-pom.xml b/Assembly/dependency-reduced-pom.xml
index 297eccc..6dea4ed 100644
--- a/Assembly/dependency-reduced-pom.xml
+++ b/Assembly/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
Assembly
diff --git a/Assembly/pom.xml b/Assembly/pom.xml
index f5a04b3..3f8fab0 100644
--- a/Assembly/pom.xml
+++ b/Assembly/pom.xml
@@ -5,7 +5,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
diff --git a/Bukkit/dependency-reduced-pom.xml b/Bukkit/dependency-reduced-pom.xml
index 5129858..511d748 100644
--- a/Bukkit/dependency-reduced-pom.xml
+++ b/Bukkit/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
Bukkit
@@ -56,8 +56,14 @@
dev.brighten.antivpn
Common
- 1.5.1
+ 1.5.2
provided
+
+
+ toml4j
+ com.moandjiezana.toml
+
+
cc.funkemunky.utils
diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml
index 4e0a69f..b5f7d8e 100644
--- a/Bukkit/pom.xml
+++ b/Bukkit/pom.xml
@@ -5,7 +5,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
@@ -69,7 +69,7 @@
dev.brighten.antivpn
Common
- 1.5.1
+ 1.5.2
provided
diff --git a/Bungee/dependency-reduced-pom.xml b/Bungee/dependency-reduced-pom.xml
index 69ff38d..1366d39 100644
--- a/Bungee/dependency-reduced-pom.xml
+++ b/Bungee/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
Bungee
@@ -50,8 +50,14 @@
dev.brighten.antivpn
Common
- 1.5.1
+ 1.5.2
provided
+
+
+ toml4j
+ com.moandjiezana.toml
+
+
org.github.bungee
diff --git a/Bungee/pom.xml b/Bungee/pom.xml
index 92cb82b..5cd93b4 100644
--- a/Bungee/pom.xml
+++ b/Bungee/pom.xml
@@ -5,7 +5,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
@@ -63,7 +63,7 @@
dev.brighten.antivpn
Common
- 1.5.1
+ 1.5.2
provided
diff --git a/Common/pom.xml b/Common/pom.xml
index a2d9ac1..d890a48 100644
--- a/Common/pom.xml
+++ b/Common/pom.xml
@@ -5,7 +5,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
@@ -21,7 +21,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.7.0
+ 3.8.1
8
8
@@ -46,10 +46,10 @@
- mysql
- mysql-connector-java
- 8.0.22
- provided
+ com.moandjiezana.toml
+ toml4j
+ 0.7.2
+ compile
diff --git a/Common/src/main/java/dev/brighten/antivpn/database/sql/utils/MySQL.java b/Common/src/main/java/dev/brighten/antivpn/database/sql/utils/MySQL.java
index 83fcb53..99aca2b 100644
--- a/Common/src/main/java/dev/brighten/antivpn/database/sql/utils/MySQL.java
+++ b/Common/src/main/java/dev/brighten/antivpn/database/sql/utils/MySQL.java
@@ -1,9 +1,7 @@
package dev.brighten.antivpn.database.sql.utils;
import dev.brighten.antivpn.AntiVPN;
-import dev.brighten.antivpn.utils.MiscUtils;
-import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -14,20 +12,6 @@ public class MySQL {
public static void init() {
try {
if (conn == null || conn.isClosed()) {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch(ClassNotFoundException e) {
- AntiVPN.getInstance().getExecutor().log("No MySQL driver found! Starting download process...");
- File mysqlLib = new File(AntiVPN.getInstance().getPluginFolder(), "mysqllib.jar");
-
- if(!mysqlLib.exists()) {
- AntiVPN.getInstance().getExecutor().log("Downloading mysqllib.jar...");
- MiscUtils.download(mysqlLib, "https://nexus.funkemunky.cc/content/repositories/releases" +
- "/mysql/mysql-connector-java/8.0.22/mysql-connector-java-8.0.22.jar");
- }
- MiscUtils.injectURL(mysqlLib.toURI().toURL());
- }
- Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://" + AntiVPN.getInstance().getConfig().getIp()
+ ":" + AntiVPN.getInstance().getConfig().getPort()
+ "/?useSSL=true&autoReconnect=true",
@@ -46,6 +30,23 @@ public class MySQL {
}
}
+ /*public static void initH2() {
+ File dataFolder = new File(AntiVPN.getInstance().getPluginFolder(), "databases" + File.separator + "database");
+ try {
+ Class.forName("org.h2.Driver");
+ conn = new NonClosableConnection(new JdbcConnection("jdbc:h2:file:" +
+ dataFolder.getAbsolutePath(), new Properties()));
+ conn.setAutoCommit(true);
+ Query.use(conn);
+ AntiVPN.getInstance().getExecutor().log("Connection to SQlLite has been established.");
+ } catch (SQLException ex) {
+ AntiVPN.getInstance().getExecutor().log("SQLite exception on initialize");
+ ex.printStackTrace();
+ } catch (ClassNotFoundException ex) {
+ AntiVPN.getInstance().getExecutor().log("No H2 library found!");
+ }
+ }*/
+
public static void use() {
try {
init();
@@ -57,7 +58,9 @@ public class MySQL {
public static void shutdown() {
try {
if(conn != null && !conn.isClosed()) {
- conn.close();
+ if(conn instanceof NonClosableConnection) {
+ ((NonClosableConnection)conn).shutdown();
+ } else conn.close();
conn = null;
}
} catch (Exception e) {
diff --git a/Common/src/main/java/dev/brighten/antivpn/database/sql/utils/NonClosableConnection.java b/Common/src/main/java/dev/brighten/antivpn/database/sql/utils/NonClosableConnection.java
new file mode 100644
index 0000000..38668af
--- /dev/null
+++ b/Common/src/main/java/dev/brighten/antivpn/database/sql/utils/NonClosableConnection.java
@@ -0,0 +1,122 @@
+/*
+ * This file is part of LuckPerms, licensed under the MIT License.
+ *
+ * Copyright (c) lucko (Luck)
+ * Copyright (c) contributors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package dev.brighten.antivpn.database.sql.utils;
+
+import java.sql.*;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+/**
+ * A wrapper around a {@link Connection} which blocks usage of the default {@link #close()} method.
+ */
+public class NonClosableConnection implements Connection {
+ private final Connection delegate;
+
+ public NonClosableConnection(Connection delegate) {
+ this.delegate = delegate;
+ }
+
+ /**
+ * Actually {@link #close() closes} the underlying connection.
+ */
+ public final void shutdown() throws SQLException {
+ this.delegate.close();
+ }
+
+ @Override
+ public final void close() throws SQLException {
+ // do nothing
+ }
+
+ @Override
+ public final boolean isWrapperFor(Class> iface) throws SQLException {
+ return iface.isInstance(this.delegate) || this.delegate.isWrapperFor(iface);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public final T unwrap(Class iface) throws SQLException {
+ if (iface.isInstance(this.delegate)) {
+ return (T) this.delegate;
+ }
+ return this.delegate.unwrap(iface);
+ }
+
+ // Forward to the delegate connection
+ @Override public Statement createStatement() throws SQLException { return this.delegate.createStatement(); }
+ @Override public PreparedStatement prepareStatement(String sql) throws SQLException { return this.delegate.prepareStatement(sql); }
+ @Override public CallableStatement prepareCall(String sql) throws SQLException { return this.delegate.prepareCall(sql); }
+ @Override public String nativeSQL(String sql) throws SQLException { return this.delegate.nativeSQL(sql); }
+ @Override public void setAutoCommit(boolean autoCommit) throws SQLException { this.delegate.setAutoCommit(autoCommit); }
+ @Override public boolean getAutoCommit() throws SQLException { return this.delegate.getAutoCommit(); }
+ @Override public void commit() throws SQLException { this.delegate.commit(); }
+ @Override public void rollback() throws SQLException { this.delegate.rollback(); }
+ @Override public boolean isClosed() throws SQLException { return this.delegate.isClosed(); }
+ @Override public DatabaseMetaData getMetaData() throws SQLException { return this.delegate.getMetaData(); }
+ @Override public void setReadOnly(boolean readOnly) throws SQLException { this.delegate.setReadOnly(readOnly); }
+ @Override public boolean isReadOnly() throws SQLException { return this.delegate.isReadOnly(); }
+ @Override public void setCatalog(String catalog) throws SQLException { this.delegate.setCatalog(catalog); }
+ @Override public String getCatalog() throws SQLException { return this.delegate.getCatalog(); }
+ @Override public void setTransactionIsolation(int level) throws SQLException { this.delegate.setTransactionIsolation(level); }
+ @Override public int getTransactionIsolation() throws SQLException { return this.delegate.getTransactionIsolation(); }
+ @Override public SQLWarning getWarnings() throws SQLException { return this.delegate.getWarnings(); }
+ @Override public void clearWarnings() throws SQLException { this.delegate.clearWarnings(); }
+ @Override public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { return this.delegate.createStatement(resultSetType, resultSetConcurrency); }
+ @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return this.delegate.prepareStatement(sql, resultSetType, resultSetConcurrency); }
+ @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return this.delegate.prepareCall(sql, resultSetType, resultSetConcurrency); }
+ @Override public Map> getTypeMap() throws SQLException { return this.delegate.getTypeMap(); }
+ @Override public void setTypeMap(Map> map) throws SQLException { this.delegate.setTypeMap(map); }
+ @Override public void setHoldability(int holdability) throws SQLException { this.delegate.setHoldability(holdability); }
+ @Override public int getHoldability() throws SQLException { return this.delegate.getHoldability(); }
+ @Override public Savepoint setSavepoint() throws SQLException { return this.delegate.setSavepoint(); }
+ @Override public Savepoint setSavepoint(String name) throws SQLException { return this.delegate.setSavepoint(name); }
+ @Override public void rollback(Savepoint savepoint) throws SQLException { this.delegate.rollback(savepoint); }
+ @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { this.delegate.releaseSavepoint(savepoint); }
+ @Override public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return this.delegate.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); }
+ @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return this.delegate.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); }
+ @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return this.delegate.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); }
+ @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { return this.delegate.prepareStatement(sql, autoGeneratedKeys); }
+ @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return this.delegate.prepareStatement(sql, columnIndexes); }
+ @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { return this.delegate.prepareStatement(sql, columnNames); }
+ @Override public Clob createClob() throws SQLException { return this.delegate.createClob(); }
+ @Override public Blob createBlob() throws SQLException { return this.delegate.createBlob(); }
+ @Override public NClob createNClob() throws SQLException { return this.delegate.createNClob(); }
+ @Override public SQLXML createSQLXML() throws SQLException { return this.delegate.createSQLXML(); }
+ @Override public boolean isValid(int timeout) throws SQLException { return this.delegate.isValid(timeout); }
+ @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { this.delegate.setClientInfo(name, value); }
+ @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { this.delegate.setClientInfo(properties); }
+ @Override public String getClientInfo(String name) throws SQLException { return this.delegate.getClientInfo(name); }
+ @Override public Properties getClientInfo() throws SQLException { return this.delegate.getClientInfo(); }
+ @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { return this.delegate.createArrayOf(typeName, elements); }
+ @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { return this.delegate.createStruct(typeName, attributes); }
+ @Override public void setSchema(String schema) throws SQLException { this.delegate.setSchema(schema); }
+ @Override public String getSchema() throws SQLException { return this.delegate.getSchema(); }
+ @Override public void abort(Executor executor) throws SQLException { this.delegate.abort(executor); }
+ @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { this.delegate.setNetworkTimeout(executor, milliseconds); }
+ @Override public int getNetworkTimeout() throws SQLException { return this.delegate.getNetworkTimeout(); }
+
+}
diff --git a/Velocity/pom.xml b/Velocity/pom.xml
index 021bdfc..9bba078 100644
--- a/Velocity/pom.xml
+++ b/Velocity/pom.xml
@@ -5,7 +5,7 @@
AntiVPN
dev.brighten.antivpn
- 1.5.1
+ 1.5.2
4.0.0
@@ -33,7 +33,7 @@
dev.brighten.antivpn
Common
- 1.5.1
+ 1.5.2
provided
diff --git a/pom.xml b/pom.xml
index cea5a9d..4771876 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
dev.brighten.antivpn
AntiVPN
pom
- 1.5.1
+ 1.5.2
Common
@@ -32,6 +32,14 @@
8
8
-XDignore.symbol.file
+ false
+
+
+ org.projectlombok
+ lombok
+ 1.18.20
+
+