Skip to content

Commit

Permalink
giant code revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
98ping committed Aug 4, 2022
1 parent b7c4dfa commit caef8ea
Show file tree
Hide file tree
Showing 168 changed files with 109 additions and 64 deletions.
Binary file modified .gradle/7.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .gradle/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/checksums/sha1-checksums.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion commons/build/kotlin/commons10SNAPSHOTjar-classes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\Alchemist.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\expirables\Expirable.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\filter\Filter.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\Grantable.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\types\Punishment.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\types\RankGrant.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\types\TagGrant.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\party\Party.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\party\PartyElevation.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\profile\GameProfile.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\ranks\Rank.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\server\UniqueServer.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\tags\Tag.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\PunishmentType.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\actor\ActorType.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\actor\DefaultActor.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\actor\executor\Executor.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\redis\RedisPacket.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\redis\RedisPacketManager.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\ExpiringService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\PunishmentService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\RankGrantService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\TagGrantService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\filter\FilterService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\party\PartyService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\profiles\ProfileGameService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\ranks\RankService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\server\UniqueServerService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\tags\TagService.class
C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\Alchemist.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\expirables\Expirable.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\filter\Filter.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\Grantable.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\types\Punishment.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\types\RankGrant.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\grant\types\TagGrant.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\party\Party.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\party\PartyElevation.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\profile\GameProfile$getCurrentRank$$inlined$sortedBy$1.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\profile\GameProfile.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\ranks\Rank.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\server\UniqueServer.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\models\tags\Tag.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\PunishmentType.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\actor\ActorType.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\actor\DefaultActor.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\punishments\actor\executor\Executor.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\redis\RedisPacket.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\redis\RedisPacketManager.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\ExpiringService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\PunishmentService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\RankGrantService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\expirable\TagGrantService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\filter\FilterService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\party\PartyService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\profiles\ProfileGameService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\ranks\RankService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\server\UniqueServerService.class;C:\Users\Maximus\Desktop\Matrix Development\Alchemist\commons\build\classes\kotlin\main\ltd\matrixstudios\alchemist\service\tags\TagService.class
Binary file modified commons/build/kotlin/compileKotlin/build-history.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
38
46
0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified commons/build/kotlin/compileKotlin/last-build.bin
Binary file not shown.
Binary file modified commons/build/libs/commons-1.0-SNAPSHOT.jar
Binary file not shown.
Binary file modified commons/build/tmp/kapt3/incApCache/main/java-cache.bin
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import java.lang.System;

@kotlin.Metadata(mv = {1, 6, 0}, k = 1, d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u001e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u00c6\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0007\b\u0002\u00a2\u0006\u0002\u0010\u0003J\b\u0010\u000b\u001a\u00020\fH\u0016J\u0014\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0006J\u0012\u0010\u0010\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00020\u000e0\u0011J\u000e\u0010\u0012\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\u0002R&\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00020\u0005X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\n\u00a8\u0006\u0014"}, d2 = {"Lltd/matrixstudios/alchemist/service/expirable/RankGrantService;", "Lltd/matrixstudios/alchemist/service/expirable/ExpiringService;", "Lltd/matrixstudios/alchemist/models/grant/types/RankGrant;", "()V", "handler", "Lio/github/nosequel/data/store/StoreType;", "Ljava/util/UUID;", "getHandler", "()Lio/github/nosequel/data/store/StoreType;", "setHandler", "(Lio/github/nosequel/data/store/StoreType;)V", "clearOutModels", "", "findByTarget", "", "target", "getValues", "Ljava/util/concurrent/CompletableFuture;", "save", "rankGrant", "commons"})
@kotlin.Metadata(mv = {1, 6, 0}, k = 1, d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\u001e\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u00c6\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0007\b\u0002\u00a2\u0006\u0002\u0010\u0003J\b\u0010\u0017\u001a\u00020\u0018H\u0016J\u001a\u0010\u0019\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00020\u00120\u001a2\u0006\u0010\u001b\u001a\u00020\u000bJ\u0014\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u00020\u00122\u0006\u0010\u001d\u001a\u00020\u000bJ\u0012\u0010\u001e\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00020\u00120\u001aJ\u000e\u0010\u001f\u001a\u00020\u00182\u0006\u0010 \u001a\u00020!J\u000e\u0010\"\u001a\u00020\u00182\u0006\u0010#\u001a\u00020\u0002R\u0017\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR&\u0010\t\u001a\u000e\u0012\u0004\u0012\u00020\u000b\u0012\u0004\u0012\u00020\u00020\nX\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000fR,\u0010\u0010\u001a\u0014\u0012\u0004\u0012\u00020\u000b\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00020\u00120\u0011X\u0086\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0013\u0010\u0014\"\u0004\b\u0015\u0010\u0016\u00a8\u0006$"}, d2 = {"Lltd/matrixstudios/alchemist/service/expirable/RankGrantService;", "Lltd/matrixstudios/alchemist/service/expirable/ExpiringService;", "Lltd/matrixstudios/alchemist/models/grant/types/RankGrant;", "()V", "collection", "Lcom/mongodb/client/MongoCollection;", "Lorg/bson/Document;", "getCollection", "()Lcom/mongodb/client/MongoCollection;", "handler", "Lio/github/nosequel/data/store/StoreType;", "Ljava/util/UUID;", "getHandler", "()Lio/github/nosequel/data/store/StoreType;", "setHandler", "(Lio/github/nosequel/data/store/StoreType;)V", "playerGrants", "Ljava/util/HashMap;", "", "getPlayerGrants", "()Ljava/util/HashMap;", "setPlayerGrants", "(Ljava/util/HashMap;)V", "clearOutModels", "", "findByTarget", "Ljava/util/concurrent/CompletableFuture;", "target", "getFromCache", "uuid", "getValues", "recalculatePlayer", "gameProfile", "Lltd/matrixstudios/alchemist/models/profile/GameProfile;", "save", "rankGrant", "commons"})
public final class RankGrantService extends ltd.matrixstudios.alchemist.service.expirable.ExpiringService<ltd.matrixstudios.alchemist.models.grant.types.RankGrant> {
@org.jetbrains.annotations.NotNull()
public static final ltd.matrixstudios.alchemist.service.expirable.RankGrantService INSTANCE = null;
@org.jetbrains.annotations.NotNull()
private static io.github.nosequel.data.store.StoreType<java.util.UUID, ltd.matrixstudios.alchemist.models.grant.types.RankGrant> handler;
@org.jetbrains.annotations.NotNull()
private static final com.mongodb.client.MongoCollection<org.bson.Document> collection = null;
@org.jetbrains.annotations.NotNull()
private static java.util.HashMap<java.util.UUID, java.util.Collection<ltd.matrixstudios.alchemist.models.grant.types.RankGrant>> playerGrants;

private RankGrantService() {
super();
Expand All @@ -22,17 +26,41 @@ public final void setHandler(@org.jetbrains.annotations.NotNull()
io.github.nosequel.data.store.StoreType<java.util.UUID, ltd.matrixstudios.alchemist.models.grant.types.RankGrant> p0) {
}

@org.jetbrains.annotations.NotNull()
public final com.mongodb.client.MongoCollection<org.bson.Document> getCollection() {
return null;
}

@org.jetbrains.annotations.NotNull()
public final java.util.HashMap<java.util.UUID, java.util.Collection<ltd.matrixstudios.alchemist.models.grant.types.RankGrant>> getPlayerGrants() {
return null;
}

public final void setPlayerGrants(@org.jetbrains.annotations.NotNull()
java.util.HashMap<java.util.UUID, java.util.Collection<ltd.matrixstudios.alchemist.models.grant.types.RankGrant>> p0) {
}

@org.jetbrains.annotations.NotNull()
public final java.util.concurrent.CompletableFuture<java.util.Collection<ltd.matrixstudios.alchemist.models.grant.types.RankGrant>> getValues() {
return null;
}

@org.jetbrains.annotations.NotNull()
public final java.util.Collection<ltd.matrixstudios.alchemist.models.grant.types.RankGrant> getFromCache(@org.jetbrains.annotations.NotNull()
java.util.UUID uuid) {
return null;
}

public final void recalculatePlayer(@org.jetbrains.annotations.NotNull()
ltd.matrixstudios.alchemist.models.profile.GameProfile gameProfile) {
}

public final void save(@org.jetbrains.annotations.NotNull()
ltd.matrixstudios.alchemist.models.grant.types.RankGrant rankGrant) {
}

@org.jetbrains.annotations.NotNull()
public final java.util.Collection<ltd.matrixstudios.alchemist.models.grant.types.RankGrant> findByTarget(@org.jetbrains.annotations.NotNull()
public final java.util.concurrent.CompletableFuture<java.util.Collection<ltd.matrixstudios.alchemist.models.grant.types.RankGrant>> findByTarget(@org.jetbrains.annotations.NotNull()
java.util.UUID target) {
return null;
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,18 @@ data class GameProfile(
fun getCurrentRank(): Rank? {
var currentGrant: Rank? = RankService.findFirstAvailableDefaultRank()

RankGrantService.findByTarget(uuid).forEach { grant ->
if (grant.expirable.isActive() && grant.getGrantable()!!.weight > currentGrant!!.weight) {
currentGrant = grant.getGrantable()
}
val filteredRank = RankGrantService.getFromCache(uuid).filter {
it.expirable.isActive()
}.sortedBy { it.getGrantable()!!.weight }.reversed().firstOrNull()

if (filteredRank == null
||
filteredRank.getGrantable()!!.weight < currentGrant!!.weight
)
{
return currentGrant
}

return currentGrant
return filteredRank.getGrantable()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ object PunishmentService : ExpiringService<Punishment>() {
}


override fun clearOutModels() {
getValues().forEach {
if (!it.expirable.isActive() && it.removedBy == null) {
it.removedBy = UUID.fromString("00000000-0000-0000-0000-000000000000")
it.removedReason = "Expired"

save(it)
}
}
}
override fun clearOutModels() { }

}
Original file line number Diff line number Diff line change
@@ -1,44 +1,56 @@
package ltd.matrixstudios.alchemist.service.expirable

import com.mongodb.client.model.Filters
import io.github.nosequel.data.DataStoreType
import ltd.matrixstudios.alchemist.Alchemist
import ltd.matrixstudios.alchemist.models.grant.types.Punishment
import ltd.matrixstudios.alchemist.models.grant.types.RankGrant
import ltd.matrixstudios.alchemist.models.profile.GameProfile
import ltd.matrixstudios.alchemist.models.ranks.Rank
import ltd.matrixstudios.alchemist.punishments.PunishmentType
import ltd.matrixstudios.alchemist.punishments.actor.ActorType
import ltd.matrixstudios.alchemist.redis.RedisPacketManager
import org.bson.Document
import java.util.*
import java.util.concurrent.CompletableFuture

object RankGrantService : ExpiringService<RankGrant>() {

var handler = Alchemist.dataHandler.createStoreType<UUID, RankGrant>(DataStoreType.MONGO)

val collection = Alchemist.MongoConnectionPool.getCollection("rankgrant") //need this here because honey doesnt have a way to get raw collection

var playerGrants = hashMapOf<UUID, Collection<RankGrant>>()

fun getValues() : CompletableFuture<Collection<RankGrant>> {
return handler.retrieveAllAsync()
}

fun getFromCache(uuid: UUID): Collection<RankGrant> {
return playerGrants.getOrDefault(uuid, findByTarget(uuid).get())
}

fun recalculatePlayer(gameProfile: GameProfile) {
findByTarget(gameProfile.uuid).thenApply { playerGrants[gameProfile.uuid] = it }
}


fun save(rankGrant: RankGrant) {
handler.storeAsync(rankGrant.uuid, rankGrant)
}

fun findByTarget(target: UUID) : Collection<RankGrant> {
return getValues().get().filter { it.target == target }
}
fun findByTarget(target: UUID) : CompletableFuture<Collection<RankGrant>> {
return CompletableFuture.supplyAsync {
val sorted = collection.find(Document("target", target.toString()))

val toReturn = mutableListOf<RankGrant>()

for (rawDoc in sorted)
{
val json = rawDoc.toJson()

override fun clearOutModels() {
getValues().get().forEach {
if (!it.expirable.isActive() && it.removedBy == null) {
it.removedBy = UUID.fromString("00000000-0000-0000-0000-000000000000")
it.removedReason = "Expired"
val gson = Alchemist.gson.fromJson(json, RankGrant::class.java)

save(it)
toReturn.add(gson)
}

return@supplyAsync toReturn
}
}

override fun clearOutModels() { }
}
Loading

0 comments on commit caef8ea

Please sign in to comment.