mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-02 14:37:45 +01:00
Implemented %plan_player_favorite_server% placeholder
Requested on Discord in priority-support.
This commit is contained in:
parent
73343f8d20
commit
d731919b26
@ -18,15 +18,18 @@ package com.djrapitops.plan.addons.placeholderapi.placeholders;
|
||||
|
||||
import com.djrapitops.plan.delivery.domain.container.PlayerContainer;
|
||||
import com.djrapitops.plan.delivery.domain.keys.PlayerKeys;
|
||||
import com.djrapitops.plan.delivery.domain.mutators.PerServerMutator;
|
||||
import com.djrapitops.plan.delivery.domain.mutators.PingMutator;
|
||||
import com.djrapitops.plan.delivery.domain.mutators.PlayerVersusMutator;
|
||||
import com.djrapitops.plan.delivery.domain.mutators.SessionsMutator;
|
||||
import com.djrapitops.plan.delivery.formatting.Formatter;
|
||||
import com.djrapitops.plan.delivery.formatting.Formatters;
|
||||
import com.djrapitops.plan.gathering.cache.SessionCache;
|
||||
import com.djrapitops.plan.identification.Server;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
|
||||
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
|
||||
import com.djrapitops.plan.utilities.Predicates;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -154,6 +157,12 @@ public class PlayerPlaceHolder extends AbstractPlanPlaceHolder {
|
||||
.filterPlayedOnServer(serverUUID())
|
||||
.toPlaytime());
|
||||
|
||||
case "player_favorite_server":
|
||||
return PerServerMutator.forContainer(player).favoriteServer()
|
||||
.flatMap(serverUUID -> dbSystem.getDatabase().query(ServerQueries.fetchServerMatchingIdentifier(serverUUID)))
|
||||
.map(Server::getName)
|
||||
.orElse("-");
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user