geforkt von SteamWar/BungeeCore
Removing caches from Bauwelt and BauweltMember
Dieser Commit ist enthalten in:
Ursprung
be9478ad7a
Commit
ac4a2ab78b
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.idea
|
||||
target
|
||||
dependency-reduced-pom.xml
|
8
pom.xml
8
pom.xml
@ -44,6 +44,14 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<Bauwelt> 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;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ public class BauweltMember{
|
||||
private boolean WorldEdit;
|
||||
private boolean World;
|
||||
|
||||
private static final List<BauweltMember> 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<BauweltMember> getMembers(UUID bauweltID){
|
||||
return getMembers(WarkingUser.get(bauweltID).getId());
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren