Upload via Git Manager GUI
This commit is contained in:
@@ -492,6 +492,8 @@ function mcph_sync_from_statusapi() {
|
||||
'last_seen' => current_time( 'mysql' ),
|
||||
'is_online' => 1,
|
||||
'playtime_seconds' => $playtime,
|
||||
'kills' => $kills,
|
||||
'deaths' => $deaths,
|
||||
'balance' => $balance,
|
||||
'is_bedrock' => $is_bedrock,
|
||||
'joins' => $joins,
|
||||
@@ -499,7 +501,8 @@ function mcph_sync_from_statusapi() {
|
||||
'mutes' => $mutes,
|
||||
'warns' => $warns
|
||||
);
|
||||
$update_format = array( '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d' );
|
||||
// FIX BUG-2: kills/deaths im Fallback-UPDATE mitgespeichert
|
||||
$update_format = array( '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d' );
|
||||
|
||||
if ( ! empty( $prefix ) ) {
|
||||
$update_data['prefix'] = $prefix;
|
||||
@@ -512,11 +515,12 @@ function mcph_sync_from_statusapi() {
|
||||
|
||||
// Zeitkonvertierung
|
||||
$last_seen_time = isset( $p->last_seen ) ? intval( $p->last_seen ) : time();
|
||||
$last_seen_mysql = date( 'Y-m-d H:i:s', $last_seen_time );
|
||||
// FIX BUG-3: wp_date() statt date() nutzt WordPress-Timezone (konsistent mit current_time())
|
||||
$last_seen_mysql = wp_date( 'Y-m-d H:i:s', $last_seen_time );
|
||||
|
||||
$first_seen_mysql = current_time('mysql');
|
||||
if ( isset( $p->first_seen ) && ! $exists ) {
|
||||
$first_seen_mysql = date( 'Y-m-d H:i:s', intval( $p->first_seen ) );
|
||||
$first_seen_mysql = wp_date( 'Y-m-d H:i:s', intval( $p->first_seen ) );
|
||||
}
|
||||
|
||||
if ( $exists ) {
|
||||
@@ -525,6 +529,8 @@ function mcph_sync_from_statusapi() {
|
||||
'last_seen' => $last_seen_mysql,
|
||||
'is_online' => 1,
|
||||
'playtime_seconds' => $playtime,
|
||||
'kills' => $kills,
|
||||
'deaths' => $deaths,
|
||||
'balance' => $balance,
|
||||
'is_bedrock' => $is_bedrock,
|
||||
'joins' => $joins,
|
||||
@@ -532,7 +538,8 @@ function mcph_sync_from_statusapi() {
|
||||
'mutes' => $mutes,
|
||||
'warns' => $warns
|
||||
);
|
||||
$update_format = array( '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d' );
|
||||
// FIX BUG-2: kills/deaths werden jetzt in DB gespeichert
|
||||
$update_format = array( '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d' );
|
||||
|
||||
if ( ! empty( $prefix ) ) {
|
||||
$update_data['prefix'] = $prefix;
|
||||
@@ -540,6 +547,7 @@ function mcph_sync_from_statusapi() {
|
||||
}
|
||||
$wpdb->update( $table_name, $update_data, array( 'uuid' => $uuid ), $update_format, array( '%s' ) );
|
||||
} else {
|
||||
// FIX BUG-2: kills/deaths im INSERT mitgespeichert
|
||||
$wpdb->insert( $table_name, array(
|
||||
'uuid' => $uuid,
|
||||
'username' => $name,
|
||||
@@ -548,13 +556,15 @@ function mcph_sync_from_statusapi() {
|
||||
'last_seen' => $last_seen_mysql,
|
||||
'is_online' => 1,
|
||||
'playtime_seconds' => $playtime,
|
||||
'kills' => $kills,
|
||||
'deaths' => $deaths,
|
||||
'balance' => $balance,
|
||||
'is_bedrock' => $is_bedrock,
|
||||
'joins' => $joins,
|
||||
'bans' => $bans,
|
||||
'mutes' => $mutes,
|
||||
'warns' => $warns
|
||||
), array( '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d' ) );
|
||||
), array( '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -681,9 +691,24 @@ function mcph_ajax_player_profile() {
|
||||
}
|
||||
$is_online = isset( $live_uuids[ $player->uuid ] );
|
||||
|
||||
// Live-Daten bevorzugen, falls verfügbar.
|
||||
// FIX BUG-4: Live-Daten für Online-Spieler bevorzugen (Playtime, Kills, Deaths, Balance).
|
||||
if ( $matched_live_player ) {
|
||||
$is_bedrock = (bool) mcph_detect_bedrock_player( $matched_live_player, $player->uuid, $player->username );
|
||||
// Live-Playtime: enthält laufende Session, immer aktueller als DB-Wert
|
||||
if ( isset( $matched_live_player->playtime ) ) {
|
||||
$live_playtime = intval( $matched_live_player->playtime );
|
||||
if ( $live_playtime >= intval( $player->playtime_seconds ) ) {
|
||||
$player->playtime_seconds = $live_playtime;
|
||||
}
|
||||
}
|
||||
// Live-Kills/Deaths
|
||||
if ( isset( $matched_live_player->kills ) ) {
|
||||
$player->kills = intval( $matched_live_player->kills );
|
||||
}
|
||||
if ( isset( $matched_live_player->deaths ) ) {
|
||||
$player->deaths = intval( $matched_live_player->deaths );
|
||||
}
|
||||
// Live-Balance
|
||||
if ( isset( $matched_live_player->economy ) && is_object( $matched_live_player->economy ) && isset( $matched_live_player->economy->balance ) ) {
|
||||
$balance_value = floatval( $matched_live_player->economy->balance );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user