switching from double to strings and adding settings file
This commit is contained in:
parent
d0d6294720
commit
65c93d3018
@ -21,8 +21,7 @@ public class MapBoardDTO {
|
||||
private String name;
|
||||
private String avatar;
|
||||
private int mapPoint;
|
||||
private int mapTimeMinutes;
|
||||
private float mapTimeSeconds;
|
||||
private String mapTime;
|
||||
private int position;
|
||||
private List<String> badgesUrls = new ArrayList();
|
||||
|
||||
@ -34,8 +33,7 @@ public class MapBoardDTO {
|
||||
this.name = name;
|
||||
this.avatar = avatar;
|
||||
this.mapPoint = mapvalue.getMapPoints();
|
||||
this.mapTimeMinutes = (int) Math.floor(mapvalue.getTime());
|
||||
this.mapTimeSeconds = (float) (mapvalue.getTime() - Math.floor(mapvalue.getTime())) * 100;
|
||||
this.mapTime = mapvalue.getTime();
|
||||
this.position = mapvalue.getPosition();
|
||||
|
||||
}
|
||||
@ -71,22 +69,16 @@ public class MapBoardDTO {
|
||||
this.mapPoint = mapPoint;
|
||||
}
|
||||
|
||||
public int getMapTimeMinutes() {
|
||||
return mapTimeMinutes;
|
||||
public String getMapTime() {
|
||||
return mapTime;
|
||||
}
|
||||
|
||||
public void setMapTimeMinutes(int mapTimeMinutes) {
|
||||
this.mapTimeMinutes = mapTimeMinutes;
|
||||
}
|
||||
|
||||
public float getMapTimeSeconds() {
|
||||
return mapTimeSeconds;
|
||||
}
|
||||
|
||||
public void setMapTimeSeconds(float mapTimeSeconds) {
|
||||
this.mapTimeSeconds = mapTimeSeconds;
|
||||
public void setMapTime(String mapTime) {
|
||||
this.mapTime = mapTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class MapValuesDTO {
|
||||
|
||||
private int position;
|
||||
private String playerSteamID;
|
||||
private float time;
|
||||
private String time;
|
||||
private int mapPoints;
|
||||
|
||||
public int getPosition() {
|
||||
@ -34,11 +34,11 @@ public class MapValuesDTO {
|
||||
this.playerSteamID = playerSteamID;
|
||||
}
|
||||
|
||||
public float getTime() {
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(float time) {
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,7 @@ public class PlayerMapBoardDTO {
|
||||
private String mapname;
|
||||
private int mapstage;
|
||||
private int mapPoint;
|
||||
private int mapTimeMinutes;
|
||||
private float mapTimeSeconds;
|
||||
private String mapTime;
|
||||
private int position;
|
||||
|
||||
public PlayerMapBoardDTO() {
|
||||
@ -38,8 +37,7 @@ public class PlayerMapBoardDTO {
|
||||
public void addMapValues(MapValues mapvalue, String mapName, int stage) {
|
||||
this.steamID = mapvalue.getPlayerSteamID();
|
||||
this.mapPoint = mapvalue.getMapPoints();
|
||||
this.mapTimeMinutes = (int) Math.floor(mapvalue.getTime());
|
||||
this.mapTimeSeconds = (float) (mapvalue.getTime() - Math.floor(mapvalue.getTime())) * 100;
|
||||
this.mapTime = mapvalue.getTime();
|
||||
this.position = mapvalue.getPosition();
|
||||
this.mapname = mapName;
|
||||
this.mapstage = stage;
|
||||
|
@ -22,9 +22,9 @@ public class DBCPDataSource {
|
||||
static {
|
||||
try {
|
||||
ds.setDriver(new com.mysql.cj.jdbc.Driver());
|
||||
ds.setUrl("jdbc:mysql://151.80.230.149:3306/unloze_racetimer_css?useLegacyDatetimeCode=false&serverTimezone=UTC");
|
||||
ds.setUsername("unloze_racetimer_css");
|
||||
ds.setPassword("dfhasFEb234dfsnFEEJSfFEJdfap");
|
||||
ds.setUrl(settings.racetimerURL);
|
||||
ds.setUsername(settings.racetimerUser);
|
||||
ds.setPassword(settings.racetimerPassword);
|
||||
ds.setMaxTotal(-1);
|
||||
ds.setMinIdle(5);
|
||||
ds.setMaxIdle(-1);
|
||||
|
@ -22,9 +22,9 @@ public class DBCPDataSource2 {
|
||||
static {
|
||||
try {
|
||||
ds.setDriver(new com.mysql.cj.jdbc.Driver());
|
||||
ds.setUrl("jdbc:mysql://151.80.230.149:3306/xenforo?useLegacyDatetimeCode=false&serverTimezone=UTC");
|
||||
ds.setUsername("XenforoWebTimer");
|
||||
ds.setPassword("FNF#)(EFHFSNj23n4nfdsfbFE");
|
||||
ds.setUrl(settings.forumURL);
|
||||
ds.setUsername(settings.forumUser);
|
||||
ds.setPassword(settings.forumPassword);
|
||||
ds.setMaxTotal(-1);
|
||||
ds.setMinIdle(5);
|
||||
ds.setMaxIdle(-1);
|
||||
|
@ -41,8 +41,8 @@ public class DataMapperCalls {
|
||||
//System.out.println("player dataMapper: " + player.getName() + "\nsteamid: " + player.getSteamID());
|
||||
int i = 3;
|
||||
while (i < fetchSize) {
|
||||
double specificDouble = result.getDouble(i);
|
||||
if (specificDouble > 0.000) {
|
||||
String specificTime = result.getString(i);
|
||||
if (!specificTime.equals("0.000")) {
|
||||
String columnLabel = result.getMetaData().getColumnLabel(i);
|
||||
if (!allMapBoards.keySet().contains(columnLabel)) {
|
||||
allMapBoards.put(columnLabel, new MapBoard(columnLabel));
|
||||
@ -50,7 +50,7 @@ public class DataMapperCalls {
|
||||
timesCounter++;
|
||||
MapValues mapValue = new MapValues();
|
||||
mapValue.setPlayerSteamID(player.getSteamID());
|
||||
mapValue.setTime((float) specificDouble);
|
||||
mapValue.setTime(specificTime);
|
||||
allMapBoards.get(columnLabel).getMapvalues().add(mapValue);
|
||||
}
|
||||
i++;
|
||||
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package DataMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Christian
|
||||
*/
|
||||
public class settings {
|
||||
static String racetimerURL = "jdbc:mysql://localhost:3306/unloze_racetimer_css?useLegacyDatetimeCode=false&serverTimezone=UTC";
|
||||
static String racetimerUser = "unloze_racetimer_css";
|
||||
static String racetimerPassword = "foj342ronfeanfu32ruhfbb324";
|
||||
|
||||
static String forumURL = "jdbc:mysql://51.15.159.31:3306/unloze_forum?useLegacyDatetimeCode=false&serverTimezone=UTC";
|
||||
static String forumUser = "unloze_webtimer";
|
||||
static String forumPassword = "fn124FNFobn324FBEFn234";
|
||||
}
|
@ -40,7 +40,7 @@ public class MapValues implements Serializable {
|
||||
private String playerSteamID;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
private float time;
|
||||
private String time;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
private int mapPoints;
|
||||
@ -75,12 +75,12 @@ public class MapValues implements Serializable {
|
||||
this.playerSteamID = steamID;
|
||||
}
|
||||
|
||||
public float getTime() {
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(float time) {
|
||||
this.time = time;
|
||||
|
||||
public void setTime(String specificTime) {
|
||||
this.time = specificTime;
|
||||
}
|
||||
|
||||
public int getMapPoints() {
|
||||
@ -123,5 +123,6 @@ public class MapValues implements Serializable {
|
||||
public String toString() {
|
||||
return "entity.MapValues[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -274,28 +274,28 @@ public class Facade {
|
||||
String bannerURL = "";
|
||||
if (bannerID == 2) {
|
||||
bannerName = "User";
|
||||
bannerURL = "https://unloze.com/images/badges/User.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Member_Badge.png";
|
||||
} else if (bannerID == 6) {
|
||||
bannerName = "Mapper";
|
||||
bannerURL = "https://unloze.com/images/badges/Mapper.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Mapper_Badge.png";
|
||||
} else if (bannerID == 7) {
|
||||
bannerName = "Admin";
|
||||
bannerURL = "https://unloze.com/images/badges/Admin.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Admin_Badge.png";
|
||||
} else if (bannerID == 8) {
|
||||
bannerName = "Technical Staff";
|
||||
bannerURL = "https://unloze.com/images/badges/Tech-Staff.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Senior-Developer_Badge.png";
|
||||
} else if (bannerID == 10) {
|
||||
bannerName = "Leader";
|
||||
bannerURL = "https://unloze.com/images/badges/Leader.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Leader_Badge.png";
|
||||
} else if (bannerID == 11) {
|
||||
bannerName = "Global Admin";
|
||||
bannerURL = "https://unloze.com/images/badges/Global-Admin.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Senior-Admin_Badge.png";
|
||||
} else if (bannerID == 12) {
|
||||
bannerName = "VIP";
|
||||
bannerURL = "https://unloze.com/images/badges/VIP.png";
|
||||
bannerURL = "https://unloze.com/images/badges/VIP_Badge.png";
|
||||
} else if (bannerID == 13) {
|
||||
bannerName = "Trial Admin";
|
||||
bannerURL = "https://unloze.com/images/badges/Trial_Admin.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Junior-Admin_Badge.png";
|
||||
} else if (bannerID == 15) {
|
||||
bannerName = "Event Winner";
|
||||
bannerURL = "https://unloze.com/images/badges/Event-Winner.png";
|
||||
@ -304,7 +304,7 @@ public class Facade {
|
||||
bannerURL = "https://unloze.com/images/badges/Discord-Manager.png";
|
||||
} else if (bannerID == 21) {
|
||||
bannerName = "Retired Admin";
|
||||
bannerURL = "https://unloze.com/images/badges/Retired-Admin.png";
|
||||
bannerURL = "https://unloze.com/images/badges/Retired-Admin_Badge.png";
|
||||
} else if (bannerID == 25) {
|
||||
bannerName = "Event Manager";
|
||||
bannerURL = "https://unloze.com/images/badges/Event-Manager.png";
|
||||
@ -400,6 +400,7 @@ public class Facade {
|
||||
for (MapBoard mapboard : mapboards) {
|
||||
//System.out.println("mapName: " + mapboard.getMapName());
|
||||
List<MapValues> mapvalues = new ArrayList(mapboard.getMapvalues());
|
||||
|
||||
mapvalues.sort(Comparator.comparing(MapValues::getTime));
|
||||
mapBoardCache.get(mapboard.getMapName()).setMapvalues(mapvalues);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user