Boost system fixed.

MySQL tweaks.
This commit is contained in:
Brianna O'Keefe 2018-09-27 01:46:18 -04:00
parent f3831a037e
commit f341558060
4 changed files with 5 additions and 23 deletions

View File

@ -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(

View File

@ -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;

View File

@ -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:
* <p>
* <code>
* host:127.0.0.1<br>
* user:database_username<br>
* password:database_password
* </code>
*
* @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

View File

@ -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: