You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -275,4 +275,36 @@ class RconService
|
||||
{
|
||||
$this->closeConnection();
|
||||
}
|
||||
|
||||
public function sendSafelyFromDashboard(string $action, array $args, string $errorMessage): void
|
||||
{
|
||||
try {
|
||||
switch ($action) {
|
||||
case 'sendBadge':
|
||||
/** @var \App\Models\User $user */
|
||||
$user = $args[0];
|
||||
/** @var string $badge */
|
||||
$badge = (string) ($args[1] ?? '');
|
||||
$this->giveBadge($user, $badge);
|
||||
break;
|
||||
case 'removeBadge':
|
||||
// No direct RCON command defined for removing badges; use alert for now
|
||||
/** @var \App\Models\User $user */
|
||||
$user = $args[0];
|
||||
/** @var string $badge */
|
||||
$badge = (string) ($args[1] ?? '');
|
||||
$this->alertUser($user, sprintf('Badge %s removed.', $badge));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
\Filament\Notifications\Notification::make()
|
||||
->danger()
|
||||
->title('RCON Error')
|
||||
->body($errorMessage)
|
||||
->persistent()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user