mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-08 17:37:34 +01:00
[3.0.1] Merge pull request #82 from Rsl1122/Next-Version
Merge when new version is ready
This commit is contained in:
commit
2bd8377d8a
@ -6,7 +6,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import org.bukkit.ChatColor;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
* Phrase contains every message that is used in placeholders or commands. The
|
||||
@ -243,7 +242,7 @@ public enum Phrase {
|
||||
String[] split = localeRow.split(" <> ");
|
||||
Phrase.valueOf(split[0]).setText(split[1]);
|
||||
} catch (IllegalArgumentException e) {
|
||||
getPlugin(Plan.class).logError("There is a miswritten line in locale on line " + localeRows.indexOf(localeRow));
|
||||
Log.error("There is a miswritten line in locale on line " + localeRows.indexOf(localeRow));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -149,7 +149,7 @@ public class Plan extends JavaPlugin {
|
||||
}
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
if (handler != null) {
|
||||
log(Phrase.CACHE_SAVE + "");
|
||||
Log.info(Phrase.CACHE_SAVE + "");
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler.execute(() -> {
|
||||
handler.saveCacheOnDisable();
|
||||
@ -157,59 +157,7 @@ public class Plan extends JavaPlugin {
|
||||
|
||||
scheduler.shutdown();
|
||||
}
|
||||
log(Phrase.DISABLED + "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the message to the console.
|
||||
*
|
||||
* @param message "Message" will show up as [INFO][Plan]: Message
|
||||
*/
|
||||
@Deprecated
|
||||
public void log(String message) {
|
||||
Log.info(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an error message to the console.
|
||||
*
|
||||
* @param message "Message" will show up as [ERROR][Plan]: Message
|
||||
*/
|
||||
@Deprecated
|
||||
public void logError(String message) {
|
||||
Log.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs trace of caught Exception to Errors.txt & notifies on console.
|
||||
*
|
||||
* @param source Class name the exception was caught in.
|
||||
* @param e Throwable, eg NullPointerException
|
||||
*/
|
||||
@Deprecated
|
||||
public void toLog(String source, Throwable e) {
|
||||
Log.toLog(source, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs multiple caught Errors to Errors.txt.
|
||||
*
|
||||
* @param source Class name the exception was caught in.
|
||||
* @param e Collection of Throwables, eg NullPointerException
|
||||
*/
|
||||
@Deprecated
|
||||
public void toLog(String source, Collection<Throwable> e) {
|
||||
Log.toLog(source, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a message to the Errors.txt with a timestamp.
|
||||
*
|
||||
* @param message Message to log to Errors.txt [timestamp] Message
|
||||
*/
|
||||
@Deprecated
|
||||
public void toLog(String message) {
|
||||
Log.toLog(message);
|
||||
Log.info(Phrase.DISABLED + "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,11 +200,11 @@ public class Plan extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
if (db == null) {
|
||||
log(Phrase.DB_TYPE_DOES_NOT_EXIST.toString());
|
||||
Log.info(Phrase.DB_TYPE_DOES_NOT_EXIST.toString());
|
||||
return false;
|
||||
}
|
||||
if (!db.init()) {
|
||||
log(Phrase.DB_FAILURE_DISABLE.toString());
|
||||
Log.info(Phrase.DB_FAILURE_DISABLE.toString());
|
||||
setEnabled(false);
|
||||
return false;
|
||||
}
|
||||
@ -278,11 +226,11 @@ public class Plan extends JavaPlugin {
|
||||
}
|
||||
|
||||
private void startBootAnalysisTask() throws IllegalStateException, IllegalArgumentException {
|
||||
log(Phrase.ANALYSIS_BOOT_NOTIFY + "");
|
||||
Log.info(Phrase.ANALYSIS_BOOT_NOTIFY + "");
|
||||
BukkitTask bootAnalysisTask = (new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log(Phrase.ANALYSIS_BOOT + "");
|
||||
Log.info(Phrase.ANALYSIS_BOOT + "");
|
||||
analysisCache.updateCache();
|
||||
this.cancel();
|
||||
}
|
||||
@ -410,18 +358,22 @@ public class Plan extends JavaPlugin {
|
||||
localeFile.delete();
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
logError("Attempted using locale that doesn't exist.");
|
||||
Log.error("Attempted using locale that doesn't exist.");
|
||||
usingLocale = "Default: EN";
|
||||
} catch (IOException e) {
|
||||
}
|
||||
} else {
|
||||
usingLocale = "Default: EN";
|
||||
}
|
||||
log("Using locale: " + usingLocale);
|
||||
Log.info("Using locale: " + usingLocale);
|
||||
}
|
||||
|
||||
public static Plan getInstance() {
|
||||
return PlanHolder.INSTANCE;
|
||||
Plan INSTANCE = PlanHolder.INSTANCE;
|
||||
if (INSTANCE == null) {
|
||||
throw new IllegalStateException("Plugin not enabled properly, Singleton instance is null.");
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static void setInstance(Plan plan) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package main.java.com.djrapitops.plan.command.commands.manage;
|
||||
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
@ -65,7 +66,7 @@ public class ManageBackupCommand extends SubCommand {
|
||||
}
|
||||
if (database == null) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
plugin.logError(db + " was null!");
|
||||
Log.error(db + " was null!");
|
||||
return true;
|
||||
}
|
||||
final Database copyFromDB = database;
|
||||
|
@ -2,6 +2,7 @@ package main.java.com.djrapitops.plan.command.commands.manage;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
@ -71,7 +72,7 @@ public class ManageClearCommand extends SubCommand {
|
||||
}
|
||||
if (clearDB == null) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
plugin.logError(dbToClear + " was null!");
|
||||
Log.error(dbToClear + " was null!");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ public class ManageClearCommand extends SubCommand {
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL + "");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
plugin.toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL + "");
|
||||
}
|
||||
this.cancel();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package main.java.com.djrapitops.plan.command.commands.manage;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
@ -63,7 +64,7 @@ public class ManageHotswapCommand extends SubCommand {
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException | SQLException e) {
|
||||
plugin.toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
return true;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package main.java.com.djrapitops.plan.command.commands.manage;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
@ -76,12 +77,12 @@ public class ManageMoveCommand extends SubCommand {
|
||||
}
|
||||
if (fromDatabase == null) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
plugin.logError(fromDB + " was null!");
|
||||
Log.error(fromDB + " was null!");
|
||||
return true;
|
||||
}
|
||||
if (toDatabase == null) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
plugin.logError(toDB + " was null!");
|
||||
Log.error(toDB + " was null!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package main.java.com.djrapitops.plan.command.commands.manage;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
@ -82,7 +83,7 @@ public class ManageRemoveCommand extends SubCommand {
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL + "");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
plugin.toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL + "");
|
||||
}
|
||||
this.cancel();
|
||||
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
@ -66,7 +67,7 @@ public class ManageRestoreCommand extends SubCommand {
|
||||
}
|
||||
if (database == null) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
plugin.logError(db + " was null!");
|
||||
Log.error(db + " was null!");
|
||||
return true;
|
||||
}
|
||||
final Database copyToDB = database;
|
||||
|
@ -26,7 +26,6 @@ import main.java.com.djrapitops.plan.utilities.comparators.HandlingInfoTimeCompa
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
@ -127,7 +126,7 @@ public class DataCacheHandler extends LocationCache {
|
||||
BukkitTask asyncPeriodicCacheSaveTask = (new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
DataCacheHandler handler = getPlugin(Plan.class).getHandler();
|
||||
DataCacheHandler handler = Plan.getInstance().getHandler();
|
||||
handler.saveHandlerDataToCache();
|
||||
handler.saveCachedUserData();
|
||||
if (timesSaved % clearAfterXsaves == 0) {
|
||||
|
@ -40,7 +40,7 @@ public class DataCacheProcessQueue {
|
||||
try {
|
||||
queue.add(info);
|
||||
} catch (IllegalStateException e) {
|
||||
// getPlugin(Plan.class).logError(Phrase.ERROR_TOO_SMALL_QUEUE.parse("Save Queue", Settings.PROCESS_SAVE_LIMIT.getNumber() + ""));
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class DataCacheProcessQueue {
|
||||
try {
|
||||
queue.addAll(info);
|
||||
} catch (IllegalStateException e) {
|
||||
// getPlugin(Plan.class).logError(Phrase.ERROR_TOO_SMALL_QUEUE.parse("Save Queue", Settings.PROCESS_SAVE_LIMIT.getNumber() + ""));
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,12 @@ package main.java.com.djrapitops.plan.data.handling;
|
||||
|
||||
import java.sql.SQLException;
|
||||
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.KillData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -28,7 +28,7 @@ public class KillHandling {
|
||||
* @param weaponName
|
||||
*/
|
||||
public static void processKillInfo(UserData data, long time, LivingEntity dead, String weaponName) {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
Plan plugin = Plan.getInstance();
|
||||
if (dead instanceof Player) {
|
||||
Player deadPlayer = (Player) dead;
|
||||
int victimID;
|
||||
@ -40,7 +40,7 @@ public class KillHandling {
|
||||
}
|
||||
data.addPlayerKill(new KillData(victimUUID, victimID, weaponName, time));
|
||||
} catch (SQLException e) {
|
||||
plugin.toLog("main.java.com.djrapitops.plan.KillHandling", e);
|
||||
Log.toLog("main.java.com.djrapitops.plan.KillHandling", e);
|
||||
}
|
||||
} else {
|
||||
data.setMobKills(data.getMobKills() + 1);
|
||||
|
@ -3,10 +3,10 @@ package main.java.com.djrapitops.plan.database.databases;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -30,7 +30,7 @@ public class MySQLDB extends SQLDB {
|
||||
*/
|
||||
@Override
|
||||
public Connection getNewConnection() {
|
||||
FileConfiguration config = getPlugin(Plan.class).getConfig();
|
||||
FileConfiguration config = Plan.getInstance().getConfig();
|
||||
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
@ -40,7 +40,7 @@ public class MySQLDB extends SQLDB {
|
||||
|
||||
return connection;
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
getPlugin(Plan.class).logError(Phrase.DB_CONNECTION_FAIL.parse(getConfigName(), e.getMessage()));
|
||||
Log.error(Phrase.DB_CONNECTION_FAIL.parse(getConfigName(), e.getMessage()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ public abstract class SQLDB extends Database {
|
||||
try {
|
||||
checkConnection();
|
||||
} catch (SQLException e) {
|
||||
plugin.toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,6 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.data.KillData;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||
|
@ -5,8 +5,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||
|
@ -3,8 +3,6 @@ package main.java.com.djrapitops.plan.database.tables;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||
|
||||
|
@ -5,8 +5,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -150,7 +149,7 @@ public enum Html {
|
||||
String[] split = localeRow.split(" <> ");
|
||||
Html.valueOf(split[0]).setHtml(split[1]);
|
||||
} catch (IllegalArgumentException e) {
|
||||
getPlugin(Plan.class).logError("There is a miswritten line in locale on line " + localeRows.indexOf(localeRow));
|
||||
Log.error("There is a miswritten line in locale on line " + localeRows.indexOf(localeRow));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -10,7 +10,6 @@ import main.java.com.djrapitops.plan.data.cache.InspectCacheHandler;
|
||||
import main.java.com.djrapitops.plan.utilities.AnalysisUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -19,7 +18,7 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
public class TextUI {
|
||||
|
||||
public static String[] getInspectMessages(UUID uuid) {
|
||||
InspectCacheHandler inspectCache = getPlugin(Plan.class).getInspectCache();
|
||||
InspectCacheHandler inspectCache = Plan.getInstance().getInspectCache();
|
||||
if (!inspectCache.isCached(uuid)) {
|
||||
return new String[]{"Error has occurred, please retry."};
|
||||
}
|
||||
@ -44,7 +43,7 @@ public class TextUI {
|
||||
}
|
||||
|
||||
public static String[] getAnalysisMessages() {
|
||||
AnalysisCacheHandler analysisCache = getPlugin(Plan.class).getAnalysisCache();
|
||||
AnalysisCacheHandler analysisCache = Plan.getInstance().getAnalysisCache();
|
||||
if (!analysisCache.isCached()) {
|
||||
return new String[]{"Error has occurred, please retry."};
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package main.java.com.djrapitops.plan.ui.graphs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
|
||||
@ -23,17 +23,10 @@ public class PlayerActivityGraphCreator {
|
||||
public static String[] generateDataArray(List<SessionData> sessionData, long scale, int maxPlayers) {
|
||||
long now = new Date().toInstant().getEpochSecond() * (long) 1000;
|
||||
long nowMinusScale = now - scale;
|
||||
CopyOnWriteArrayList<Long> sessionStarts = new CopyOnWriteArrayList<>();
|
||||
CopyOnWriteArrayList<Long> sessionEnds = new CopyOnWriteArrayList<>();
|
||||
CopyOnWriteArrayList<SessionData> s = new CopyOnWriteArrayList(sessionData);
|
||||
s.parallelStream()
|
||||
.filter(session -> (session != null))
|
||||
.filter((session) -> (session.getSessionStart() > nowMinusScale || session.getSessionEnd() > nowMinusScale))
|
||||
.forEach((session) -> {
|
||||
sessionEnds.add(session.getSessionEnd());
|
||||
sessionStarts.add(session.getSessionStart());
|
||||
});
|
||||
List<Integer> playersOnline = new ArrayList<>();
|
||||
List<List<Long>> s = filterSessions(sessionData, nowMinusScale);
|
||||
List<Long> sessionStarts = s.get(0);
|
||||
List<Long> sessionEnds = s.get(1);
|
||||
List<Long> playersOnline = new ArrayList<>();
|
||||
List<String> labels = new ArrayList<>();
|
||||
|
||||
for (Long start : sessionStarts) {
|
||||
@ -41,27 +34,16 @@ public class PlayerActivityGraphCreator {
|
||||
sessionStarts.add(nowMinusScale);
|
||||
}
|
||||
}
|
||||
|
||||
int lastPValue = 0;
|
||||
int lastSavedPValue = -1;
|
||||
|
||||
long lastPValue = 0;
|
||||
long lastSavedPValue = -1;
|
||||
long lastSaveI = 0;
|
||||
for (long i = nowMinusScale; i <= now; i += 1000) {
|
||||
final long j = i;
|
||||
if (sessionStarts.contains(i)) {
|
||||
int amount = 0;
|
||||
amount = sessionStarts.parallelStream()
|
||||
.filter((start) -> (start == j))
|
||||
.map((item) -> 1)
|
||||
.reduce(amount, Integer::sum);
|
||||
lastPValue += amount;
|
||||
lastPValue += getCount(sessionStarts, i);
|
||||
}
|
||||
if (sessionEnds.contains(i)) {
|
||||
int amount = 0;
|
||||
amount = sessionEnds.parallelStream()
|
||||
.filter((end) -> (end == j))
|
||||
.map((item) -> 1)
|
||||
.reduce(amount, Integer::sum);
|
||||
lastPValue -= amount;
|
||||
lastPValue -= getCount(sessionEnds, i);
|
||||
}
|
||||
|
||||
if (lastSavedPValue != lastPValue || i - lastSaveI > (scale / (long) 75)) {
|
||||
@ -71,9 +53,36 @@ public class PlayerActivityGraphCreator {
|
||||
playersOnline.add(lastPValue);
|
||||
}
|
||||
}
|
||||
playersOnline.add(0);
|
||||
playersOnline.add(maxPlayers);
|
||||
playersOnline.add(0L);
|
||||
playersOnline.add((long) maxPlayers);
|
||||
return new String[]{playersOnline.toString(), labels.toString()};
|
||||
}
|
||||
|
||||
public static long getCount(List<Long> values, long lookFor) {
|
||||
return values.stream()
|
||||
.filter((start) -> (start == lookFor))
|
||||
.count();
|
||||
}
|
||||
|
||||
public static List<List<Long>> filterSessions(List<SessionData> sessionData, long nowMinusScale) {
|
||||
List<Long[]> values = sessionData.parallelStream()
|
||||
.filter(session -> (session != null))
|
||||
.filter((session) -> (session.getSessionStart() >= nowMinusScale || session.getSessionEnd() >= nowMinusScale))
|
||||
.map(session -> new Long[]{session.getSessionStart(), session.getSessionEnd()})
|
||||
.collect(Collectors.toList());
|
||||
List<Long> sessionStarts = new ArrayList<>();
|
||||
List<Long> sessionEnds = new ArrayList<>();
|
||||
for (Long[] startAndEnd : values) {
|
||||
sessionStarts.add(getSecond(startAndEnd[0]));
|
||||
sessionEnds.add(getSecond(startAndEnd[1]));
|
||||
}
|
||||
List<List<Long>> r = new ArrayList<>();
|
||||
r.add(sessionStarts);
|
||||
r.add(sessionEnds);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static long getSecond(long ms) {
|
||||
return ms - (ms % 1000);
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,9 @@ package main.java.com.djrapitops.plan.ui.tables;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.ui.Html;
|
||||
import main.java.com.djrapitops.plan.utilities.comparators.MapComparator;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -31,9 +30,8 @@ public class SortableCommandUseTableCreator {
|
||||
try {
|
||||
html += Html.TABLELINE_2.parse(values[1], values[0]);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
plugin.toLog("SortableCommandUseTableCreator", e);
|
||||
plugin.toLog("Cause: " + values[0] + " " + values[1]);
|
||||
Log.toLog("SortableCommandUseTableCreator", e);
|
||||
Log.toLog("Cause: " + values[0] + " " + values[1]);
|
||||
}
|
||||
}
|
||||
return html;
|
||||
|
@ -3,11 +3,10 @@ package main.java.com.djrapitops.plan.ui.webserver;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.ui.DataRequestHandler;
|
||||
import main.java.com.djrapitops.plan.utilities.UUIDFetcher;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -87,7 +86,7 @@ public class Response {
|
||||
+ "\r\n";
|
||||
output.write((htmlDef + dataHtml).getBytes());
|
||||
} catch (NullPointerException e) {
|
||||
getPlugin(Plan.class).toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
String errorMessage = "HTTP/1.1 404 Error\r\n"
|
||||
+ "Content-Type: text/html;\r\n"
|
||||
+ "Content-Length: 30\r\n"
|
||||
@ -116,7 +115,7 @@ public class Response {
|
||||
+ "<h1>404 Data was not found in cache</h1>";
|
||||
output.write(errorMessage.getBytes());
|
||||
} catch (Exception e) {
|
||||
getPlugin(Plan.class).toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import java.io.OutputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
@ -49,7 +50,7 @@ public class WebSocketServer {
|
||||
if (ENABLED) {
|
||||
return;
|
||||
}
|
||||
plugin.log(Phrase.WEBSERVER_INIT + "");
|
||||
Log.info(Phrase.WEBSERVER_INIT + "");
|
||||
try {
|
||||
//Setup server
|
||||
try {
|
||||
@ -85,7 +86,7 @@ public class WebSocketServer {
|
||||
|
||||
ENABLED = true;
|
||||
|
||||
plugin.log(Phrase.WEBSERVER_RUNNING.parse(server.getLocalPort() + ""));
|
||||
Log.info(Phrase.WEBSERVER_RUNNING.parse(server.getLocalPort() + ""));
|
||||
} catch (IllegalArgumentException | IllegalStateException e) {
|
||||
ENABLED = false;
|
||||
}
|
||||
@ -95,12 +96,12 @@ public class WebSocketServer {
|
||||
* Shuts down the server - Async thread is closed with shutdown boolean.
|
||||
*/
|
||||
public void stop() {
|
||||
plugin.log(Phrase.WEBSERVER_CLOSE + "");
|
||||
Log.info(Phrase.WEBSERVER_CLOSE + "");
|
||||
shutdown = true;
|
||||
try {
|
||||
server.close();
|
||||
} catch (IOException e) {
|
||||
plugin.toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class Analysis {
|
||||
.collect(Collectors.toList());
|
||||
return uuids;
|
||||
} catch (Exception e) {
|
||||
plugin.toLog(this.getClass().getName(), e);
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
||||
import java.util.Scanner;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -21,7 +20,7 @@ public class HtmlUtils {
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static String getHtmlStringFromResource(String fileName) throws FileNotFoundException {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
Plan plugin = Plan.getInstance();
|
||||
File localFile = new File(plugin.getDataFolder(), fileName);
|
||||
Scanner scanner = new Scanner(plugin.getResource(fileName));
|
||||
if (localFile.exists()) {
|
||||
@ -54,7 +53,7 @@ public class HtmlUtils {
|
||||
*/
|
||||
public static String getServerAnalysisUrl() {
|
||||
int port = Settings.WEBSERVER_PORT.getNumber();
|
||||
String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port;
|
||||
String ip = Plan.getInstance().getServer().getIp() + ":" + port;
|
||||
String securityCode = Settings.SECURITY_CODE.toString();
|
||||
boolean useAlternativeIP = Settings.SHOW_ALTERNATIVE_IP.isTrue();
|
||||
if (useAlternativeIP) {
|
||||
@ -71,7 +70,7 @@ public class HtmlUtils {
|
||||
*/
|
||||
public static String getInspectUrl(String playerName) {
|
||||
int port = Settings.WEBSERVER_PORT.getNumber();
|
||||
String ip = getPlugin(Plan.class).getServer().getIp() + ":" + port;
|
||||
String ip = Plan.getInstance().getServer().getIp() + ":" + port;
|
||||
String securityCode = Settings.SECURITY_CODE.toString();
|
||||
boolean useAlternativeIP = Settings.SHOW_ALTERNATIVE_IP.isTrue();
|
||||
if (useAlternativeIP) {
|
||||
|
@ -9,6 +9,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
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;
|
||||
import main.java.com.djrapitops.plan.data.cache.DBCallableProcessor;
|
||||
@ -18,7 +19,6 @@ import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -34,7 +34,7 @@ public class ManageUtils {
|
||||
* @return success?
|
||||
*/
|
||||
public static boolean backup(String dbName, Database copyFromDB) {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
Plan plugin = Plan.getInstance();
|
||||
Date now = new Date();
|
||||
SQLiteDB backupDB = new SQLiteDB(plugin,
|
||||
dbName + "-backup-" + now.toString().substring(4, 10).replaceAll(" ", "-").replaceAll(":", "-"));
|
||||
@ -86,12 +86,11 @@ public class ManageUtils {
|
||||
* @return uuids hashset as a Collection.
|
||||
*/
|
||||
public static Collection<UUID> getUUIDS(Database db) {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
final Set<UUID> uuids = new HashSet<>();
|
||||
try {
|
||||
uuids.addAll(db.getSavedUUIDs());
|
||||
} catch (SQLException e) {
|
||||
plugin.toLog("ManageUtils.getUUIDS", e);
|
||||
Log.toLog("ManageUtils.getUUIDS", e);
|
||||
}
|
||||
return uuids;
|
||||
}
|
||||
@ -106,7 +105,6 @@ public class ManageUtils {
|
||||
* @return success?
|
||||
*/
|
||||
public static boolean clearAndCopy(Database clearAndCopyToDB, Database copyFromDB, Collection<UUID> fromDBsavedUUIDs) {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
try {
|
||||
clearAndCopyToDB.removeAllData();
|
||||
List<UserData> allUserData = new ArrayList<>();
|
||||
@ -124,7 +122,7 @@ public class ManageUtils {
|
||||
clearAndCopyToDB.saveMultipleUserData(allUserData);
|
||||
clearAndCopyToDB.saveCommandUse(copyFromDB.getCommandUse());
|
||||
} catch (SQLException | NullPointerException e) {
|
||||
plugin.toLog("ManageUtils.move", e);
|
||||
Log.toLog("ManageUtils.move", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -8,6 +8,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.Set;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
@ -15,7 +16,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -30,12 +30,12 @@ public class MiscUtils {
|
||||
*/
|
||||
public static String checkVersion() {
|
||||
try {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
Plan plugin = Plan.getInstance();
|
||||
String cVersion = plugin.getDescription().getVersion();
|
||||
String gitVersion = getGitVersion();
|
||||
return checkVersion(cVersion, gitVersion);
|
||||
} catch (IOException | NumberFormatException e) {
|
||||
getPlugin(Plan.class).logError(Phrase.VERSION_CHECK_ERROR + "");
|
||||
Log.error(Phrase.VERSION_CHECK_ERROR + "");
|
||||
}
|
||||
return Phrase.VERSION_FAIL + "";
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import main.java.com.djrapitops.plan.ui.graphs.PlayerActivityGraphCreator;
|
||||
import main.java.com.djrapitops.plan.ui.tables.SortableKillsTableCreator;
|
||||
import main.java.com.djrapitops.plan.ui.tables.SortableSessionTableCreator;
|
||||
import org.bukkit.GameMode;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -57,7 +56,7 @@ public class PlaceholderUtils {
|
||||
replaceMap.put("%deaths%", data.getTotalDeaths() + "");
|
||||
replaceMap.put("%playerkills%", data.getTotalPlayerKills() + "");
|
||||
replaceMap.put("%mobkills%", data.getTotalMobKills() + "");
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
Plan plugin = Plan.getInstance();
|
||||
replaceMap.put("%version%", plugin.getDescription().getVersion());
|
||||
replaceMap.put("%planlite%", "");
|
||||
replaceMap.put("%sortabletable%", data.getSortablePlayersTable());
|
||||
@ -177,7 +176,7 @@ public class PlaceholderUtils {
|
||||
replaceMap.put("%sessionstable%", SortableSessionTableCreator.createSortedSessionDataTable10(data.getSessions()));
|
||||
replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(AnalysisUtils.average(AnalysisUtils.transformSessionDataToLengths(data.getSessions())) + ""));
|
||||
replaceMap.put("%killstable%", SortableKillsTableCreator.createSortedSessionDataTable10(data.getPlayerKills()));
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
Plan plugin = Plan.getInstance();
|
||||
replaceMap.put("%version%", plugin.getDescription().getVersion());
|
||||
replaceMap.put("%planlite%", "");
|
||||
String[] playersDataArray = PlayerActivityGraphCreator.generateDataArray(data.getSessions(), (long) 604800 * 1000, 2);
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: main.java.com.djrapitops.plan.Plan
|
||||
version: 3.0.0
|
||||
version: 3.0.1
|
||||
|
||||
softdepend:
|
||||
- OnTime
|
||||
|
@ -9,12 +9,10 @@ import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
@ -43,12 +41,6 @@ public class PhraseTest {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,15 +5,12 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
@ -39,11 +36,6 @@ public class SettingsTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,16 +6,13 @@
|
||||
package test.java.main.java.com.djrapitops.plan.data;
|
||||
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.api.Gender;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
@ -41,13 +38,6 @@ public class DemographicsDataTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,13 +22,11 @@ import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -59,13 +57,6 @@ public class UserDataTest {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
DemographicsData demData = new DemographicsData();
|
||||
test = new UserData(UUID.fromString("7f8149a0-b5a5-4fcd-80b5-6cff083a99f1"), 0, null, true, GameMode.CREATIVE, demData, "Testname", true);
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
@ -21,8 +20,6 @@ import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.easymock.EasyMock.anyString;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@ -30,7 +27,6 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
@ -112,23 +108,6 @@ public class DataCacheHandlerTest {
|
||||
}
|
||||
};
|
||||
when(plan.getDB()).thenReturn(db);
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
handler = new DataCacheHandler(plan) {
|
||||
@Override
|
||||
public void startAsyncPeriodicSaveTask() throws IllegalArgumentException, IllegalStateException {
|
||||
|
@ -6,18 +6,15 @@
|
||||
package test.java.main.java.com.djrapitops.plan.data.cache;
|
||||
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.cache.SessionCache;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -46,18 +43,6 @@ public class SessionCacheTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue(t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
test = new SessionCache();
|
||||
}
|
||||
|
||||
|
@ -5,17 +5,14 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data.cache.queue;
|
||||
|
||||
import java.io.File;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
@ -45,15 +42,6 @@ public class DataCacheClearQueueTest {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
File f = new File(plan.getDataFolder(), "Errors.txt");
|
||||
handler = new DataCacheHandler(plan) {
|
||||
@Override
|
||||
public boolean getCommandUseFromDb() {
|
||||
|
@ -23,13 +23,11 @@ import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -86,17 +84,6 @@ public class DataCacheGetQueueTest {
|
||||
}
|
||||
}
|
||||
};
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
File f = new File(plan.getDataFolder(), "Errors.txt");
|
||||
rows = 0;
|
||||
if (f.exists()) {
|
||||
|
@ -18,14 +18,11 @@ import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.InfoType;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -54,21 +51,7 @@ public class DataCacheProcessQueueTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
handler = new DataCacheHandler(plan) {
|
||||
handler = new DataCacheHandler(Plan.getInstance()) {
|
||||
@Override
|
||||
public boolean getCommandUseFromDb() {
|
||||
return true;
|
||||
|
@ -6,29 +6,22 @@
|
||||
package test.java.main.java.com.djrapitops.plan.data.cache.queue;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.cache.queue.DataCacheSaveQueue;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
import test.java.utils.TestInit;
|
||||
|
||||
/**
|
||||
|
@ -11,12 +11,10 @@ import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.ChatHandling;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -44,16 +42,6 @@ public class ChatHandlingTest {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,18 +5,15 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data.handling;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.GamemodeHandling;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -43,13 +40,6 @@ public class GamemodeHandlingTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,6 @@ import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@ -25,7 +24,6 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
@ -69,12 +67,6 @@ public class KillHandlingTest {
|
||||
}
|
||||
};
|
||||
when(plan.getDB()).thenReturn(db);
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,17 +7,14 @@ package test.java.main.java.com.djrapitops.plan.data.handling;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.LoginHandling;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -44,13 +41,6 @@ public class LoginHandlingTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,12 +10,10 @@ import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.LogoutHandling;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -43,13 +41,6 @@ public class LogoutHandlingTest {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,18 +5,15 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.api.Gender;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.ChatInfo;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -37,17 +34,6 @@ public class ChatInfoTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,17 +5,14 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.DeathInfo;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -42,13 +39,6 @@ public class DeathInfoTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,18 +5,15 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.GamemodeInfo;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -43,13 +40,6 @@ public class GamemodeInfoTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,17 +5,14 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.KickInfo;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -42,13 +39,6 @@ public class KickInfoTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,13 +16,11 @@ import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
@ -65,12 +63,6 @@ public class KillInfoTest {
|
||||
}
|
||||
};
|
||||
when(plan.getDB()).thenReturn(db);
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,12 +13,10 @@ import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.LoginInfo;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -46,12 +44,6 @@ public class LoginInfoTest {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,19 +5,16 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data.handling.info;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.LogoutInfo;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -44,14 +41,6 @@ public class LogoutInfoTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,12 +13,10 @@ import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.ReloadInfo;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -46,12 +44,6 @@ public class ReloadInfoTest {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,6 @@ import org.junit.After;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
@ -77,13 +76,7 @@ public class DatabaseTest {
|
||||
public void startConnectionPingTask(Plan plugin) {
|
||||
|
||||
}
|
||||
};
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
for (int i = 0; i < 40; i++) {
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
}
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
};
|
||||
File f = new File(plan.getDataFolder(), "Errors.txt");
|
||||
rows = 0;
|
||||
if (f.exists()) {
|
||||
|
@ -9,16 +9,13 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.utilities.AnalysisUtils;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
@ -44,13 +41,6 @@ public class AnalysisUtilsTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,12 +10,10 @@ import java.util.HashMap;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.utilities.HtmlUtils;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
@ -41,14 +39,6 @@ public class HtmlUtilsTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
// PowerMock.verify(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,6 @@ package test.java.main.java.com.djrapitops.plan.utilities;
|
||||
|
||||
import java.util.Set;
|
||||
import main.java.com.djrapitops.plan.Phrase;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -45,13 +44,6 @@ public class MiscUtilsTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
|
||||
PowerMock.mockStatic(Bukkit.class);
|
||||
OfflinePlayer op = MockUtils.mockPlayer();
|
||||
OfflinePlayer op2 = MockUtils.mockPlayer2();
|
||||
|
@ -6,7 +6,6 @@
|
||||
package test.java.main.java.com.djrapitops.plan.utilities;
|
||||
|
||||
import java.util.Date;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.DemographicsData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.utilities.NewPlayerCreator;
|
||||
@ -14,13 +13,11 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.easymock.EasyMock;
|
||||
import org.junit.After;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.api.easymock.PowerMock;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.MockUtils;
|
||||
@ -47,15 +44,6 @@ public class NewPlayerCreatorTest {
|
||||
public void setUp() {
|
||||
TestInit t = new TestInit();
|
||||
assertTrue("Not set up", t.setUp());
|
||||
Plan plan = t.getPlanMock();
|
||||
PowerMock.mockStatic(JavaPlugin.class);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
EasyMock.expect(JavaPlugin.getPlugin(Plan.class)).andReturn(plan);
|
||||
PowerMock.replay(JavaPlugin.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,6 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.logging.Logger;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
Loading…
Reference in New Issue
Block a user