9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-19 14:59:21 +00:00

Fix MongoDB getMapBinding and clarify Javadoc (#624)

This commit is contained in:
its.bread
2025-12-05 01:45:38 +08:00
committed by GitHub
parent b1a5eb5f44
commit a723a7cba3
2 changed files with 6 additions and 6 deletions

View File

@@ -280,11 +280,11 @@ public abstract class Database {
public abstract byte @Nullable [] getMapData(@NotNull String serverName, int mapId); public abstract byte @Nullable [] getMapData(@NotNull String serverName, int mapId);
/** /**
* Get a map server -> ID binding in the database * Reverse lookup: given a local map binding, find the origin server and map ID.
* *
* @param serverName Name of the server the map originates from * @param serverName Name of the local server (to_server_name in the binding)
* @param mapId Original map ID * @param mapId Local map ID on this server (to_id in the binding)
* @return Map.Entry (key: server name, value: map ID) * @return Map.Entry with origin server name (key) and origin map ID (value), or null if not found
*/ */
@Blocking @Blocking
public abstract @Nullable Map.Entry<String, Integer> getMapBinding(@NotNull String serverName, int mapId); public abstract @Nullable Map.Entry<String, Integer> getMapBinding(@NotNull String serverName, int mapId);

View File

@@ -399,8 +399,8 @@ public class MongoDbDatabase extends Database {
final Document doc = iterable.first(); final Document doc = iterable.first();
if (doc != null) { if (doc != null) {
return new AbstractMap.SimpleImmutableEntry<>( return new AbstractMap.SimpleImmutableEntry<>(
doc.getString("server_name"), doc.getString("from_server_name"),
doc.getInteger("to_id") doc.getInteger("from_id")
); );
} }
return null; return null;