From 312f5ba286444b4d96812f9e37520caaa9cdad9f Mon Sep 17 00:00:00 2001 From: orbyfied Date: Sun, 10 Dec 2023 17:30:49 +0100 Subject: [PATCH] test with implements partial --- .../slatepowered/inset/MongoDatastoreExample.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/inset-mongodb/src/test/java/example/slatepowered/inset/MongoDatastoreExample.java b/inset-mongodb/src/test/java/example/slatepowered/inset/MongoDatastoreExample.java index 452bdd6..20dacbc 100644 --- a/inset-mongodb/src/test/java/example/slatepowered/inset/MongoDatastoreExample.java +++ b/inset-mongodb/src/test/java/example/slatepowered/inset/MongoDatastoreExample.java @@ -21,7 +21,7 @@ public class MongoDatastoreExample { @ToString - public static class Stats { + public static class Stats implements PartialStats { @Key protected UUID uuid; @@ -29,6 +29,16 @@ public static class Stats { // lazy to make that work with Unsafe rn protected Integer kills = 0; protected Integer deaths = 0; + + @Override + public UUID uuid() { + return uuid; + } + + @Override + public Integer deaths() { + return deaths; + } } public interface PartialStats { @@ -112,7 +122,7 @@ public static void main(String[] args) throws InterruptedException { .forEach(FoundItem::fetch); // Randomize cache values - datastore.getDataCache().forEach(item -> item.get().deaths += (int)(Math.random() * 10)); + datastore.getDataCache().forEach(item -> item.get().deaths += (int)((Math.random() + 1) * 10)); // Try to get sorted list of items including locally cached values datastore.findAll(Query.all(), FindAllOperation.Options.builder().useCaches(true).build())