Fix renaming pets for 1.8 clients

This commit is contained in:
Shaun Bennett 2014-09-24 22:31:09 -05:00
parent 57487e78cf
commit f5c8b2b1ac
2 changed files with 5 additions and 2 deletions

View File

@ -131,7 +131,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
PetTagPage petTagPage = new PetTagPage(Plugin, Shop, ClientManager, DonationManager, "Repairing", Player, pet, petPurchase);
EntityPlayer entityPlayer = ((CraftPlayer)Player).getHandle();
int containerCounter = entityPlayer.nextContainerCounter();
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 9, true));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 0, true));
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory());
entityPlayer.activeContainer.windowId = containerCounter;
entityPlayer.activeContainer.addSlotListener(entityPlayer);

View File

@ -62,7 +62,10 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void SelectTag()
{
if (ChatColor.stripColor(_tagName).length() > 16)
_tagName = ChatColor.stripColor(_tagName);
_tagName = _tagName.replaceAll("[^A-Za-z0-9]", "");
if (_tagName.length() > 16)
{
UtilPlayer.message(Player, F.main(Plugin.GetName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
PlayDenySound(Player);