From 7f9c125c554c1b9889c3e55a975ed4f500dbea9a Mon Sep 17 00:00:00 2001 From: montlikadani Date: Sat, 5 Dec 2020 17:41:00 +0100 Subject: [PATCH] here too --- .../gamingmesh/jobs/config/BossBarManager.java | 4 ++-- .../jobs/config/RestrictedAreaManager.java | 6 +++--- .../com/gamingmesh/jobs/dao/JobsConnection.java | 2 +- .../java/com/gamingmesh/jobs/dao/JobsMySQL.java | 15 +++------------ .../java/com/gamingmesh/jobs/dao/JobsSQLite.java | 14 +++----------- 5 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java index 60052241..7390aa61 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java @@ -24,7 +24,7 @@ public class BossBarManager { this.plugin = plugin; } - public synchronized void ShowJobProgression(final JobsPlayer player) { + public void ShowJobProgression(final JobsPlayer player) { if (Version.getCurrent().isLower(Version.v1_9_R1) || player == null) return; @@ -36,7 +36,7 @@ public class BossBarManager { player.clearUpdateBossBarFor(); } - public synchronized void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) { + public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) { if (Version.getCurrent().isLower(Version.v1_9_R1) || !Jobs.getGCManager().BossBarsMessageByDefault) return; diff --git a/src/main/java/com/gamingmesh/jobs/config/RestrictedAreaManager.java b/src/main/java/com/gamingmesh/jobs/config/RestrictedAreaManager.java index 05ce9e79..6e153a3f 100644 --- a/src/main/java/com/gamingmesh/jobs/config/RestrictedAreaManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/RestrictedAreaManager.java @@ -104,7 +104,7 @@ public class RestrictedAreaManager { * @param player * @return - the multiplier */ - public synchronized double getRestrictedMultiplier(Player player) { + public double getRestrictedMultiplier(Player player) { if (player == null) return 0D; for (RestrictedArea area : getRestrictedAreasByLoc(player.getLocation())) { @@ -116,7 +116,7 @@ public class RestrictedAreaManager { return 0D; } - public synchronized List getRestrictedAreasByLoc(Location loc) { + public List getRestrictedAreasByLoc(Location loc) { List areas = new ArrayList<>(); for (RestrictedArea area : restrictedAreas.values()) { if (area.inRestrictedArea(loc)) @@ -129,7 +129,7 @@ public class RestrictedAreaManager { return areas; } - public synchronized List getRestrictedAreasByName(String name) { + public List getRestrictedAreasByName(String name) { List areas = new ArrayList<>(); for (Entry area : restrictedAreas.entrySet()) { if (area.getKey().equalsIgnoreCase(name)) diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java b/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java index 11d3a388..daf5e218 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java @@ -13,7 +13,7 @@ public class JobsConnection { this.conn = conn; } - public synchronized Connection getConnection() { + public Connection getConnection() { return conn; } diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java b/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java index dd370806..ea60aa4a 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsMySQL.java @@ -28,24 +28,15 @@ public class JobsMySQL extends JobsDAO { } @Override - protected synchronized void checkUpdate() throws SQLException { + protected void checkUpdate() throws SQLException { JobsConnection conn = getConnection(); if (conn == null) { Jobs.consoleMsg("&cCould not run database updates! Could not connect to MySQL!"); return; } - createDefaultUsersBase(); - } - private boolean createDefaultUsersBase() { - try { - executeSQL("CREATE TABLE `" + getPrefix() - + "users` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_uuid` varchar(36) NOT NULL, `username` varchar(20), `seen` bigint);"); - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; + executeSQL("CREATE TABLE `" + getPrefix() + + "users` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_uuid` varchar(36) NOT NULL, `username` varchar(20), `seen` bigint);"); } @Override diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java b/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java index 92b3ce98..49c6d9cd 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsSQLite.java @@ -32,23 +32,15 @@ public class JobsSQLite extends JobsDAO { } @Override - protected synchronized void checkUpdate() throws SQLException { + protected void checkUpdate() throws SQLException { JobsConnection conn = getConnection(); if (conn == null) { - Jobs.consoleMsg("&cCould not run database updates! Could not connect to MySQL!"); + Jobs.consoleMsg("&cCould not run database updates! Could not connect to MySQL!"); return; } - createDefaultUsersBase(); - } - private boolean createDefaultUsersBase() { - try { - executeSQL("CREATE TABLE `" + getPrefix() + executeSQL("CREATE TABLE `" + getPrefix() + "users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `player_uuid` varchar(36) NOT NULL, `username` varchar(20), `data` text);"); - } catch (SQLException e) { - return false; - } - return true; } @Override