Disabled hikari logs and added closing editor saving, closes 26 and 27

This commit is contained in:
stijnb1234 2020-02-16 08:47:28 +01:00
parent 85512cfbf2
commit 526cdde9e6
2 changed files with 18 additions and 0 deletions

View file

@ -777,6 +777,12 @@ public class V10LiftCommand implements CommandExecutor {
DataManager.removeRopeRemovesPlayer(p.getUniqueId()); DataManager.removeRopeRemovesPlayer(p.getUniqueId());
DataManager.removeDoorEditPlayer(p.getUniqueId()); DataManager.removeDoorEditPlayer(p.getUniqueId());
try {
V10LiftPlugin.getDBManager().save();
} catch (JsonProcessingException e) {
e.printStackTrace();
}
BlockState bs; BlockState bs;
Sign sign; Sign sign;
for (LiftBlock lb : lift.getBlocks()) { for (LiftBlock lb : lift.getBlocks()) {

View file

@ -16,6 +16,8 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
public class V10LiftPlugin extends JavaPlugin { public class V10LiftPlugin extends JavaPlugin {
@ -31,9 +33,14 @@ public class V10LiftPlugin extends JavaPlugin {
//Initialize the util //Initialize the util
new SBUtilities(this, "V10Lift"); new SBUtilities(this, "V10Lift");
//Load the config
config = new YamlFile("config"); config = new YamlFile("config");
config.loadDefaults(); config.loadDefaults();
//Disable the start/stop logging op HikariCP
Logger.getLogger("com.zaxxer.hikari.HikariDataSource").setLevel(Level.OFF);
//Load the database
dbManager = new DBManager("data"); dbManager = new DBManager("data");
try { try {
dbManager.load(); dbManager.load();
@ -41,15 +48,19 @@ public class V10LiftPlugin extends JavaPlugin {
e.printStackTrace(); e.printStackTrace();
} }
//Load the API
api = new V10LiftAPI(); api = new V10LiftAPI();
//Load the command
Objects.requireNonNull(getCommand("v10lift"), "Internal error! Command not found.").setExecutor(new V10LiftCommand()); Objects.requireNonNull(getCommand("v10lift"), "Internal error! Command not found.").setExecutor(new V10LiftCommand());
//Register the listeners
Bukkit.getPluginManager().registerEvents(new PlayerInteractListener(), this); Bukkit.getPluginManager().registerEvents(new PlayerInteractListener(), this);
Bukkit.getPluginManager().registerEvents(new BlockBreakListener(), this); Bukkit.getPluginManager().registerEvents(new BlockBreakListener(), this);
Bukkit.getPluginManager().registerEvents(new SignChangeListener(), this); Bukkit.getPluginManager().registerEvents(new SignChangeListener(), this);
Bukkit.getPluginManager().registerEvents(new EntityDamageListener(), this); Bukkit.getPluginManager().registerEvents(new EntityDamageListener(), this);
//Load the update checker
new UpdateManager(this, 72317, UpdateManager.CheckType.SPIGOT).handleResponse((versionResponse, version) -> { new UpdateManager(this, 72317, UpdateManager.CheckType.SPIGOT).handleResponse((versionResponse, version) -> {
if (versionResponse == UpdateManager.VersionResponse.FOUND_NEW) { if (versionResponse == UpdateManager.VersionResponse.FOUND_NEW) {
Bukkit.getLogger().warning("[V10Lift] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version); Bukkit.getLogger().warning("[V10Lift] There is a new version available! Current: " + this.getDescription().getVersion() + " New: " + version);
@ -66,6 +77,7 @@ public class V10LiftPlugin extends JavaPlugin {
@Override @Override
public void onDisable() { public void onDisable() {
V10LiftPlugin.getDBManager().removeFromData(); V10LiftPlugin.getDBManager().removeFromData();
try { try {
dbManager.save(); dbManager.save();
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {