Check age when joining 18+ servers

This commit is contained in:
Terncode committed 2026-11-18 18:22:44 +01:00
1 parent a0bb9b2fbb
commit 661dc4e654
1 file changed
+6 -1
+6 -1
View File
@@ -4,7 +4,8 @@ import { UserError } from '../userError';
import { InternalGameServerState } from '../../common/adminInterfaces';
import { JoinResponse } from '../../common/interfaces';
import { meetsRequirement } from '../../common/accountUtils';
import { supporterLevel } from '../../common/adminUtils';
import { supporterLevel, getAge } from '../../common/adminUtils';
import { MIN_ADULT_AGE } from '../../common/constants';
import { isServerOffline } from '../serverUtils';
import { getAccountAlertMessage } from '../accountUtils';
@@ -63,6 +64,10 @@ export const createJoinGame =
throw new UserError('Server is restricted');
}
if (server.state.alert === '18+' && !(account.birthdate && getAge(account.birthdate) >= MIN_ADULT_AGE)) {
throw new UserError('Server is restricted');
}
if (!characterId || typeof characterId !== 'string') {
throw new UserError('Invalid data', { message: 'Invalid pony ID', desc: `"${characterId}"` });
}