mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-15 23:25:16 +01:00
Fix checkstyle
This commit is contained in:
parent
38b67272a6
commit
ecc08699ec
@ -148,6 +148,7 @@ public class PlayerPlaceHolders implements Placeholders {
|
|||||||
);
|
);
|
||||||
|
|
||||||
registerPlaytimePlaceholders(placeholders, time);
|
registerPlaytimePlaceholders(placeholders, time);
|
||||||
|
registerSessionLengethPlaceholders(placeholders, time);
|
||||||
|
|
||||||
placeholders.register("player_favorite_server",
|
placeholders.register("player_favorite_server",
|
||||||
player -> PerServerMutator.forContainer(player).favoriteServer()
|
player -> PerServerMutator.forContainer(player).favoriteServer()
|
||||||
@ -172,6 +173,33 @@ public class PlayerPlaceHolders implements Placeholders {
|
|||||||
registerKillPlaceholders(placeholders);
|
registerKillPlaceholders(placeholders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerSessionLengethPlaceholders(PlanPlaceholders placeholders, Formatter<Long> time) {
|
||||||
|
placeholders.register("player_current_session_length",
|
||||||
|
player -> time.apply(getActiveSessionLength(player).orElse(-1L)));
|
||||||
|
placeholders.register("player_current_session_length_raw",
|
||||||
|
player -> getActiveSessionLength(player).orElse(0L));
|
||||||
|
|
||||||
|
placeholders.register("player_latest_session_length",
|
||||||
|
player -> time.apply(getActiveSessionLength(player)
|
||||||
|
.orElseGet(() -> SessionsMutator.forContainer(player).latestSession()
|
||||||
|
.map(FinishedSession::getLength)
|
||||||
|
.orElse(-1L))));
|
||||||
|
placeholders.register("player_latest_session_length_raw",
|
||||||
|
player -> getActiveSessionLength(player)
|
||||||
|
.orElseGet(() -> SessionsMutator.forContainer(player).latestSession()
|
||||||
|
.map(FinishedSession::getLength)
|
||||||
|
.orElse(0L)));
|
||||||
|
|
||||||
|
placeholders.register("player_previous_session_length",
|
||||||
|
player -> time.apply(SessionsMutator.forContainer(player).previousSession()
|
||||||
|
.map(FinishedSession::getLength)
|
||||||
|
.orElse(-1L)));
|
||||||
|
placeholders.register("player_previous_session_length_raw",
|
||||||
|
player -> SessionsMutator.forContainer(player).previousSession()
|
||||||
|
.map(FinishedSession::getLength)
|
||||||
|
.orElse(0L));
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isAfk(PlayerContainer player) {
|
private boolean isAfk(PlayerContainer player) {
|
||||||
return SessionCache.getCachedSession(player.getUnsafe(PlayerKeys.UUID))
|
return SessionCache.getCachedSession(player.getUnsafe(PlayerKeys.UUID))
|
||||||
.map(ActiveSession::getLastMovementForAfkCalculation)
|
.map(ActiveSession::getLastMovementForAfkCalculation)
|
||||||
@ -349,31 +377,6 @@ public class PlayerPlaceHolders implements Placeholders {
|
|||||||
.filterPlayedOnServer(serverInfo.getServerUUID())
|
.filterPlayedOnServer(serverInfo.getServerUUID())
|
||||||
.toPlaytime()
|
.toPlaytime()
|
||||||
);
|
);
|
||||||
|
|
||||||
placeholders.register("player_current_session_length",
|
|
||||||
player -> time.apply(getActiveSessionLength(player).orElse(-1L)));
|
|
||||||
placeholders.register("player_current_session_length_raw",
|
|
||||||
player -> getActiveSessionLength(player).orElse(0L));
|
|
||||||
|
|
||||||
placeholders.register("player_latest_session_length",
|
|
||||||
player -> time.apply(getActiveSessionLength(player)
|
|
||||||
.orElseGet(() -> SessionsMutator.forContainer(player).latestSession()
|
|
||||||
.map(FinishedSession::getLength)
|
|
||||||
.orElse(-1L))));
|
|
||||||
placeholders.register("player_latest_session_length_raw",
|
|
||||||
player -> getActiveSessionLength(player)
|
|
||||||
.orElseGet(() -> SessionsMutator.forContainer(player).latestSession()
|
|
||||||
.map(FinishedSession::getLength)
|
|
||||||
.orElse(0L)));
|
|
||||||
|
|
||||||
placeholders.register("player_previous_session_length",
|
|
||||||
player -> time.apply(SessionsMutator.forContainer(player).previousSession()
|
|
||||||
.map(FinishedSession::getLength)
|
|
||||||
.orElse(-1L)));
|
|
||||||
placeholders.register("player_previous_session_length_raw",
|
|
||||||
player -> SessionsMutator.forContainer(player).previousSession()
|
|
||||||
.map(FinishedSession::getLength)
|
|
||||||
.orElse(0L));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Player Analytics (Plan).
|
||||||
|
*
|
||||||
|
* Plan is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Plan is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.djrapitops.plan.placeholder;
|
package com.djrapitops.plan.placeholder;
|
||||||
|
|
||||||
import com.djrapitops.plan.PlanSystem;
|
import com.djrapitops.plan.PlanSystem;
|
||||||
|
Loading…
Reference in New Issue
Block a user