mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-04 01:39:35 +01:00
Typo fixes & Cleaning
This commit is contained in:
parent
7e3c5ec217
commit
29e3f18725
8
Plan/.idea/dictionaries/Risto.xml
Normal file
8
Plan/.idea/dictionaries/Risto.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="Risto">
|
||||
<words>
|
||||
<w>ramer</w>
|
||||
<w>throwables</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
@ -194,7 +194,7 @@ public class Plan extends BukkitPlugin<Plan> {
|
||||
getServer().getScheduler().cancelTasks(this);
|
||||
if (Verify.notNull(handler, db)) {
|
||||
Benchmark.start("Disable: DataCache Save");
|
||||
// Saves the datacache to the database without Bukkit's Schedulers.
|
||||
// Saves the DataCache to the database without Bukkit's Schedulers.
|
||||
Log.info(Phrase.CACHE_SAVE + "");
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler.execute(() -> {
|
||||
|
@ -39,7 +39,7 @@ public class PlanCommand extends TreeCommand<Plan> {
|
||||
commands.add(new InfoCommand(plugin));
|
||||
commands.add(new ReloadCommand(plugin));
|
||||
commands.add(new ManageCommand(plugin));
|
||||
commands.add(new StatusCommand(plugin, Permissions.MANAGE.getPermission()));
|
||||
commands.add(new StatusCommand<>(plugin, Permissions.MANAGE.getPermission()));
|
||||
if (plugin.getUiServer().isEnabled()) {
|
||||
commands.add(new ListCommand(plugin));
|
||||
RegisterCommand registerCommand = new RegisterCommand(plugin);
|
||||
|
@ -52,7 +52,7 @@ public class AnalysisData extends RawData<AnalysisData> {
|
||||
playerCountPart = new PlayerCountPart();
|
||||
playtimePart = new PlaytimePart(playerCountPart);
|
||||
killPart = new KillPart(playerCountPart);
|
||||
gamemodePart = new GamemodePart(playerCountPart);
|
||||
gamemodePart = new GamemodePart();
|
||||
tpsPart = new TPSPart(tpsData);
|
||||
activityPart = new ActivityPart(joinInfoPart, tpsPart);
|
||||
}
|
||||
@ -135,9 +135,9 @@ public class AnalysisData extends RawData<AnalysisData> {
|
||||
|
||||
@Override
|
||||
protected void analyse() {
|
||||
Verify.notNull(playersTable);
|
||||
Verify.notNull(pluginsTabLayout);
|
||||
Verify.notNull(planVersion);
|
||||
Verify.nullCheck(playersTable);
|
||||
Verify.nullCheck(pluginsTabLayout);
|
||||
Verify.nullCheck(planVersion);
|
||||
|
||||
addValue("sortabletable", playersTable);
|
||||
addValue("version", planVersion);
|
||||
|
@ -43,7 +43,7 @@ public class UserData {
|
||||
private boolean isOnline;
|
||||
|
||||
private SessionData currentSession;
|
||||
private List<SessionData> sessions;
|
||||
private final List<SessionData> sessions;
|
||||
|
||||
/**
|
||||
* Creates a new UserData object with given values and default values.
|
||||
|
@ -17,7 +17,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class HookHandler {
|
||||
|
||||
private List<PluginData> additionalDataSources;
|
||||
private final List<PluginData> additionalDataSources;
|
||||
private final PluginConfigSectionHandler configHandler;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ public abstract class PluginData {
|
||||
* A list containing the AnalysisType enums that determine what should be
|
||||
* done with the data on the analysis page.
|
||||
*/
|
||||
protected List<AnalysisType> analysisTypes;
|
||||
protected final List<AnalysisType> analysisTypes;
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
|
@ -1,11 +1,12 @@
|
||||
package main.java.com.djrapitops.plan.data.analysis;
|
||||
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import java.util.Arrays;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Part responsible for all Gamemode usage related analysis.
|
||||
*
|
||||
@ -21,14 +22,12 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
*/
|
||||
public class GamemodePart extends RawData<GamemodePart> {
|
||||
|
||||
private final PlayerCountPart playerCount;
|
||||
private long survivalTime;
|
||||
private long creativeTime;
|
||||
private long adventureTime;
|
||||
private long spectatorTime;
|
||||
|
||||
public GamemodePart(PlayerCountPart playerCount) {
|
||||
this.playerCount = playerCount;
|
||||
public GamemodePart() {
|
||||
survivalTime = 0;
|
||||
creativeTime = 0;
|
||||
adventureTime = 0;
|
||||
|
@ -1,12 +1,13 @@
|
||||
package main.java.com.djrapitops.plan.data.analysis;
|
||||
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.data.KillData;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.KillData;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
|
||||
/**
|
||||
* Part responsible for all Death related analysis.
|
||||
@ -22,7 +23,7 @@ import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
*/
|
||||
public class KillPart extends RawData<KillPart> {
|
||||
|
||||
private final PlayerCountPart playerCount;
|
||||
private final PlayerCountPart playerCount; // TODO Averages
|
||||
private final Map<UUID, List<KillData>> playerKills;
|
||||
private long mobKills;
|
||||
private long deaths;
|
||||
|
@ -13,7 +13,6 @@ import main.java.com.djrapitops.plan.utilities.analysis.Analysis;
|
||||
*/
|
||||
public class AnalysisCacheHandler {
|
||||
|
||||
private final Plan plugin;
|
||||
private AnalysisData cache;
|
||||
private final Analysis analysis;
|
||||
private boolean analysisEnabled;
|
||||
@ -26,7 +25,6 @@ public class AnalysisCacheHandler {
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public AnalysisCacheHandler(Plan plugin) {
|
||||
this.plugin = plugin;
|
||||
analysis = new Analysis(plugin);
|
||||
analysisEnabled = true;
|
||||
}
|
||||
|
@ -80,9 +80,7 @@ public class GeolocationCacheHandler {
|
||||
String[] results = resultLine.split(",");
|
||||
String result = results[2];
|
||||
|
||||
String country = result.isEmpty() ? "Not Known" : result;
|
||||
|
||||
return country;
|
||||
return result.isEmpty() ? "Not Known" : result;
|
||||
} catch (Exception exc) {
|
||||
return "Not Known";
|
||||
} finally {
|
||||
|
@ -1,14 +1,5 @@
|
||||
package main.java.com.djrapitops.plan.data.cache;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
@ -16,6 +7,10 @@ import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.ExportUtility;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This class stores UserData objects used for displaying the Html pages.
|
||||
*
|
||||
@ -24,10 +19,9 @@ import main.java.com.djrapitops.plan.utilities.analysis.ExportUtility;
|
||||
*/
|
||||
public class InspectCacheHandler {
|
||||
|
||||
private DataCacheHandler handler;
|
||||
private Plan plugin;
|
||||
private Map<UUID, UserData> cache;
|
||||
private Map<UUID, Long> cacheTimes;
|
||||
private final DataCacheHandler handler;
|
||||
private final Map<UUID, UserData> cache;
|
||||
private final Map<UUID, Long> cacheTimes;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
@ -36,7 +30,6 @@ public class InspectCacheHandler {
|
||||
*/
|
||||
public InspectCacheHandler(Plan plugin) {
|
||||
this.handler = plugin.getHandler();
|
||||
this.plugin = plugin;
|
||||
this.cache = new HashMap<>();
|
||||
cacheTimes = new HashMap<>();
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.ChatHandling;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for ChatEvent information.
|
||||
*
|
||||
@ -12,8 +13,8 @@ import main.java.com.djrapitops.plan.data.handling.ChatHandling;
|
||||
*/
|
||||
public class ChatInfo extends HandlingInfo {
|
||||
|
||||
private String nickname;
|
||||
private String message;
|
||||
private final String nickname;
|
||||
private final String message;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -1,8 +1,9 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* An abstract class for processing information about events and modifying
|
||||
* UserData objects associated with the events.
|
||||
@ -12,9 +13,9 @@ import main.java.com.djrapitops.plan.data.UserData;
|
||||
*/
|
||||
public abstract class HandlingInfo {
|
||||
|
||||
UUID uuid;
|
||||
InfoType type;
|
||||
long time;
|
||||
final UUID uuid;
|
||||
final InfoType type;
|
||||
final long time;
|
||||
|
||||
/**
|
||||
* Super Constructor.
|
||||
|
@ -1,10 +1,11 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.KillHandling;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for DeathEvent information when the dead entity is a
|
||||
* player.
|
||||
@ -14,8 +15,8 @@ import org.bukkit.entity.LivingEntity;
|
||||
*/
|
||||
public class KillInfo extends HandlingInfo {
|
||||
|
||||
private LivingEntity dead;
|
||||
private String weaponName;
|
||||
private final LivingEntity dead;
|
||||
private final String weaponName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -1,11 +1,12 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import com.djrapitops.plugin.utilities.player.Gamemode;
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.LoginHandling;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for JoinEvent information.
|
||||
*
|
||||
@ -14,11 +15,11 @@ import main.java.com.djrapitops.plan.data.handling.LoginHandling;
|
||||
*/
|
||||
public class LoginInfo extends HandlingInfo {
|
||||
|
||||
private InetAddress ip;
|
||||
private boolean banned;
|
||||
private String nickname;
|
||||
private GamemodeInfo gmInfo;
|
||||
private int loginTimes;
|
||||
private final InetAddress ip;
|
||||
private final boolean banned;
|
||||
private final String nickname;
|
||||
private final GamemodeInfo gmInfo;
|
||||
private final int loginTimes;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -1,11 +1,12 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import com.djrapitops.plugin.utilities.player.Gamemode;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.LogoutHandling;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for QuitEvent information.
|
||||
*
|
||||
@ -14,9 +15,9 @@ import main.java.com.djrapitops.plan.data.handling.LogoutHandling;
|
||||
*/
|
||||
public class LogoutInfo extends HandlingInfo {
|
||||
|
||||
private boolean banned;
|
||||
private SessionData sData;
|
||||
private GamemodeInfo gmInfo;
|
||||
private final boolean banned;
|
||||
private final SessionData sData;
|
||||
private final GamemodeInfo gmInfo;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -1,11 +1,12 @@
|
||||
package main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import com.djrapitops.plugin.utilities.player.Gamemode;
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.LoginHandling;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* HandlingInfo Class for refreshing data in the cache for online players.
|
||||
*
|
||||
@ -14,10 +15,10 @@ import main.java.com.djrapitops.plan.data.handling.LoginHandling;
|
||||
*/
|
||||
public class ReloadInfo extends HandlingInfo {
|
||||
|
||||
private InetAddress ip;
|
||||
private boolean banned;
|
||||
private String nickname;
|
||||
private GamemodeInfo gmInfo;
|
||||
private final InetAddress ip;
|
||||
private final boolean banned;
|
||||
private final String nickname;
|
||||
private final GamemodeInfo gmInfo;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -16,7 +16,6 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
*/
|
||||
public class PlanChatListener implements Listener {
|
||||
|
||||
private final Plan plugin;
|
||||
private final DataCacheHandler handler;
|
||||
|
||||
/**
|
||||
@ -25,7 +24,6 @@ public class PlanChatListener implements Listener {
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public PlanChatListener(Plan plugin) {
|
||||
this.plugin = plugin;
|
||||
handler = plugin.getHandler();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||
*/
|
||||
public class PlanDeathEventListener implements Listener {
|
||||
|
||||
private final Plan plugin;
|
||||
private final DataCacheHandler handler;
|
||||
|
||||
/**
|
||||
@ -29,7 +28,6 @@ public class PlanDeathEventListener implements Listener {
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public PlanDeathEventListener(Plan plugin) {
|
||||
this.plugin = plugin;
|
||||
this.handler = plugin.getHandler();
|
||||
}
|
||||
|
||||
@ -38,6 +36,7 @@ public class PlanDeathEventListener implements Listener {
|
||||
*
|
||||
* @param event Fired event.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onDeath(EntityDeathEvent event) {
|
||||
long time = MiscUtils.getTime();
|
||||
@ -50,7 +49,7 @@ public class PlanDeathEventListener implements Listener {
|
||||
itemInHand = killer.getInventory().getItemInMainHand().getType();
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
itemInHand = killer.getInventory().getItemInHand().getType();
|
||||
itemInHand = killer.getInventory().getItemInHand().getType(); // Support for non dual wielding versions.
|
||||
} catch (Throwable e2) {
|
||||
itemInHand = Material.AIR;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
*/
|
||||
public class PlanGamemodeChangeListener implements Listener {
|
||||
|
||||
private final Plan plugin;
|
||||
private final DataCacheHandler handler;
|
||||
|
||||
/**
|
||||
@ -27,7 +26,6 @@ public class PlanGamemodeChangeListener implements Listener {
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public PlanGamemodeChangeListener(Plan plugin) {
|
||||
this.plugin = plugin;
|
||||
handler = plugin.getHandler();
|
||||
|
||||
}
|
||||
|
@ -226,9 +226,8 @@ public abstract class Database {
|
||||
* Uses DELETE * FROM table.
|
||||
*
|
||||
* @return Success of removal.
|
||||
* @throws SQLException If a database error occurs.
|
||||
*/
|
||||
public abstract boolean removeAllData() throws SQLException;
|
||||
public abstract boolean removeAllData();
|
||||
|
||||
/**
|
||||
* Used to save CommandUse map.
|
||||
|
@ -94,7 +94,7 @@ public class SecurityTable extends Table {
|
||||
statement = prepareStatement("SELECT * FROM " + tableName + " WHERE (" + columnUser + "=?)");
|
||||
statement.setString(1, user);
|
||||
set = statement.executeQuery();
|
||||
while (set.next()) {
|
||||
if (set.next()) {
|
||||
String saltedPassHash = set.getString(columnSaltedHash);
|
||||
int permissionLevel = set.getInt(columnPermLevel);
|
||||
return new WebUser(user, saltedPassHash, permissionLevel);
|
||||
|
@ -1,15 +1,16 @@
|
||||
package main.java.com.djrapitops.plan.database.tables;
|
||||
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.database.Container;
|
||||
import main.java.com.djrapitops.plan.database.DBUtils;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.database.Container;
|
||||
import main.java.com.djrapitops.plan.database.DBUtils;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -20,17 +21,17 @@ public abstract class Table {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected String tableName;
|
||||
protected final String tableName;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected SQLDB db;
|
||||
protected final SQLDB db;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected boolean usingMySQL;
|
||||
protected final boolean usingMySQL;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -391,8 +391,7 @@ public class UsersTable extends Table {
|
||||
statement = prepareStatement("SELECT * FROM " + tableName + " WHERE (" + columnUUID + "=?)");
|
||||
statement.setString(1, uuid.toString());
|
||||
set = statement.executeQuery();
|
||||
while (set.next()) {
|
||||
|
||||
if (set.next()) {
|
||||
String gm = set.getString(columnLastGM);
|
||||
boolean op = set.getBoolean(columnOP);
|
||||
boolean banned = set.getBoolean(columnBanned);
|
||||
@ -882,7 +881,7 @@ public class UsersTable extends Table {
|
||||
statement = prepareStatement("SELECT " + columnUUID + " FROM " + tableName + " WHERE (UPPER(" + columnName + ")=UPPER(?))");
|
||||
statement.setString(1, playername);
|
||||
set = statement.executeQuery();
|
||||
while (set.next()) {
|
||||
if (set.next()) {
|
||||
String uuidS = set.getString(columnUUID);
|
||||
return UUID.fromString(uuidS);
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package main.java.com.djrapitops.plan.ui.html;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.cache.AnalysisCacheHandler;
|
||||
@ -9,13 +7,15 @@ import main.java.com.djrapitops.plan.data.cache.InspectCacheHandler;
|
||||
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.PlaceholderUtils;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class DataRequestHandler {
|
||||
|
||||
private final Plan plugin;
|
||||
private final InspectCacheHandler inspectCache;
|
||||
private final AnalysisCacheHandler analysisCache;
|
||||
|
||||
@ -25,7 +25,6 @@ public class DataRequestHandler {
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public DataRequestHandler(Plan plugin) {
|
||||
this.plugin = plugin;
|
||||
this.inspectCache = plugin.getInspectCache();
|
||||
this.analysisCache = plugin.getAnalysisCache();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class RecentPlayersButtonsCreator {
|
||||
*
|
||||
* @param names The name of players sorted by last playtime.
|
||||
* @param limit How many players will be shown
|
||||
* @return html p-tag list of recent logins.
|
||||
* @return html p-tag list of recent log-ins.
|
||||
*/
|
||||
public static String createRecentLoginsButtons(List<String> names, int limit) {
|
||||
StringBuilder html = new StringBuilder();
|
||||
|
@ -43,6 +43,7 @@ public class PlayerActivityGraphCreator {
|
||||
private static List<Point> getPointsFromChangeMap(Map<Long, Integer> changeMap) {
|
||||
List<Point> points = new ArrayList<>();
|
||||
int lastIndex = -1;
|
||||
int i = 0;
|
||||
for (Long key : changeMap.keySet()) {
|
||||
long date = key;
|
||||
int change = changeMap.get(key);
|
||||
@ -52,6 +53,8 @@ public class PlayerActivityGraphCreator {
|
||||
previousValue = (int) points.get(lastIndex).getY();
|
||||
}
|
||||
points.add(new Point(date, previousValue+change));
|
||||
lastIndex = i;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return points;
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.ui.html.graphs;
|
||||
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
@ -29,7 +28,6 @@ public class PunchCardGraphCreator {
|
||||
* @return
|
||||
*/
|
||||
public static String generateDataArray(Collection<SessionData> data) {
|
||||
// Initialize dataset
|
||||
List<Long> sessionStarts = getSessionStarts(data);
|
||||
List<int[]> daysAndHours = AnalysisUtils.getDaysAndHours(sessionStarts);
|
||||
int[][] dataArray = createDataArray(daysAndHours);
|
||||
@ -68,7 +66,6 @@ public class PunchCardGraphCreator {
|
||||
if (Settings.ANALYSIS_REMOVE_OUTLIERS.isTrue()) {
|
||||
int avg = findAverage(dataArray);
|
||||
double standardDeviation = getStandardDeviation(dataArray, avg);
|
||||
Log.debug("Deviation: " + standardDeviation);
|
||||
if (standardDeviation > 3.5) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
for (int j = 0; j < 24; j++) {
|
||||
@ -157,7 +154,6 @@ public class PunchCardGraphCreator {
|
||||
scaled[i][j] = value;
|
||||
}
|
||||
}
|
||||
Log.debug("Punchcard Biggest value: " + big);
|
||||
return scaled;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class CommandUseTableCreator {
|
||||
* @return
|
||||
*/
|
||||
public static String createSortedCommandUseTable(Map<String, Integer> commandUse) {
|
||||
Benchmark.start("Create commanduse table");
|
||||
Benchmark.start("Create CommandUse table");
|
||||
List<String[]> sorted = MapComparator.sortByValue(commandUse);
|
||||
StringBuilder html = new StringBuilder();
|
||||
if (sorted.isEmpty()) {
|
||||
@ -42,7 +42,7 @@ public class CommandUseTableCreator {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
Benchmark.stop("Create commanduse table");
|
||||
Benchmark.stop("Create CommandUse table");
|
||||
return html.toString();
|
||||
}
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ public class KillsTableCreator {
|
||||
* @param killData
|
||||
* @return
|
||||
*/
|
||||
public static String createSortedSessionDataTable10(List<KillData> killData) {
|
||||
public static String createKillsTable(List<KillData> killData) {
|
||||
StringBuilder html = new StringBuilder(Html.TABLE_KILLS_START.parse());
|
||||
if (killData.isEmpty()) {
|
||||
html.append(Html.TABLELINE_3.parse(Html.KILLDATA_NONE.parse(), "", ""));
|
||||
} else {
|
||||
int i = 0;
|
||||
for (KillData kill : killData) {
|
||||
if (i >= 10) {
|
||||
if (i >= 20) {
|
||||
break;
|
||||
}
|
||||
long date = kill.getDate();
|
||||
|
@ -1,6 +1,5 @@
|
||||
package main.java.com.djrapitops.plan.ui.html.tables;
|
||||
|
||||
import java.util.List;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.ui.html.Html;
|
||||
@ -10,14 +9,14 @@ import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class PlayersTableCreator {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@ -33,14 +32,20 @@ public class PlayersTableCreator {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
String banOunknownOactiveOinactive = uData.isBanned() ? Html.GRAPH_BANNED.parse()
|
||||
: uData.getLoginTimes() == 1 ? Html.GRAPH_UNKNOWN.parse()
|
||||
: AnalysisUtils.isActive(now, uData.getLastPlayed(), uData.getPlayTime(), uData.getLoginTimes()) ? Html.GRAPH_ACTIVE.parse()
|
||||
: Html.GRAPH_INACTIVE.parse();
|
||||
boolean isBanned = uData.isBanned();
|
||||
boolean isUnknown = uData.getLoginTimes() == 1;
|
||||
boolean isActive = AnalysisUtils.isActive(now, uData.getLastPlayed(), uData.getPlayTime(), uData.getLoginTimes());
|
||||
|
||||
String activityString = isBanned ? Html.GRAPH_BANNED.parse()
|
||||
: isUnknown ? Html.GRAPH_UNKNOWN.parse()
|
||||
: isActive ? Html.GRAPH_ACTIVE.parse()
|
||||
: Html.GRAPH_INACTIVE.parse();
|
||||
|
||||
String img = showImages ? Html.MINOTAR_SMALL_IMG.parse(uData.getName()) : "";
|
||||
|
||||
html.append(Html.TABLELINE_PLAYERS.parse(
|
||||
img + Html.LINK.parse(HtmlUtils.getInspectUrl(uData.getName()), uData.getName()),
|
||||
banOunknownOactiveOinactive,
|
||||
activityString,
|
||||
uData.getPlayTime() + "", FormatUtils.formatTimeAmount(uData.getPlayTime()),
|
||||
uData.getLoginTimes() + "",
|
||||
uData.getRegistered() + "", FormatUtils.formatTimeStampYear(uData.getRegistered()),
|
||||
|
@ -1,50 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.ui.html.tables;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.ui.html.Html;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.comparators.SessionDataComparator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SessionTableCreator {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sessionData
|
||||
* @return
|
||||
*/
|
||||
public static String createSortedSessionDataTable10(List<SessionData> sessionData) {
|
||||
StringBuilder html = new StringBuilder(Html.TABLE_SESSIONS_START.parse());
|
||||
if (sessionData.isEmpty()) {
|
||||
html.append(Html.TABLELINE_3.parse(Html.SESSIONDATA_NONE.parse(), "", ""));
|
||||
} else {
|
||||
sessionData.sort(new SessionDataComparator());
|
||||
Collections.reverse(sessionData);
|
||||
int i = 0;
|
||||
for (SessionData session : sessionData) {
|
||||
if (i >= 10) {
|
||||
break;
|
||||
}
|
||||
long start = session.getSessionStart();
|
||||
long end = session.getSessionEnd();
|
||||
long length = end - start;
|
||||
if (length < 0) {
|
||||
continue;
|
||||
}
|
||||
html.append(Html.TABLELINE_3_CUSTOMKEY.parse(
|
||||
start + "", FormatUtils.formatTimeStamp(start),
|
||||
end + "", FormatUtils.formatTimeStamp(end),
|
||||
length + "", FormatUtils.formatTimeAmount(length)
|
||||
));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
html.append(Html.TABLE_END.parse());
|
||||
return html.toString();
|
||||
}
|
||||
}
|
@ -64,9 +64,8 @@ public class ManageUtils {
|
||||
* @param copyFromDB Database where data will be copied from
|
||||
* @param fromDBsavedUUIDs UUID collection of saved uuids in the copyFromDB
|
||||
* @return success?
|
||||
* @throws java.sql.SQLException
|
||||
*/
|
||||
public static boolean clearAndCopy(Database clearAndCopyToDB, Database copyFromDB, Collection<UUID> fromDBsavedUUIDs) throws SQLException {
|
||||
public static boolean clearAndCopy(Database clearAndCopyToDB, Database copyFromDB, Collection<UUID> fromDBsavedUUIDs) {
|
||||
try {
|
||||
clearAndCopyToDB.removeAllData();
|
||||
List<UserData> allUserData = copyFromDB.getUserDataForUUIDS(copyFromDB.getSavedUUIDs());
|
||||
|
@ -11,11 +11,9 @@ import main.java.com.djrapitops.plan.ui.html.graphs.PlayerActivityGraphCreator;
|
||||
import main.java.com.djrapitops.plan.ui.html.graphs.PunchCardGraphCreator;
|
||||
import main.java.com.djrapitops.plan.ui.html.graphs.SessionLengthDistributionGraphCreator;
|
||||
import main.java.com.djrapitops.plan.ui.html.tables.KillsTableCreator;
|
||||
import main.java.com.djrapitops.plan.ui.html.tables.SessionTableCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -62,9 +60,8 @@ public class PlaceholderUtils {
|
||||
*
|
||||
* @param data UserData used to replace the placeholders with
|
||||
* @return HashMap that contains string for each placeholder.
|
||||
* @throws java.io.FileNotFoundException if planliteplayer.html is not found
|
||||
*/
|
||||
public static Map<String, String> getInspectReplaceRules(UserData data) throws FileNotFoundException {
|
||||
public static Map<String, String> getInspectReplaceRules(UserData data) {
|
||||
Benchmark.start("Replace Placeholders Inspect");
|
||||
|
||||
HashMap<String, String> replaceMap = new HashMap<>();
|
||||
@ -77,7 +74,7 @@ public class PlaceholderUtils {
|
||||
long now = MiscUtils.getTime();
|
||||
boolean isActive = AnalysisUtils.isActive(now, data.getLastPlayed(), data.getPlayTime(), data.getLoginTimes());
|
||||
replaceMap.put("%active%", isActive ? Html.ACTIVE.parse() : Html.INACTIVE.parse());
|
||||
GamemodePart gmPart = new GamemodePart(null);
|
||||
GamemodePart gmPart = new GamemodePart();
|
||||
Map<String, Long> gmTimes = data.getGmTimes();
|
||||
String[] gms = new String[]{"SURVIVAL", "CREATIVE", "ADVENTURE", "SPECTATOR"};
|
||||
for (String gm : gms) {
|
||||
@ -101,9 +98,8 @@ public class PlaceholderUtils {
|
||||
replaceMap.put("%deaths%", data.getDeaths() + "");
|
||||
replaceMap.put("%playerkills%", data.getPlayerKills().size() + "");
|
||||
replaceMap.put("%mobkills%", data.getMobKills() + "");
|
||||
replaceMap.put("%sessionstable%", SessionTableCreator.createSortedSessionDataTable10(data.getSessions()));
|
||||
replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(MathUtils.averageLong(AnalysisUtils.transformSessionDataToLengths(data.getSessions()))));
|
||||
replaceMap.put("%killstable%", KillsTableCreator.createSortedSessionDataTable10(data.getPlayerKills()));
|
||||
replaceMap.put("%killstable%", KillsTableCreator.createKillsTable(data.getPlayerKills()));
|
||||
Plan plugin = Plan.getInstance();
|
||||
replaceMap.put("%version%", plugin.getDescription().getVersion());
|
||||
replaceMap.put("%planlite%", "");
|
||||
|
@ -26,9 +26,8 @@ public class ExportUtility {
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static File getFolder() throws IOException {
|
||||
public static File getFolder() {
|
||||
String path = Settings.ANALYSIS_EXPORT_PATH.toString();
|
||||
if (path.contains(":")) {
|
||||
File folder = new File(path);
|
||||
|
@ -4,8 +4,6 @@ import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class BStats {
|
||||
private final Plan plugin;
|
||||
private Metrics bStats;
|
||||
@ -46,20 +44,10 @@ public class BStats {
|
||||
}
|
||||
|
||||
private void addEnabledDisabledPie(String id, boolean setting) {
|
||||
bStats.addCustomChart(new Metrics.SimplePie(id, new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return setting ? "Enabled" : "Disabled";
|
||||
}
|
||||
}));
|
||||
bStats.addCustomChart(new Metrics.SimplePie(id, () -> setting ? "Enabled" : "Disabled"));
|
||||
}
|
||||
|
||||
private void addStringSettingPie(String id, String setting) {
|
||||
bStats.addCustomChart(new Metrics.SimplePie(id, new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return setting;
|
||||
}
|
||||
}));
|
||||
bStats.addCustomChart(new Metrics.SimplePie(id, () -> setting));
|
||||
}
|
||||
}
|
||||
|
@ -147,12 +147,7 @@ public class Metrics {
|
||||
}
|
||||
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
|
||||
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
submitData();
|
||||
}
|
||||
});
|
||||
Bukkit.getScheduler().runTask(plugin, () -> submitData());
|
||||
}
|
||||
}, 1000*60*5, 1000*60*30);
|
||||
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
|
||||
@ -257,17 +252,14 @@ public class Metrics {
|
||||
data.put("plugins", pluginData);
|
||||
|
||||
// Create a new thread for the connection to the bStats server
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// Send the data
|
||||
sendData(data);
|
||||
} catch (Exception e) {
|
||||
// Something went wrong! :(
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
||||
}
|
||||
new Thread(() -> {
|
||||
try {
|
||||
// Send the data
|
||||
sendData(data);
|
||||
} catch (Exception e) {
|
||||
// Something went wrong! :(
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
@ -1533,5 +1533,6 @@
|
||||
Plotly.plot(CLOROPLETH, data, layout, {showLink: false});
|
||||
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -61,7 +61,6 @@ public class DataCacheGetQueueTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
TestInit t = TestInit.init();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
plan = t.getPlanMock();
|
||||
db = new SQLiteDB(plan, "debug" + MiscUtils.getTime()) {
|
||||
@Override
|
||||
|
@ -6,8 +6,6 @@
|
||||
package test.java.main.java.com.djrapitops.plan.data.handling;
|
||||
|
||||
import com.djrapitops.plugin.utilities.player.IPlayer;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.KillData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
@ -24,10 +22,14 @@ import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
import test.java.utils.TestInit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
import test.java.utils.TestInit;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -38,7 +40,6 @@ import test.java.utils.TestInit;
|
||||
public class KillHandlingTest {
|
||||
|
||||
private Database db;
|
||||
private Plan plan;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -52,7 +53,7 @@ public class KillHandlingTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
TestInit t = TestInit.init();
|
||||
plan = t.getPlanMock();
|
||||
Plan plan = t.getPlanMock();
|
||||
db = new SQLiteDB(plan, "debug" + MiscUtils.getTime()) {
|
||||
@Override
|
||||
public void startConnectionPingTask() {
|
||||
|
@ -50,7 +50,6 @@ public class HtmlUtilsTest {
|
||||
TestInit t = TestInit.init();
|
||||
String fileName = "player.html";
|
||||
String result = HtmlUtils.getHtmlStringFromResource(fileName);
|
||||
assertTrue("Result null", result != null);
|
||||
assertTrue("Result empty", !result.isEmpty());
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ import static org.junit.Assert.assertTrue;
|
||||
@PrepareForTest({JavaPlugin.class})
|
||||
public class ManageUtilsTest {
|
||||
|
||||
private int threshold = 5000;
|
||||
private final int threshold = 5000;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -46,7 +46,6 @@ public class ManageUtilsTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
TestInit t = TestInit.init();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,14 +5,10 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.utilities.analysis;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -20,6 +16,12 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
@ -50,9 +52,8 @@ public class AnalysisUtilsTest {
|
||||
long lastPlayed = MiscUtils.getTime();
|
||||
long playTime = 12638934876L;
|
||||
int loginTimes = 4;
|
||||
boolean expResult = true;
|
||||
boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes);
|
||||
assertEquals(expResult, result);
|
||||
assertEquals(true, result);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,9 +64,8 @@ public class AnalysisUtilsTest {
|
||||
long lastPlayed = MiscUtils.getTime();
|
||||
long playTime = 0L;
|
||||
int loginTimes = 4;
|
||||
boolean expResult = false;
|
||||
boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes);
|
||||
assertEquals(expResult, result);
|
||||
assertEquals(false, result);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,9 +76,8 @@ public class AnalysisUtilsTest {
|
||||
long lastPlayed = MiscUtils.getTime();
|
||||
long playTime = 12638934876L;
|
||||
int loginTimes = 0;
|
||||
boolean expResult = false;
|
||||
boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes);
|
||||
assertEquals(expResult, result);
|
||||
assertEquals(false, result);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,9 +88,8 @@ public class AnalysisUtilsTest {
|
||||
long lastPlayed = 0L;
|
||||
long playTime = 12638934876L;
|
||||
int loginTimes = 4;
|
||||
boolean expResult = false;
|
||||
boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes);
|
||||
assertEquals(expResult, result);
|
||||
assertEquals(false, result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ public class MockUtils {
|
||||
*/
|
||||
public static World mockWorld() {
|
||||
World mockWorld = Mockito.mock(World.class);
|
||||
Mockito.doReturn("World").when(mockWorld).toString();
|
||||
when(mockWorld.toString()).thenReturn("World");
|
||||
return mockWorld;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
@ -39,12 +38,12 @@ public class TestInit {
|
||||
|
||||
public static TestInit init() throws Exception {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
t.setUp();
|
||||
return t;
|
||||
}
|
||||
|
||||
@Deprecated // Use Test.init instead.
|
||||
public boolean setUp() throws Exception {
|
||||
public void setUp() throws Exception {
|
||||
planMock = PowerMockito.mock(Plan.class);
|
||||
StaticHolder.setInstance(Plan.class, planMock);
|
||||
StaticHolder.setInstance(planMock.getClass(), planMock);
|
||||
@ -70,10 +69,10 @@ public class TestInit {
|
||||
Settings.DEBUG.setValue(true);
|
||||
|
||||
// Abstract Plugin Framework Mocks.
|
||||
BukkitLog<Plan> log = new BukkitLog(planMock, "console", "");
|
||||
BukkitLog<Plan> log = new BukkitLog<>(planMock, "console", "");
|
||||
BenchUtil bench = new BenchUtil();
|
||||
ServerVariableHolder serverVariableHolder = new ServerVariableHolder(mockServer);
|
||||
ProcessStatus<Plan> process = new ProcessStatus(planMock);
|
||||
ProcessStatus<Plan> process = new ProcessStatus<>(planMock);
|
||||
Fetch fetch = new Fetch(planMock);
|
||||
|
||||
when(planMock.getPluginLogger()).thenReturn(log);
|
||||
@ -81,7 +80,6 @@ public class TestInit {
|
||||
when(planMock.getVariable()).thenReturn(serverVariableHolder);
|
||||
when(planMock.processStatus()).thenReturn(process);
|
||||
when(planMock.fetch()).thenReturn(fetch);
|
||||
return true;
|
||||
}
|
||||
|
||||
private Server mockServer() {
|
||||
|
Loading…
Reference in New Issue
Block a user