diff --git a/.gitignore b/.gitignore index ec376bb..7eae63f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -target \ No newline at end of file +target +dependency-reduced-pom.xml \ No newline at end of file diff --git a/pom.xml b/pom.xml index 230382a..64abd50 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 0ddcc56..186e76b 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -4,8 +4,6 @@ import de.steamwar.bungeecore.arenasystem.ArenaMode; import de.steamwar.bungeecore.arenasystem.ArenaSystem; import de.steamwar.bungeecore.bausystem.BauSystem; import de.steamwar.bungeecore.commands.*; -import de.steamwar.bungeecore.sql.Bauwelt; -import de.steamwar.bungeecore.sql.BauweltMember; import de.steamwar.bungeecore.sql.WarkingUser; import de.steamwar.bungeecore.sql.sql; import net.md_5.bungee.api.config.ServerInfo; @@ -125,11 +123,7 @@ public class BungeeCore extends Plugin { } }, 10, 10, TimeUnit.MINUTES); - getProxy().getScheduler().schedule(this, () -> { - WarkingUser.clearCache(); - Bauwelt.clearCache(); - BauweltMember.clearCache(); - }, 1, 1, TimeUnit.HOURS); + getProxy().getScheduler().schedule(this, WarkingUser::clearCache, 1, 1, TimeUnit.HOURS); } @Override diff --git a/src/de/steamwar/bungeecore/sql/Bauwelt.java b/src/de/steamwar/bungeecore/sql/Bauwelt.java index 49b15d8..13a6ad9 100644 --- a/src/de/steamwar/bungeecore/sql/Bauwelt.java +++ b/src/de/steamwar/bungeecore/sql/Bauwelt.java @@ -3,8 +3,6 @@ package de.steamwar.bungeecore.sql; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; import java.util.UUID; public class Bauwelt { @@ -13,15 +11,12 @@ public class Bauwelt { private boolean TNTDmg; private boolean FireDmg; - private static List welten = new ArrayList<>(); - private Bauwelt(int userID, boolean tntDmg, boolean fireDmg, boolean updateDB){ UserID = userID; TNTDmg = tntDmg; FireDmg = fireDmg; if(updateDB) updateDB(); - welten.add(this); } public Bauwelt(int userID, boolean tntDmg, boolean fireDmg){ @@ -46,9 +41,6 @@ public class Bauwelt { } public static Bauwelt getBauwelt(int userId){ - for(Bauwelt welt : welten) - if(welt.UserID == userId) - return welt; ResultSet bauwelt = sql.select("SELECT * FROM Bauwelt WHERE UserID = '" + userId + "'"); try { if(bauwelt == null || !bauwelt.next()){ @@ -63,10 +55,6 @@ public class Bauwelt { return null; } - public static void clearCache(){ - welten.clear(); - } - public int getUserID() { return UserID; } diff --git a/src/de/steamwar/bungeecore/sql/BauweltMember.java b/src/de/steamwar/bungeecore/sql/BauweltMember.java index 776db97..523947a 100644 --- a/src/de/steamwar/bungeecore/sql/BauweltMember.java +++ b/src/de/steamwar/bungeecore/sql/BauweltMember.java @@ -13,7 +13,6 @@ public class BauweltMember{ private boolean WorldEdit; private boolean World; - private static final List members = new ArrayList<>(); private BauweltMember(int ownerID, int memberID, boolean build, boolean worldEdit, boolean world, boolean updateDB){ BauweltID = ownerID; @@ -23,7 +22,6 @@ public class BauweltMember{ World = world; if(updateDB) updateDB(); - members.add(this); } public BauweltMember(int ownerID, int memberID, boolean build, boolean worldEdit, boolean world){ @@ -36,7 +34,6 @@ public class BauweltMember{ public void remove(){ sql.update("DELETE FROM BauweltMember WHERE BauweltID = " + BauweltID + " AND MemberID = " + MemberID); - members.remove(this); } private void updateDB(){ @@ -53,9 +50,6 @@ public class BauweltMember{ } public static BauweltMember getBauMember(int ownerID, int memberID){ - for(BauweltMember member : members) - if(member.BauweltID == ownerID && member.MemberID == memberID) - return member; ResultSet member = sql.select("SELECT * FROM BauweltMember WHERE BauweltID = '" + ownerID + "' AND MemberID = '" + memberID + "'"); try { if(member == null || !member.next()){ @@ -71,10 +65,6 @@ public class BauweltMember{ return null; } - public static void clearCache(){ - members.clear(); - } - public static List getMembers(UUID bauweltID){ return getMembers(WarkingUser.get(bauweltID).getId()); }