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