Browse Source

фиксы

-ип в бд давался вместе с портом, что не давало в бд запись сделать
-зачемто я кастовал лонг в стринг потом опять в лонг, дядя ты тупой??
-еще забыл перенос строки сделать
master
gsd 2 years ago
parent
commit
f687af3d6a
  1. 2
      src/main/java/app/entities/a2s/external/ExternalValveClient.java
  2. 8
      src/main/java/app/entities/server/PlayOn.java
  3. 6
      src/main/java/app/services/db/FreeVIPService.java

2
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<>();
}
}

8
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;
}
}
}

6
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;
}

Loading…
Cancel
Save