@ -56,11 +56,15 @@ public class ReportService {
restTemplate = new RestTemplate ( ) ;
}
private int addReport ( PlayerProfile current_user , PlayerProfile reported_user , String text , ReportType reportType ) {
private long addReport ( PlayerProfile current_user , PlayerProfile reported_user , String text , ReportType reportType ) {
PlayerOnServer current_player = ( PlayerOnServer ) statsService . searchPlayer ( current_user ) ;
PlayerOnServer reported_player = ( PlayerOnServer ) statsService . searchPlayer ( reported_user ) ;
return jdbcTemplate_rw . update ( "INSERT INTO user_reports (a_nickname, a_steam2, a_permition, a_kills, a_deads, a_seconds, " +
long utime = Instant . now ( ) . getEpochSecond ( ) ;
int player_count = stats . getServers ( ) . get ( reported_user = = null ? current_user . getPlay_on ( ) . getServer_id ( ) : reported_user . getPlay_on ( ) . getServer_id ( ) ) . getPlayer_count ( ) ;
String server_id = reported_user = = null ? current_user . getPlay_on ( ) . getServer_id ( ) : reported_user . getPlay_on ( ) . getServer_id ( ) ;
jdbcTemplate_rw . update ( "INSERT INTO user_reports (a_nickname, a_steam2, a_permition, a_kills, a_deads, a_seconds, " +
"r_nickname, r_steam2, r_permition, r_kills, r_deads, r_seconds, " +
"reasons, utime, srv, online, type) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ,
current_player = = null ? current_user . getSteam_data ( ) . getNickname ( ) : current_player . getName ( ) , current_user . getSteamids ( ) . steam2 , Permition2Prefix ( current_user . getPermition ( ) ) . ordinal ( ) ,
@ -73,9 +77,11 @@ public class ReportService {
reported_player = = null ? null : reported_player . getDeads ( ) ,
reported_player = = null ? null : reported_player . getDuration_seconds ( ) ,
text , Instant . now ( ) . getEpochSecond ( ) , reported_user = = null ? current_user . getPlay_on ( ) . getServer_id ( ) : reported_user . getPlay_on ( ) . getServer_id ( ) ,
stats . getServers ( ) . get ( reported_user = = null ? current_user . getPlay_on ( ) . getServer_id ( ) : reported_user . getPlay_on ( ) . getServer_id ( ) ) . getP layer_count( ) ,
text , utime , server_id ,
p layer_count,
reportType . ordinal ( ) ) ;
return jdbcTemplate_rw . query ( "SELECT id FROM user_reports WHERE utime = ? AND srv LIKE ? AND online = ?" , new Object [ ] { utime , server_id , player_count } , ( rs , n ) - > rs . getLong ( "id" ) ) . get ( 0 ) ;
}
public int addReportAction ( int report_id , String action ) {
@ -110,7 +116,7 @@ public class ReportService {
( Instant . now ( ) . getEpochSecond ( ) - userKD . get ( current_user . getSteamids ( ) . steam64 ) ) < kd ) {
return ( Instant . now ( ) . getEpochSecond ( ) - userKD . get ( current_user . getSteamids ( ) . steam64 ) ) - kd ;
}
int report_id = addReport ( current_user , reported_user , text , reportType ) ;
long report_id = addReport ( current_user , reported_user , text , reportType ) ;
long res = createReportToDiscord ( current_user , reported_user , text , report_id ) ;
if ( res = = 0 ) return 0 ;
@ -118,7 +124,7 @@ public class ReportService {
return res ;
}
case IN_GAME - > {
int report_id = addReport ( current_user , reported_user , text , reportType ) ;
long report_id = addReport ( current_user , reported_user , text , reportType ) ;
return createReportToDiscord ( current_user , reported_user , text , report_id ) ;
}
default - > {
@ -127,7 +133,7 @@ public class ReportService {
}
}
private long createReportToDiscord ( PlayerProfile current_user , PlayerProfile reported_user , String text , int report_id ) {
private long createReportToDiscord ( PlayerProfile current_user , PlayerProfile reported_user , String text , long report_id ) {
PlayerOnServer current_player = ( PlayerOnServer ) statsService . searchPlayer ( current_user ) ;
String author = "%s | %s%s | %s" . formatted (
current_player = = null ? current_user . getSteam_data ( ) . getNickname ( ) : current_player . getName ( ) ,