mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 01:50:50 +01:00
Cleanup part 2.
This commit is contained in:
parent
a71853d0c2
commit
649005cb90
@ -13,13 +13,10 @@ public class CheckPetNameEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
String petName = this.packet.readString();
|
||||
|
||||
int minLength = Emulator.getConfig().getInt("hotel.pets.name.length.min");
|
||||
int maxLength = Emulator.getConfig().getInt("hotel.pets.name.length.max");
|
||||
|
||||
if (petName.length() < PET_NAME_LENGTH_MINIMUM) {
|
||||
this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_SHORT, minLength + ""));
|
||||
} else if (petName.length() > maxLength) {
|
||||
this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_LONG, maxLength + ""));
|
||||
this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_SHORT, PET_NAME_LENGTH_MINIMUM + ""));
|
||||
} else if (petName.length() > PET_NAME_LENGTH_MAXIMUM) {
|
||||
this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.NAME_TO_LONG, PET_NAME_LENGTH_MAXIMUM + ""));
|
||||
} else if (!StringUtils.isAlphanumeric(petName)) {
|
||||
this.client.sendResponse(new PetNameErrorComposer(PetNameErrorComposer.FORBIDDEN_CHAR, petName));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user