mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Fix floodgate not loading with mongo when collection already exists (#300)
This commit is contained in:
@@ -40,6 +40,7 @@ import com.mongodb.client.model.UpdateOptions;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
@@ -336,12 +337,7 @@ public class MongoDbDatabase extends CommonPlayerLink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean collectionNotExists(final String collectionName) {
|
public boolean collectionNotExists(final String collectionName) {
|
||||||
try (MongoCursor<String> collectionNames = database.listCollectionNames().cursor()) {
|
return !database.listCollectionNames().into(new ArrayList<>()).contains(collectionName);
|
||||||
if (collectionNames.hasNext() && collectionNames.next().equals(collectionName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user