Added logging top 10 PlayerScore in case of crash
This commit is contained in:
parent
bb01068080
commit
430e827e32
|
|
@ -1,6 +1,7 @@
|
|||
package com.alttd.fishingevent.points;
|
||||
|
||||
import com.alttd.fishingevent.FishingEvent;
|
||||
import com.alttd.fishingevent.scoreboard.ScoreboardManager;
|
||||
import com.alttd.fishingevent.util.Logger;
|
||||
import it.unimi.dsi.fastutil.io.BinIO;
|
||||
|
||||
|
|
@ -8,6 +9,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SaveTask implements Runnable {
|
||||
|
||||
|
|
@ -23,6 +25,12 @@ public class SaveTask implements Runnable {
|
|||
@Override
|
||||
public void run() {
|
||||
save();
|
||||
logScoreboard();
|
||||
}
|
||||
|
||||
private void logScoreboard() {
|
||||
String top10 = ScoreboardManager.getInstance().getTop10().stream().map(Object::toString).collect(Collectors.joining("\n"));
|
||||
logger.info("Logging top10 in case of crash: \n" + top10);
|
||||
}
|
||||
|
||||
private synchronized void save() {
|
||||
|
|
|
|||
|
|
@ -3,5 +3,15 @@ package com.alttd.fishingevent.scoreboard;
|
|||
import com.alttd.fishingevent.fish.Fish;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public record PlayerScore(Player player, double biggestFish, Fish fish){
|
||||
public record PlayerScore(Player player, double biggestFish, Fish fish) {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlayerScore{" +
|
||||
"player name=" + player.getName() +
|
||||
", player uuid= " + player.getUniqueId() +
|
||||
", biggest fish size=" + biggestFish +
|
||||
", fish rarity=" + fish.getRarity() +
|
||||
", fish name=" + fish.normalFishName() +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user