mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-29 11:31:41 +01:00
Deleted HandlingInfo
This commit is contained in:
parent
af63e3cb92
commit
91415d9125
@ -9,7 +9,6 @@ import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.additional.AnalysisType;
|
||||
import main.java.com.djrapitops.plan.data.additional.PluginData;
|
||||
import main.java.com.djrapitops.plan.data.cache.DBCallableProcessor;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||
import main.java.com.djrapitops.plan.ui.html.DataRequestHandler;
|
||||
import main.java.com.djrapitops.plan.ui.webserver.WebServer;
|
||||
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
@ -37,7 +36,6 @@ import java.util.stream.Collectors;
|
||||
* @see PluginData
|
||||
* @see AnalysisType
|
||||
* @see DBCallableProcessor
|
||||
* @see HandlingInfo
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class API {
|
||||
|
@ -134,7 +134,6 @@ public class DataCache extends SessionCache {
|
||||
endSession(uuid);
|
||||
String worldName = ((Player) p.getWrappedPlayerClass()).getWorld().getName();
|
||||
}
|
||||
// toProcess.sort(new HandlingInfoTimeComparator());
|
||||
Benchmark.stop("Cache: ProcessOnlineHandlingInfo");
|
||||
try {
|
||||
db.saveCommandUse(commandUse);
|
||||
|
@ -1,33 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for ChatEvent information.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@Deprecated // TODO Update Straight to db
|
||||
public class ChatInfo extends HandlingInfo {
|
||||
|
||||
private final String nickname;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param nickname Nickname of the player.
|
||||
*/
|
||||
public ChatInfo(UUID uuid, String nickname) {
|
||||
super(uuid, InfoType.CHAT, 0L);
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(UserData uData) {
|
||||
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.cache.DBCallableProcessor;
|
||||
import main.java.com.djrapitops.plan.queue.processing.Processor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* An abstract class for processing information about events and modifying
|
||||
* UserData objects associated with the events.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.0.0
|
||||
*/
|
||||
// TODO Rewrite all HandlingInfo objects to only extend Processor
|
||||
public abstract class HandlingInfo extends Processor<UUID> implements DBCallableProcessor {
|
||||
|
||||
final UUID uuid;
|
||||
final InfoType type;
|
||||
final long time;
|
||||
|
||||
/**
|
||||
* Super Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player
|
||||
* @param type InfoType enum of the event. Only used for debugging different
|
||||
* types.
|
||||
* @param time Epoch ms of the event.
|
||||
*/
|
||||
public HandlingInfo(UUID uuid, InfoType type, long time) {
|
||||
super(uuid);
|
||||
this.uuid = object;
|
||||
this.type = type;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UUID.
|
||||
*
|
||||
* @return UUID of the player associated with the event.
|
||||
*/
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the InfoType.
|
||||
*
|
||||
* @return InfoType enum.
|
||||
*/
|
||||
public InfoType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the epoch ms the event occurred.
|
||||
*
|
||||
* @return long in ms.
|
||||
*/
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void process() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the info and modify the UserData object accordingly.
|
||||
* <p>
|
||||
* If the UUIDs don't match no change should occur.
|
||||
*
|
||||
* @param uData UserData object to modify.
|
||||
* @return UUID of the UserData object and HandlingInfo match.
|
||||
*/
|
||||
public abstract void process(UserData uData);
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
/**
|
||||
* Enum class for the types of HandlingInfo to be processed.
|
||||
* <p>
|
||||
* Type is only used for debugging.
|
||||
* <p>
|
||||
* OTHER should be used when
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
public enum InfoType {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CHAT,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
DEATH,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
KILL,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
GM,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
LOGIN,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
LOGOUT,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
KICK,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
RELOAD,
|
||||
/**
|
||||
* Used for events registered with the API.
|
||||
*
|
||||
* @since 3.1.1
|
||||
*/
|
||||
WORLD,
|
||||
OTHER
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for KickEvent information.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@Deprecated //TODO Update Straight to db
|
||||
public class KickInfo extends HandlingInfo {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the kicked player.
|
||||
*/
|
||||
public KickInfo(UUID uuid) {
|
||||
super(uuid, InfoType.KICK, 0L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(UserData uData) {
|
||||
}
|
||||
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for JoinEvent information.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@Deprecated // TODO Update in listener to db
|
||||
public class LoginInfo extends HandlingInfo {
|
||||
|
||||
private final InetAddress ip;
|
||||
private final boolean banned;
|
||||
private final String nickname;
|
||||
private final PlaytimeDependentInfo playtimeDependentInfo;
|
||||
private final int loginTimes;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param nickname Nickname of the player
|
||||
* @param gm current gamemode of the player
|
||||
* @param loginTimes number the loginTimes should be incremented with.
|
||||
*/
|
||||
public LoginInfo(UUID uuid, long time, InetAddress ip, boolean banned, String nickname, String gm, int loginTimes, String worldName) {
|
||||
super(uuid, InfoType.LOGIN, time);
|
||||
this.ip = ip;
|
||||
this.banned = banned;
|
||||
this.nickname = nickname;
|
||||
this.playtimeDependentInfo = new PlaytimeDependentInfo(uuid, InfoType.OTHER, time, gm, worldName);
|
||||
this.loginTimes = loginTimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for not incrementing the loginTimes.
|
||||
* <p>
|
||||
* This constructor is used only by ReloadInfo
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param nickname Nickname of the player
|
||||
* @param gm current gamemode of the player
|
||||
*/
|
||||
public LoginInfo(UUID uuid, long time, InetAddress ip, boolean banned, String nickname, String gm, String worldName) {
|
||||
super(uuid, InfoType.RELOAD, time);
|
||||
this.ip = ip;
|
||||
this.banned = banned;
|
||||
this.nickname = nickname;
|
||||
this.playtimeDependentInfo = new PlaytimeDependentInfo(uuid, InfoType.OTHER, time, gm, worldName);
|
||||
this.loginTimes = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(UserData uData) {
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for QuitEvent information.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@Deprecated //TODO Update straight to db
|
||||
public class LogoutInfo extends HandlingInfo {
|
||||
|
||||
private final boolean banned;
|
||||
private final PlaytimeDependentInfo playtimeDependentInfo;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param banned Is the player banned
|
||||
* @param gm current gamemode of the player
|
||||
*/
|
||||
public LogoutInfo(UUID uuid, long time, boolean banned, String gm, String worldName) {
|
||||
super(uuid, InfoType.LOGOUT, time);
|
||||
this.banned = banned;
|
||||
this.playtimeDependentInfo = new PlaytimeDependentInfo(uuid, InfoType.OTHER, time, gm, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(UserData uData) {
|
||||
}
|
||||
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Deprecated //Sessions will take care of the stuff in the future.
|
||||
public class PlaytimeDependentInfo extends HandlingInfo {
|
||||
|
||||
private final String gamemode;
|
||||
private final String worldName;
|
||||
|
||||
public PlaytimeDependentInfo(UUID uuid, InfoType type, long time, String gm, String worldName) {
|
||||
super(uuid, type, time);
|
||||
this.worldName = worldName;
|
||||
this.gamemode = gm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(UserData uData) {
|
||||
if (!uuid.equals(uData.getUuid())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for refreshing data in the cache for online players.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class ReloadInfo extends LoginInfo {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @param time Epoch ms of the event.
|
||||
* @param ip IP of the player
|
||||
* @param banned Is the player banned?
|
||||
* @param nickname Nickname of the player
|
||||
* @param gm current gamemode of the player
|
||||
*/
|
||||
public ReloadInfo(UUID uuid, long time, InetAddress ip, boolean banned, String nickname, String gm, String worldName) {
|
||||
super(uuid, time, ip, banned, nickname, gm, worldName);
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.utilities.comparators;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Deprecated
|
||||
public class HandlingInfoTimeComparator implements Comparator<HandlingInfo> {
|
||||
|
||||
@Override
|
||||
public int compare(HandlingInfo o1, HandlingInfo o2) {
|
||||
return Long.compare(o1.getTime(), o2.getTime());
|
||||
}
|
||||
|
||||
}
|
@ -68,21 +68,6 @@ public class QueueTest {
|
||||
public void testProcessQueue() {
|
||||
List<Integer> processCalls = new ArrayList<>();
|
||||
List<Integer> errors = new ArrayList<>();
|
||||
// dataCache.addToPool(new HandlingInfo(uuid1, InfoType.OTHER, 0) {
|
||||
// @Override
|
||||
// public void process(UserData uData) {
|
||||
// if (uData.equals(data1)) {
|
||||
// uData.setName("TestSuccessful");
|
||||
// processCalls.add(1);
|
||||
// } else {
|
||||
// errors.add(1);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// while (processCalls.size() < 1) {
|
||||
// if (errors.size() > 0) {
|
||||
// fail();
|
||||
// }
|
||||
// }
|
||||
// TODO Rewrite
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.TPS;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.WebUser;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||
import main.java.com.djrapitops.plan.locale.Message;
|
||||
import main.java.com.djrapitops.plan.locale.Msg;
|
||||
import main.java.com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||
@ -20,16 +19,6 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class ComparatorTest {
|
||||
|
||||
@Test
|
||||
public void testHandlingInfoComparator() {
|
||||
List<HandlingInfo> test = RandomData.randomHandlingInfo();
|
||||
List<Long> longValues = test.stream().map(HandlingInfo::getTime).collect(Collectors.toList());
|
||||
longValues.sort(Long::compare);
|
||||
test.sort(new HandlingInfoTimeComparator());
|
||||
List<Long> afterSort = test.stream().map(HandlingInfo::getTime).collect(Collectors.toList());
|
||||
assertEquals(longValues, afterSort);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPointComparator() {
|
||||
List<Point> test = RandomData.randomPoints();
|
||||
|
@ -4,8 +4,6 @@ import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.TPS;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.WebUser;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.InfoType;
|
||||
import main.java.com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.Point;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
@ -13,7 +11,6 @@ import org.apache.commons.lang.RandomStringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class RandomData {
|
||||
@ -62,19 +59,6 @@ public class RandomData {
|
||||
return test;
|
||||
}
|
||||
|
||||
public static List<HandlingInfo> randomHandlingInfo() {
|
||||
List<HandlingInfo> test = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
test.add(new HandlingInfo(UUID.randomUUID(), randomEnum(InfoType.class), r.nextLong()) {
|
||||
@Override
|
||||
public void process(UserData uData) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
return test;
|
||||
}
|
||||
|
||||
public static <T extends Enum> T randomEnum(Class<T> clazz) {
|
||||
int x = r.nextInt(clazz.getEnumConstants().length);
|
||||
return clazz.getEnumConstants()[x];
|
||||
|
Loading…
Reference in New Issue
Block a user