Skip to content

Commit

Permalink
Update GroupManager.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Ixf1nity authored May 11, 2024
1 parent 27f5fac commit f28a606
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,23 @@ public void save(GroupProfile groupProfile) {
groupProfiles.update(groupProfile);
}

public void saveAll() {
if (this.getInstance().getServer().getOnlinePlayers().isEmpty()) {
return;
}
if (this.getGroupProfileCache().isEmpty()) {
return;
}
this.groupProfileCache.values().forEach(this::save);
}

public void saveAllAsync() {
instance.getDatabaseManager().getHikariExecutor()
.execute(() -> {
if (this.getInstance().getServer().getOnlinePlayers().isEmpty()) {
return;
}
if (this.getGroupProfileCache().isEmpty()) {
return;
}
this.groupProfileCache.values().forEach(this::save);
this.saveAll();
});
}


@EventHandler(priority = EventPriority.LOW)
public void onJoin(PlayerJoinEvent event) {
Expand Down

0 comments on commit f28a606

Please sign in to comment.