43public class PlayerRecord {
45 private final Player player;
47 public boolean global;
48 private Map<ActivityType, TreeSet<GameRecord>> personalRecord =
new HashMap<>();
50 public PlayerRecord(
Player player) {
55 time = System.currentTimeMillis();
59 return end(activity,
true);
63 long record = System.currentTimeMillis() - time;
66 if (record > 1_800_000) {
82 TreeSet<GameRecord> personal = personalRecord.computeIfAbsent(activity, act ->
new TreeSet<>(Comparator.comparingLong(record -> record.time)));
83 if (personal.size() < 10) {
84 personal.add(tracker);
85 }
else if (tracker.time < personal.first().time) {
87 personal.add(tracker);
91 void clean(
int size) {
93 for (
int count = 0; count < (size < 25 ? 25 : size); count++) {
100 player.send(
new SendScrollbar(32400, (size < 10 ? 10 : size) * 28));
105 String[] marquee =
new String[5];
106 List<ActivityType> activities =
ActivityType.getRecordable();
109 player.send(
new SendString((viewing == activity ?
"<col=ffffff>" :
"</col>") + name, 32352 + count));
110 player.send(
new SendTooltip(
"Display " + name +
" records", 32352 + count));
113 for (
int index = 0; index < marquee.length; index++) {
116 activities.remove(type);
126 display(global, activity);
129 public void display(
boolean global,
ActivityType activity) {
130 this.global = global;
131 player.send(
new SendConfig(325, global ? 1 : 0));
139 showActivities(activity);
140 TreeSet<GameRecord> records = personalRecord.getOrDefault(activity,
new TreeSet<>());
144 player.send(
new SendString((idx / 5 + 1) +
")", (idx + 1) + 32401));
145 player.send(
new SendString(
Utility.formatName(personal.name), (idx + 2) + 32401));
147 player.send(
new SendString(personal.date, (idx + 4) + 32401));
150 player.send(
new SendScrollbar(32400, (records.size() < 9 ? 9 : records.size()) * 28));
151 player.interfaceManager.open(32300);