Database-related optimizations
This commit is contained in:
1 parent
e5522e214f
commit
8acfa27987
3 files changed
+19
-12
No files matched your search
@@ -31,17 +31,17 @@ public class Database {
|
||||
}
|
||||
|
||||
private void setupMySQL(String host, int port, String database, String username, String password) {
|
||||
MysqlDataSource dataSource = new MysqlConnectionPoolDataSource(); // new MysqlDataSource();
|
||||
dataSource.setServerName(host);
|
||||
dataSource.setPortNumber(port);
|
||||
dataSource.setCreateDatabaseIfNotExist(true); // idk
|
||||
dataSource.setDatabaseName(database);
|
||||
dataSource.setUser(username);
|
||||
dataSource.setPassword(password);
|
||||
|
||||
this.dataSource = dataSource;
|
||||
|
||||
try {
|
||||
MysqlDataSource dataSource = new MysqlConnectionPoolDataSource(); // new MysqlDataSource();
|
||||
dataSource.setServerName(host);
|
||||
dataSource.setPortNumber(port);
|
||||
dataSource.setCreateDatabaseIfNotExist(true); // idk
|
||||
dataSource.setDatabaseName(database);
|
||||
dataSource.setUser(username);
|
||||
dataSource.setPassword(password);
|
||||
|
||||
this.dataSource = dataSource;
|
||||
|
||||
testDatabaseConnection();
|
||||
} catch (SQLException exception) {
|
||||
exception.printStackTrace();
|
||||
|
||||
@@ -92,7 +92,6 @@ public class Game extends JavaPlugin implements Listener {
|
||||
}
|
||||
|
||||
private void checkUpdate() {
|
||||
|
||||
Updater.of(this).resourceId(27107).handleResponse((versionResponse, version) -> {
|
||||
switch (versionResponse) {
|
||||
case FOUND_NEW:
|
||||
@@ -105,7 +104,6 @@ public class Game extends JavaPlugin implements Listener {
|
||||
break;
|
||||
}
|
||||
}).check();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -145,6 +143,14 @@ public class Game extends JavaPlugin implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// for players that haven't died and had their stats pushed
|
||||
// for (String username : CacheManager.getStatsCache().keySet()) {
|
||||
// arena.getStats().pushCachedStatsToDatabase(username);
|
||||
// }
|
||||
}
|
||||
|
||||
public boolean hasPlaceholderAPI() { return hasPlaceholderAPI; }
|
||||
|
||||
public boolean hasWorldGuard() { return hasWorldGuard; }
|
||||
|
||||
@@ -132,6 +132,7 @@ public class Arena {
|
||||
CacheManager.getPlayerAbilityCooldowns(p.getName()).clear();
|
||||
hitCache.remove(p.getName());
|
||||
stats.pushCachedStatsToDatabase(p.getName());
|
||||
CacheManager.getStatsCache().remove(p.getName());
|
||||
}
|
||||
|
||||
public void giveItems(Player p) {
|
||||
|
||||
Reference in new issue
Block a user