mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Cleanup some bad code in SQLDatastore. Might help #32
This commit is contained in:
parent
daef01194e
commit
0d515abadb
@ -306,25 +306,31 @@ abstract class SQLDatastore extends Datastore {
|
|||||||
@Override
|
@Override
|
||||||
public boolean loadAllGroups() {
|
public boolean loadAllGroups() {
|
||||||
List<String> groups = new ArrayList<>();
|
List<String> groups = new ArrayList<>();
|
||||||
boolean success = runQuery(GROUP_SELECT_ALL, resultSet -> {
|
boolean b = runQuery(GROUP_SELECT_ALL, resultSet -> {
|
||||||
boolean b = true;
|
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
String name = resultSet.getString("name");
|
String name = resultSet.getString("name");
|
||||||
if (!loadGroup(name)) {
|
|
||||||
b = false;
|
|
||||||
}
|
|
||||||
groups.add(name);
|
groups.add(name);
|
||||||
}
|
}
|
||||||
return b;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
if (!b) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String g : groups) {
|
||||||
|
if (!loadGroup(g)) {
|
||||||
|
b = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b) {
|
||||||
GroupManager gm = plugin.getGroupManager();
|
GroupManager gm = plugin.getGroupManager();
|
||||||
gm.getAll().values().stream()
|
gm.getAll().values().stream()
|
||||||
.filter(g -> !groups.contains(g.getName()))
|
.filter(g -> !groups.contains(g.getName()))
|
||||||
.forEach(gm::unload);
|
.forEach(gm::unload);
|
||||||
}
|
}
|
||||||
return success;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -404,25 +410,31 @@ abstract class SQLDatastore extends Datastore {
|
|||||||
@Override
|
@Override
|
||||||
public boolean loadAllTracks() {
|
public boolean loadAllTracks() {
|
||||||
List<String> tracks = new ArrayList<>();
|
List<String> tracks = new ArrayList<>();
|
||||||
boolean success = runQuery(TRACK_SELECT_ALL, resultSet -> {
|
boolean b = runQuery(TRACK_SELECT_ALL, resultSet -> {
|
||||||
boolean b = true;
|
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
String name = resultSet.getString("name");
|
String name = resultSet.getString("name");
|
||||||
if (!loadTrack(name)) {
|
|
||||||
b = false;
|
|
||||||
}
|
|
||||||
tracks.add(name);
|
tracks.add(name);
|
||||||
}
|
}
|
||||||
return b;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
if (!b) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String t : tracks) {
|
||||||
|
if (!loadTrack(t)) {
|
||||||
|
b = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b) {
|
||||||
TrackManager tm = plugin.getTrackManager();
|
TrackManager tm = plugin.getTrackManager();
|
||||||
tm.getAll().values().stream()
|
tm.getAll().values().stream()
|
||||||
.filter(t -> !tracks.contains(t.getName()))
|
.filter(t -> !tracks.contains(t.getName()))
|
||||||
.forEach(tm::unload);
|
.forEach(tm::unload);
|
||||||
}
|
}
|
||||||
return success;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user