From f3415580602472a4e97a23dc9871db0e4efe8523 Mon Sep 17 00:00:00 2001 From: Brianna O'Keefe Date: Thu, 27 Sep 2018 01:46:18 -0400 Subject: [PATCH] Boost system fixed. MySQL tweaks. --- .../epichoppers/EpicHoppersPlugin.java | 2 +- .../songoda/epichoppers/hopper/EHopper.java | 2 ++ .../epichoppers/utils/MySQLDatabase.java | 22 +------------------ .../src/main/resources/plugin.yml | 2 +- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/EpicHoppersPlugin.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/EpicHoppersPlugin.java index e54d1ba..bd4bcde 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/EpicHoppersPlugin.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/EpicHoppersPlugin.java @@ -178,7 +178,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers { // Adding in Boosts if (storage.containsGroup("boosts")) { for (StorageRow row : storage.getRowsByGroup("boosts")) { - if (!row.getItems().containsKey("player") || row.get("player").asString().equals("")) + if (!row.getItems().containsKey("uuid") || row.get("uuid").asString().equals("")) continue; BoostData boostData = new BoostData( diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java index 66690e6..7691a71 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java @@ -66,6 +66,8 @@ public class EHopper implements Hopper { Bukkit.getPlayer(lastPlayer).closeInventory(); } + if (placedBy == null) placedBy = player.getUniqueId(); + instance.getPlayerDataManager().getPlayerData(player).setLastHopper(this); Level nextLevel = instance.getLevelManager().getHighestLevel().getLevel() > level.getLevel() ? instance.getLevelManager().getLevel(level.getLevel() + 1) : null; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/utils/MySQLDatabase.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/utils/MySQLDatabase.java index ce9f23c..232782b 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/utils/MySQLDatabase.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/utils/MySQLDatabase.java @@ -5,39 +5,19 @@ import com.songoda.epichoppers.EpicHoppersPlugin; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; -import java.util.concurrent.CompletableFuture; -/** - * Represents a MySQL database source which directly connects to, queries and - * executes statements towards the database found at the constructed location. - * Operations performed on this object are done async (with the help of the - * {@link CompletableFuture} API) and uses a connection pool as to not have to - * constantly connect to and disconnect from the database - */ public class MySQLDatabase { private final EpicHoppersPlugin instance; private Connection connection; - /** - * Construct a new instance of a MySQLDatabase given the specified database - * credentials file. The file should be under the following format: - *

- * - * host:127.0.0.1
- * user:database_username
- * password:database_password - *
- * - * @param instance an instance of the plugin - */ public MySQLDatabase(EpicHoppersPlugin instance) { this.instance = instance; try { Class.forName("com.mysql.jdbc.Driver"); - String url = "jdbc:mysql://" + instance.getConfig().getString("Database.IP") + ":" + instance.getConfig().getString("Database.Port") + "/" + instance.getConfig().getString("Database.Database Name"); + String url = "jdbc:mysql://" + instance.getConfig().getString("Database.IP") + ":" + instance.getConfig().getString("Database.Port") + "/" + instance.getConfig().getString("Database.Database Name") + "?autoReconnect=true&useSSL=false"; this.connection = DriverManager.getConnection(url, instance.getConfig().getString("Database.Username"), instance.getConfig().getString("Database.Password")); //ToDo: This is sloppy diff --git a/EpicHoppers-Plugin/src/main/resources/plugin.yml b/EpicHoppers-Plugin/src/main/resources/plugin.yml index 95ae211..7dad635 100644 --- a/EpicHoppers-Plugin/src/main/resources/plugin.yml +++ b/EpicHoppers-Plugin/src/main/resources/plugin.yml @@ -3,7 +3,7 @@ description: EpicHoppers main: com.songoda.epichoppers.EpicHoppersPlugin depend: [Arconix] softdepend: [WildStacker, Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault] -version: 3 +version: 3.1 author: Songoda api-version: 1.13 commands: