use of com.palmergames.bukkit.towny.exceptions.InvalidNameException in project Towny by TownyAdvanced.
the class TownyDatabaseHandler method newResident.
@Override
public void newResident(String name, UUID uuid) throws AlreadyRegisteredException, NotRegisteredException {
String filteredName;
try {
filteredName = NameValidation.checkAndFilterPlayerName(name);
} catch (InvalidNameException e) {
throw new NotRegisteredException(e.getMessage());
}
if (universe.hasResident(name))
throw new AlreadyRegisteredException("A resident with the name " + filteredName + " is already in use.");
Resident resident = new Resident(filteredName);
if (uuid != null)
resident.setUUID(uuid);
universe.registerResident(resident);
}
Aggregations