Skip to content
Open

V3 #149

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6924cbb
chore: bump version to 3.0.0-alpha.1
omrih4 Mar 1, 2026
70b0306
feat: remove deprecated jam fields
omrih4 Mar 1, 2026
1571c07
feat: show offline players in /player
omrih4 Mar 1, 2026
57935aa
feat: scrape world owner rank, players from world owners
omrih4 Mar 1, 2026
c75a532
chore: bump version to 3.0.0-alpha.2
omrih4 Mar 1, 2026
76c5304
merge master into v3
omrih4 Mar 26, 2026
6e1310d
Merge branch 'master' into v3
omrih4 Apr 17, 2026
9f80f58
feat: normalized_name world field
omrih4 Apr 21, 2026
f8d3aea
Merge branch 'master' into v3
omrih4 Apr 21, 2026
4be0057
chore: bump version to 3.0.0-alpha.4
omrih4 Apr 21, 2026
afdc698
Merge branch 'master' into v3
omrih4 May 25, 2026
a79311e
feat: scrape lobby to api
omrih4 May 25, 2026
6cc498d
chore: bump version
omrih4 May 25, 2026
1d7a905
feat: scrape lobby description from server motd
omrih4 May 25, 2026
3870303
Merge branch 'master' into v3
omrih4 May 31, 2026
0a84a56
Merge branch 'master' into v3
omrih4 May 31, 2026
513d7bf
feat: deleted field
omrih4 May 31, 2026
a47a8a2
fix: remove previous TTL index for deleting >24h
omrih4 May 31, 2026
0ec8750
merge master into v3
omrih4 Jun 18, 2026
774c2e6
fuck you (mongodb is being a lil bitch)
omrih4 Jun 18, 2026
bd81b99
Revert "fuck you (mongodb is being a lil bitch)"
omrih4 Aug 25, 2026
5856be9
Merge branch 'master' into v3
omrih4 Aug 25, 2026
b8e1d2f
fix: write legiticoins for scraped players
omrih4 Aug 25, 2026
64b4c78
fix: failing to write/read jam object
omrih4 Aug 25, 2026
99bd56d
chore: bump version to 3.0.0-alpha.8
omrih4 Aug 25, 2026
0efe7a4
rename deleted to legitidevs.deleted
omrih4 Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.configuration-cache=false
minecraft_version=26.2
loader_version=0.19.3
# Mod Properties
mod_version=2.27.3
mod_version=3.0.0-alpha.8
maven_group=net.legitimoose
archives_base_name=Legitimoose-Bot
# Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private static void rejoin() {
if ((now - lastJoinTimestamp) >= REJOIN_COOLDOWN_MS) {
lastJoinTimestamp = now;
LOGGER.info("Attempting to reconnect to server");
ServerData info = new ServerData("Server", "legitimoose.com", ServerData.Type.OTHER);
ServerData info = new ServerData("Legitimoose", "legitimoose.com", ServerData.Type.OTHER);
ConnectScreen.startConnecting(
new JoinMultiplayerScreen(null),
Minecraft.getInstance(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import net.legitimoose.bot.scraper.Player;
import net.legitimoose.bot.scraper.Rank;
import net.legitimoose.bot.util.McUtil;
import org.bson.Document;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import org.jspecify.annotations.NonNull;

import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -25,11 +27,19 @@ public JsonArray handleRequest() {
JsonArray response = new JsonArray();
Map<String, String> usernames = getPlayers();

for (String user : usernames.keySet()) {
for (String username : usernames.keySet()) {
try {
if (Database.getPlayers().countDocuments(new Document("name", username)) == 0) {
new Player(McUtil.getUuid(username), username, Rank.Unknown, List.of(), new Player.Streak(1, false), Instant.EPOCH, 0).write();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}

for (Player dbPlayer : Database.getPlayers().find()) {
JsonObject player = new JsonObject();
try {
String uuid = McUtil.getUuid(user);
Player dbPlayer = Database.getPlayers().find(eq("uuid", uuid)).first();
Rank rank;
if (dbPlayer == null) {
rank = Rank.Unknown;
Expand All @@ -39,10 +49,18 @@ public JsonArray handleRequest() {
rank = dbPlayer.rank();
}

player.addProperty("uuid", uuid);
player.addProperty("name", user);
boolean online = false;
String world = "";
if (usernames.get(dbPlayer.name()) != null) {
online = true;
world = usernames.get(dbPlayer.name());
}

player.addProperty("uuid", dbPlayer.uuid());
player.addProperty("name", dbPlayer.name());
player.addProperty("rank", rank.toString());
player.addProperty("world", usernames.get(user));
player.addProperty("online", online);
player.addProperty("world", world);
response.add(player);
} catch (Exception e) {
throw new RuntimeException(e);
Expand All @@ -56,29 +74,36 @@ public JsonObject handleRequest(String uuid) {
JsonObject response = new JsonObject();
Map<String, String> usernames = getPlayers();

for (String user : usernames.keySet()) {
for (String username : usernames.keySet()) {
try {
if (!McUtil.getUuid(user).equals(uuid)) {
continue;
}
Player dbPlayer = Database.getPlayers().find(eq("uuid", uuid)).first();
Rank rank;
if (dbPlayer == null) {
rank = Rank.Unknown;
} else {
response.addProperty("streak", dbPlayer.streak().days());
response.addProperty("legiticoins", dbPlayer.legiticoins());
rank = dbPlayer.rank();
if (Database.getPlayers().countDocuments(new Document("name", username)) == 0) {
new Player(McUtil.getUuid(username), username, Rank.Unknown, List.of(), new Player.Streak(1, false), Instant.EPOCH, 0).write();
}

response.addProperty("name", user);
response.addProperty("rank", rank.toString());
response.addProperty("world", usernames.get(user));
} catch (Exception e) {
throw new RuntimeException(e);
}
}

Player dbPlayer = Database.getPlayers().find(eq("uuid", uuid)).first();
try {
boolean online = false;
String world = "";
if (usernames.get(dbPlayer.name()) != null) {
online = true;
world = usernames.get(dbPlayer.name());
}

response.addProperty("uuid", dbPlayer.uuid());
response.addProperty("name", dbPlayer.name());
response.addProperty("rank", dbPlayer.rank().toString());
response.addProperty("streak", dbPlayer.streak().days());
response.addProperty("online", online);
response.addProperty("world", world);
response.addProperty("legiticoins", dbPlayer.legiticoins());
} catch (Exception e) {
throw new RuntimeException(e);
}

return response;
}

Expand Down
6 changes: 4 additions & 2 deletions src/client/java/net/legitimoose/bot/scraper/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import static net.legitimoose.bot.LegitimooseBot.CONFIG;

import com.mongodb.client.*;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import net.legitimoose.bot.discord.command.mute.BotMute;
import org.bson.Document;

Expand Down Expand Up @@ -61,5 +64,4 @@ public static MongoCollection<Ban> getBans() {
public static MongoCollection<BotMute> getBotMutes() {
return getInstance().mutes;
}

}
2 changes: 1 addition & 1 deletion src/client/java/net/legitimoose/bot/scraper/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void write() {
Updates.set("uuid", this.uuid),
Updates.set("name", this.name),
Updates.set("rank", this.rank),
Updates.set("blocked", this.blocked),
Updates.setOnInsert("blocked", this.blocked),
Updates.set("streak", this.streak),
Updates.set("last_joined", new BsonDateTime(this.last_joined.toEpochMilli())),
Updates.set("legiticoins", this.legiticoins));
Expand Down
Loading
Loading