diff --git a/src/main/java/app/entities/a2s/external/ExternalValveClient.java b/src/main/java/app/entities/a2s/external/ExternalValveClient.java index 4c0cdad..25acbae 100644 --- a/src/main/java/app/entities/a2s/external/ExternalValveClient.java +++ b/src/main/java/app/entities/a2s/external/ExternalValveClient.java @@ -62,7 +62,7 @@ public abstract class ExternalValveClient { try { return new ArrayList<>(Arrays.asList(restTemplate.postForEntity("%s/api/players".formatted(gateway), request, RCONPlayer[].class).getBody())); } catch (Exception err) { - System.out.printf("Cannot get rcon players from %s", request.getServer()); + System.out.printf("Cannot get rcon players from %s\n", request.getServer()); return new ArrayList<>(); } } diff --git a/src/main/java/app/entities/server/PlayOn.java b/src/main/java/app/entities/server/PlayOn.java index 8900dd1..d9d8ba9 100644 --- a/src/main/java/app/entities/server/PlayOn.java +++ b/src/main/java/app/entities/server/PlayOn.java @@ -10,4 +10,12 @@ public class PlayOn { int player_id; String ip; String name; + + public String getIp() { + if (ip.contains(":")){ + return ip.split(":",1)[0]; + } else { + return ip; + } + } } diff --git a/src/main/java/app/services/db/FreeVIPService.java b/src/main/java/app/services/db/FreeVIPService.java index d0a2457..3407e01 100644 --- a/src/main/java/app/services/db/FreeVIPService.java +++ b/src/main/java/app/services/db/FreeVIPService.java @@ -52,7 +52,7 @@ public class FreeVIPService{ public Long getLastGivedFreeVIP(SteamID steamID) { return (Long) entityManager.createNativeQuery("SELECT UNIX_TIMESTAMP(`date`) as u_time FROM free_vip WHERE steam3 LIKE ?1 ORDER BY `date` DESC") .setParameter(1, steamID.steam3) - .getResultStream().map(u_time -> Long.valueOf((String) u_time)).findFirst().orElse(0L); + .getResultStream().findFirst().orElse(0L); } public Long getLastGivedFreeVIP(SocialAuth socialAuth) { @@ -62,11 +62,11 @@ public class FreeVIPService{ else if (socialAuth.getVk_id() != 0) { return (Long) entityManager.createNativeQuery("SELECT UNIX_TIMESTAMP(`date`) as u_time FROM free_vip WHERE vk_id = ?1 ORDER BY `date` DESC") .setParameter(1, socialAuth.getVk_id()) - .getResultStream().map(u_time -> Long.valueOf((String) u_time)).findFirst().orElse(0L); + .getResultStream().findFirst().orElse(0L); } else if (socialAuth.getDiscord_id() != 0) { return (Long) entityManager.createNativeQuery("SELECT UNIX_TIMESTAMP(`date`) as u_time FROM free_vip WHERE discord_id = ?1 ORDER BY `date` DESC") .setParameter(1, socialAuth.getDiscord_id()) - .getResultStream().map(u_time -> Long.valueOf((String) u_time)).findFirst().orElse(0L); + .getResultStream().findFirst().orElse(0L); } else { return 0L; }