Fixed Absolute Path detection

Fixed ArrayOutOfBounds
Fixed Player page
Typo fix
This commit is contained in:
Rsl1122 2017-07-31 22:59:18 +03:00
parent 681bfa2b9b
commit eb4ee0f68c
5 changed files with 49 additions and 33 deletions

View File

@ -30,6 +30,6 @@ public class PlanWorldChangeListener implements Listener {
}
UUID uuid = p.getUniqueId();
long time = MiscUtils.getTime();
handler.addToPool(new PlaytimeDependentInfo(uuid, InfoType.GM, time, p.getGameMode().name(), p.getWorld().getName()));
handler.addToPool(new PlaytimeDependentInfo(uuid, InfoType.WORLD, time, p.getGameMode().name(), p.getWorld().getName()));
}
}

View File

@ -344,7 +344,11 @@ public abstract class SQLDB extends Database {
Map<String, Long> gmTimes = gmTimesTable.getGMTimes(userId);
data.getGmTimes().setTimes(gmTimes);
Map<String, Long> worldTimes = worldTimesTable.getWorldTimes(userId);
data.getWorldTimes().setTimes(worldTimes);
WorldTimes worldT = data.getWorldTimes();
worldT.setTimes(worldTimes);
if (worldT.getLastStateChange() == 0) {
worldT.setLastStateChange(data.getPlayTime());
}
List<SessionData> sessions = sessionsTable.getSessionData(userId);
data.addSessions(sessions);
@ -394,13 +398,19 @@ public abstract class SQLDB extends Database {
UUID uuid = uData.getUuid();
Integer id = userIds.get(uuid);
uData.addIpAddresses(ipList.get(id));
List<String> nickNames = nicknames.get(id);
uData.addNicknames(nickNames);
uData.setLastNick(nickNames.get(nickNames.size()-1));
List<String> userNicks = nicknames.get(id);
uData.addNicknames(userNicks);
if (!userNicks.isEmpty()) {
uData.setLastNick(userNicks.get(userNicks.size() - 1));
}
uData.addSessions(sessionData.get(id));
uData.setPlayerKills(playerKills.get(id));
uData.getGmTimes().setTimes(gmTimes.get(id));
uData.getWorldTimes().setTimes(worldTimes.get(id));
WorldTimes worldT = uData.getWorldTimes();
worldT.setTimes(worldTimes.get(id));
if (worldT.getLastStateChange() == 0) {
worldT.setLastStateChange(uData.getPlayTime());
}
}
Benchmark.stop("Database: Get UserData for " + uuidsCol.size());

View File

@ -20,6 +20,7 @@ import javax.net.ssl.*;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.URI;
import java.nio.file.Paths;
import java.security.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
@ -169,7 +170,7 @@ public class WebServer {
private boolean startHttpsServer() throws IOException {
String keyStorePath = Settings.WEBSERVER_CERTIFICATE_PATH.toString();
if (!keyStorePath.contains(":")) {
if (!Paths.get(keyStorePath).isAbsolute()) {
keyStorePath = plugin.getDataFolder() + keyStorePath;
}
char[] storepass = Settings.WEBSERVER_CERTIFICATE_STOREPASS.toString().toCharArray();

View File

@ -13,6 +13,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.List;
@ -34,7 +35,7 @@ public class ExportUtility {
*/
public static File getFolder() {
String path = Settings.ANALYSIS_EXPORT_PATH.toString();
if (path.contains(":")) {
if (Paths.get(path).isAbsolute()) {
File folder = new File(path);
if (folder.exists()
&& folder.isDirectory()) {

View File

@ -412,7 +412,7 @@
<div class="headerbox">
<div class="header-icon">
<div class="header-label"><i class="fa fa-crosshairs" aria-hidden="true"></i><span
class="header-text"> Last 10 Kills</span></div>
class="header-text"> Last 25 Kills</span></div>
</div>
<div class="infobox" style="float: right;">
<div class="info-icon">
@ -490,6 +490,33 @@
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script>
function formatTime(seconds) {
var out = "";
seconds = Math.floor(seconds / 1000);
var dd = Math.floor(seconds / 86400);
seconds -= (dd * 86400);
var dh = Math.floor(seconds / 3600);
seconds -= (dh * 3600);
var dm = Math.floor(seconds / 60);
seconds -= (dm * 60);
seconds = Math.floor(seconds);
if (dd != 0) {
out += dd.toString() + "d ";
}
if (dh != 0) {
out += dh.toString() + "h ";
}
if (dm != 0) {
out += dm.toString() + "m ";
}
out += seconds.toString() + "s ";
return out;
}
var playersOnlineSeries = {
name: 'Online',
data: %playersonlineseries%,
@ -753,32 +780,9 @@
function countUpTimer() {
var now = new Date();
var begin = new Date(%refreshlong%);
var out = "";
var seconds = now.getTime() - begin.getTime();
seconds = Math.floor(seconds / 1000);
var dd = Math.floor(seconds / 86400);
seconds -= (dd * 86400);
var dh = Math.floor(seconds / 3600);
seconds -= (dh * 3600);
var dm = Math.floor(seconds / 60);
seconds -= (dm * 60);
seconds = Math.floor(seconds);
if (dd != 0) {
out += dd.toString() + "d ";
}
if (dh != 0) {
out += dh.toString() + "h ";
}
if (dm != 0) {
out += dm.toString() + "m ";
}
out += seconds.toString() + "s ";
var out = formatTime(seconds);
document.getElementById('divTime').innerHTML = out;
setTimeout('countUpTimer()', 1000);