fixed naming pets non-alphanumeric characters

This commit is contained in:
fooify 2015-12-01 16:23:07 -08:00
parent 48ae23ebff
commit 338e0f1892

View File

@ -64,7 +64,16 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
_tagName = ChatColor.stripColor(_tagName);
_tagName = _tagName.replaceAll("[^A-Za-z0-9]", "");
System.out.println("Pet name: " + _tagName + ".");
if (_tagName.length() == 0)
{
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters."));
playDenySound(getPlayer());
getShop().openPageForPlayer(getPlayer(), new PetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pets", getPlayer()));
return;
}
if (_tagName.length() > 16)
{
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));