mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 20:34:36 +01:00
Only show boss blitz leaderboard for the current season
This commit is contained in:
@@ -163,12 +163,16 @@ public final class DatabaseManager {
|
|||||||
return getDatastore().find(cls).stream();
|
return getDatastore().find(cls).stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> List<T> getSortedObjects(Class<T> cls, String filter, int limit) {
|
public <T> List<T> getSortedObjects(Class<T> cls, String filter, int value, String sortBy, int limit) {
|
||||||
var options = new FindOptions()
|
var options = new FindOptions()
|
||||||
.sort(Sort.descending(filter))
|
.sort(Sort.descending(sortBy))
|
||||||
.limit(limit);
|
.limit(limit);
|
||||||
|
|
||||||
return getDatastore().find(cls).iterator(options).toList();
|
return getDatastore()
|
||||||
|
.find(cls)
|
||||||
|
.filter(Filters.eq(filter, value))
|
||||||
|
.iterator(options)
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> void save(T obj) {
|
public <T> void save(T obj) {
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ public class ScoreBossManager extends PlayerManager {
|
|||||||
super(player);
|
super(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO calculate from bin data
|
|
||||||
public int getControlId() {
|
public int getControlId() {
|
||||||
return 2;
|
return Nebula.getGameContext().getScoreBossModule().getControlId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScoreBossControlDef getControlData() {
|
public ScoreBossControlDef getControlData() {
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ public class ScoreBossModule extends GameContextModule {
|
|||||||
this.ranking = new ArrayList<>();
|
this.ranking = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO calculate from bin data
|
||||||
|
public int getControlId() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
private long getRefreshTime() {
|
private long getRefreshTime() {
|
||||||
return Nebula.getConfig().getServerOptions().leaderboardRefreshTime * 1000;
|
return Nebula.getConfig().getServerOptions().leaderboardRefreshTime * 1000;
|
||||||
}
|
}
|
||||||
@@ -39,7 +44,7 @@ public class ScoreBossModule extends GameContextModule {
|
|||||||
this.ranking.clear();
|
this.ranking.clear();
|
||||||
|
|
||||||
// Get from database
|
// Get from database
|
||||||
var list = Nebula.getGameDatabase().getSortedObjects(ScoreBossRankEntry.class, "score", 50);
|
var list = Nebula.getGameDatabase().getSortedObjects(ScoreBossRankEntry.class, "controlId", this.getControlId(), "score", 50);
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
// Get rank entry and set proto
|
// Get rank entry and set proto
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ public class RemoteHandler implements Handler {
|
|||||||
// Check admin key
|
// Check admin key
|
||||||
if (token.equals(adminKey)) {
|
if (token.equals(adminKey)) {
|
||||||
Nebula.getCommandManager().invoke(null, command);
|
Nebula.getCommandManager().invoke(null, command);
|
||||||
Nebula.getLogger().warn(
|
Nebula.getLogger().warn("\u001B[38;2;252;186;3mRemote Server (Using Admin Key) sent command: /" + command + "\u001B[0m");
|
||||||
"\u001B[38;2;252;186;3mRemote Server (Using Admin Key) sent command: /" + command + "\u001B[0m");
|
|
||||||
ctx.status(200);
|
ctx.status(200);
|
||||||
ctx.contentType(ContentType.APPLICATION_JSON);
|
ctx.contentType(ContentType.APPLICATION_JSON);
|
||||||
ctx.result("{\"Code\":200,\"Data\":{},\"Msg\":\"Command executed\"}");
|
ctx.result("{\"Code\":200,\"Data\":{},\"Msg\":\"Command executed\"}");
|
||||||
|
|||||||
Reference in New Issue
Block a user