id) { throw ValidationException::withMessages([ 'target_player_id' => 'Du kannst dich nicht selbst abwerfen.', ]); } $targetExists = $room->players() ->whereKey($targetPlayerId) ->exists(); if (! $targetExists) { throw ValidationException::withMessages([ 'target_player_id' => 'Dieser Spieler sitzt nicht an diesem Tisch.', ]); } $rateLimitKey = "room-emote:{$room->id}:{$player->id}"; abort_if( RateLimiter::tooManyAttempts($rateLimitKey, 10), 429, 'Bitte warte kurz, bevor du erneut wirfst.', ); RateLimiter::hit($rateLimitKey, 10); $chargeLevel = match (true) { $chargePercentage >= 300 => 3, $chargePercentage >= 200 => 2, $chargePercentage >= 100 => 1, default => 0, }; PaperBallThrown::dispatch( Str::uuid()->toString(), $room->id, $player->id, $targetPlayerId, $chargeLevel, ); } }