Delete some Deprecated Plan API / implementation parts

- ServerKeys
- Deprecated PlayerKeys
- PlayerDeath
This commit is contained in:
Aurora Lahtela 2022-06-18 11:40:19 +03:00
parent 92910d647a
commit 9f66d0db27
10 changed files with 15 additions and 196 deletions

View File

@ -46,7 +46,7 @@ import java.util.stream.Collectors;
* @deprecated Plan API v4 has been deprecated, use the APIv5 instead (https://github.com/plan-player-analytics/Plan/wiki/APIv5).
*/
@Singleton
@Deprecated
@Deprecated(forRemoval = true, since = "5.0")
public class CommonAPI implements PlanAPI {
private final DBSystem dbSystem;
@ -107,7 +107,7 @@ public class CommonAPI implements PlanAPI {
@Override
public ServerContainer fetchServerContainer(UUID serverUUID) {
return new ServerContainer(new com.djrapitops.plan.delivery.domain.container.ServerContainer());
return new ServerContainer();
}
@Override

View File

@ -24,23 +24,18 @@ import java.util.Optional;
* Wrapper for a ServerContainer.
* <p>
* The actual object is wrapped to avoid exposing too much API that might change.
* See {@link com.djrapitops.plan.delivery.domain.keys.ServerKeys} for Key objects.
* <p>
* The Keys might change in the future, but the Optional API should help dealing with those cases.
*
* @author AuroraLS3
* @deprecated Plan API v4 has been deprecated, use the APIv5 instead (https://github.com/plan-player-analytics/Plan/wiki/APIv5).
*/
@Deprecated
@Deprecated(forRemoval = true, since = "5.0")
public class ServerContainer {
private final com.djrapitops.plan.delivery.domain.container.ServerContainer container;
public ServerContainer(com.djrapitops.plan.delivery.domain.container.ServerContainer container) {
this.container = container;
}
public ServerContainer() {/*Empty constructor, no-op derpecated api class*/}
public <T> Optional<T> getValue(Key<T> key) {
return container.getValue(key);
return Optional.empty();
}
}

View File

@ -1,26 +0,0 @@
/*
* 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.delivery.domain.container;
/**
* DataContainer for a single server.
*
* @author AuroraLS3
* @see com.djrapitops.plan.delivery.domain.keys.ServerKeys For Key objects.
*/
public class ServerContainer extends DynamicDataContainer {
}

View File

@ -16,12 +16,13 @@
*/
package com.djrapitops.plan.delivery.domain.keys;
import com.djrapitops.plan.delivery.domain.mutators.PlayersMutator;
import com.djrapitops.plan.delivery.domain.mutators.SessionsMutator;
import com.djrapitops.plan.delivery.domain.mutators.TPSMutator;
import com.djrapitops.plan.gathering.domain.*;
import com.djrapitops.plan.gathering.domain.FinishedSession;
import com.djrapitops.plan.gathering.domain.Ping;
import com.djrapitops.plan.gathering.domain.PlayerKill;
import com.djrapitops.plan.gathering.domain.WorldTimes;
import java.util.*;
import java.util.List;
import java.util.UUID;
/**
* Class holding Key objects that are commonly used across multiple DataContainers.
@ -44,23 +45,13 @@ public class CommonKeys {
public static final Key<WorldTimes> WORLD_TIMES = new Key<>(WorldTimes.class, "world_times");
public static final PlaceholderKey<Long> LAST_SEEN = new PlaceholderKey<>(Long.class, "lastSeen");
@Deprecated(forRemoval = true, since = "5.0")
public static final Key<List<PlayerDeath>> PLAYER_DEATHS = new Key<>(new Type<>() {}, "player_deaths");
public static final Key<List<PlayerKill>> PLAYER_KILLS = new Key<>(new Type<>() {}, "player_kills");
public static final Key<Integer> PLAYER_KILL_COUNT = new Key<>(Integer.class, "player_kill_count");
public static final Key<Integer> PLAYER_DEATH_COUNT = new Key<>(Integer.class, "player_death_count");
public static final Key<Integer> MOB_KILL_COUNT = new Key<>(Integer.class, "mob_kill_count");
public static final Key<Integer> MOB_DEATH_COUNT = new Key<>(Integer.class, "mob_death_count");
public static final Key<Integer> DEATH_COUNT = new Key<>(Integer.class, "death_count");
public static final Key<Boolean> BANNED = new Key<>(Boolean.class, "banned");
public static final Key<Boolean> OPERATOR = new Key<>(Boolean.class, "operator");
public static final Key<String> JOIN_ADDRESS = new Key<>(String.class, "join_address");
public static final Key<SessionsMutator> SESSIONS_MUTATOR = new Key<>(SessionsMutator.class, "SESSIONS_MUTATOR");
public static final Key<TPSMutator> TPS_MUTATOR = new Key<>(TPSMutator.class, "TPS_MUTATOR");
public static final Key<PlayersMutator> PLAYERS_MUTATOR = new Key<>(PlayersMutator.class, "PLAYERS_MUTATOR");
public static final Key<TreeMap<Long, Map<String, Set<UUID>>>> ACTIVITY_DATA = new Key<>(new Type<>() {}, "ACTIVITY_DATA");
}

View File

@ -17,7 +17,9 @@
package com.djrapitops.plan.delivery.domain.keys;
import com.djrapitops.plan.delivery.domain.container.PerServerContainer;
import com.djrapitops.plan.gathering.domain.*;
import com.djrapitops.plan.gathering.domain.FinishedSession;
import com.djrapitops.plan.gathering.domain.Ping;
import com.djrapitops.plan.gathering.domain.WorldTimes;
import java.util.List;
@ -40,16 +42,8 @@ public class PerServerKeys {
public static final Key<List<FinishedSession>> SESSIONS = CommonKeys.SESSIONS;
public static final Key<WorldTimes> WORLD_TIMES = CommonKeys.WORLD_TIMES;
@Deprecated
public static final Key<List<PlayerKill>> PLAYER_KILLS = CommonKeys.PLAYER_KILLS;
@Deprecated
public static final Key<List<PlayerDeath>> PLAYER_DEATHS = CommonKeys.PLAYER_DEATHS;
public static final Key<Integer> PLAYER_KILL_COUNT = CommonKeys.PLAYER_KILL_COUNT;
@Deprecated
public static final Key<Integer> PLAYER_DEATH_COUNT = CommonKeys.PLAYER_DEATH_COUNT;
public static final Key<Integer> MOB_KILL_COUNT = CommonKeys.MOB_KILL_COUNT;
@Deprecated
public static final Key<Integer> MOB_DEATH_COUNT = CommonKeys.MOB_DEATH_COUNT;
public static final Key<Integer> DEATH_COUNT = CommonKeys.DEATH_COUNT;
public static final Key<Long> LAST_SEEN = CommonKeys.LAST_SEEN;

View File

@ -51,10 +51,7 @@ public class PlayerKeys {
public static final Key<WorldTimes> WORLD_TIMES = CommonKeys.WORLD_TIMES;
public static final Key<List<PlayerKill>> PLAYER_KILLS = CommonKeys.PLAYER_KILLS;
public static final Key<List<PlayerKill>> PLAYER_DEATHS_KILLS = new Key<>(new Type<>() {
}, "player_deaths_kills");
@Deprecated(forRemoval = true, since = "5.0")
public static final Key<List<PlayerDeath>> PLAYER_DEATHS = CommonKeys.PLAYER_DEATHS;
public static final Key<List<PlayerKill>> PLAYER_DEATHS_KILLS = new Key<>(new Type<>() {}, "player_deaths_kills");
public static final Key<Integer> PLAYER_KILL_COUNT = CommonKeys.PLAYER_KILL_COUNT;
public static final Key<Integer> MOB_KILL_COUNT = CommonKeys.MOB_KILL_COUNT;
public static final Key<Integer> DEATH_COUNT = CommonKeys.DEATH_COUNT;

View File

@ -1,63 +0,0 @@
/*
* 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.delivery.domain.keys;
import com.djrapitops.plan.delivery.domain.DateObj;
import com.djrapitops.plan.delivery.domain.container.PlayerContainer;
import com.djrapitops.plan.delivery.domain.container.ServerContainer;
import com.djrapitops.plan.extension.implementation.results.ExtensionData;
import com.djrapitops.plan.gathering.domain.*;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* Keys for the ServerContainer.
*
* @author AuroraLS3
* @see ServerContainer For DataContainer.
*/
public class ServerKeys {
private ServerKeys() {
/* Static variable class */
}
public static final Key<UUID> SERVER_UUID = CommonKeys.SERVER_UUID;
public static final Key<String> NAME = CommonKeys.NAME;
public static final Key<List<PlayerContainer>> PLAYERS = new Key<>(new Type<>() {}, "players");
public static final Key<List<PlayerContainer>> OPERATORS = new Key<>(new Type<>() {}, "operators");
public static final Key<Integer> PLAYER_COUNT = new Key<>(Integer.class, "player_count");
public static final Key<List<FinishedSession>> SESSIONS = CommonKeys.SESSIONS;
public static final Key<List<Ping>> PING = CommonKeys.PING;
public static final Key<WorldTimes> WORLD_TIMES = CommonKeys.WORLD_TIMES;
public static final Key<List<PlayerKill>> PLAYER_KILLS = CommonKeys.PLAYER_KILLS;
public static final Key<Integer> PLAYER_KILL_COUNT = CommonKeys.PLAYER_KILL_COUNT;
public static final Key<Integer> MOB_KILL_COUNT = CommonKeys.MOB_KILL_COUNT;
public static final Key<Integer> DEATH_COUNT = CommonKeys.DEATH_COUNT;
public static final Key<List<TPS>> TPS = new Key<>(new Type<>() {}, "tps");
public static final Key<DateObj<Integer>> ALL_TIME_PEAK_PLAYERS = new Key<>(new Type<>() {}, "all_time_peak_players");
public static final Key<DateObj<Integer>> RECENT_PEAK_PLAYERS = new Key<>(new Type<>() {}, "recent_peak_players");
@Deprecated
public static final Key<Map<String, Integer>> COMMAND_USAGE = new Key<>(new Type<>() {}, "command_usage");
public static final Key<List<ExtensionData>> EXTENSION_DATA = new Key<>(new Type<>() {}, "extension_data");
}

View File

@ -17,10 +17,8 @@
package com.djrapitops.plan.delivery.domain.mutators;
import com.djrapitops.plan.delivery.domain.DateObj;
import com.djrapitops.plan.delivery.domain.container.DataContainer;
import com.djrapitops.plan.delivery.domain.container.PlayerContainer;
import com.djrapitops.plan.delivery.domain.keys.PlayerKeys;
import com.djrapitops.plan.delivery.domain.keys.ServerKeys;
import com.djrapitops.plan.gathering.domain.FinishedSession;
import com.djrapitops.plan.gathering.domain.GeoInfo;
import com.djrapitops.plan.gathering.domain.Ping;
@ -51,10 +49,6 @@ public class PlayersMutator {
return new PlayersMutator(new ArrayList<>(mutator.players));
}
public static PlayersMutator forContainer(DataContainer container) {
return new PlayersMutator(container.getValue(ServerKeys.PLAYERS).orElse(new ArrayList<>()));
}
public <T extends Predicate<PlayerContainer>> PlayersMutator filterBy(T by) {
return new PlayersMutator(Lists.filter(players, by));
}

View File

@ -16,8 +16,6 @@
*/
package com.djrapitops.plan.delivery.domain.mutators;
import com.djrapitops.plan.delivery.domain.container.DataContainer;
import com.djrapitops.plan.delivery.domain.keys.ServerKeys;
import com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraph;
import com.djrapitops.plan.delivery.rendering.json.graphs.line.Point;
import com.djrapitops.plan.gathering.domain.TPS;
@ -47,10 +45,6 @@ public class TPSMutator {
this.tpsData = tpsData;
}
public static TPSMutator forContainer(DataContainer container) {
return new TPSMutator(container.getValue(ServerKeys.TPS).orElse(new ArrayList<>()));
}
public static TPSMutator copyOf(TPSMutator mutator) {
return new TPSMutator(new ArrayList<>(mutator.tpsData));
}

View File

@ -1,57 +0,0 @@
/*
* 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.gathering.domain;
import com.djrapitops.plan.delivery.domain.DateHolder;
import java.util.UUID;
/**
* @deprecated Use {@link PlayerKill} instead.
*/
@Deprecated
public class PlayerDeath implements DateHolder {
private final UUID killer;
private final String killerName;
private final long date;
private final String weapon;
public PlayerDeath(UUID killer, String killerName, String weapon, long date) {
this.killer = killer;
this.killerName = killerName;
this.date = date;
this.weapon = weapon;
}
public UUID getKiller() {
return killer;
}
public String getKillerName() {
return killerName;
}
@Override
public long getDate() {
return date;
}
public String getWeapon() {
return weapon;
}
}