make pet menu refresh instantly

This commit is contained in:
Spencer 2018-01-07 00:08:56 -05:00 committed by Alexander Meech
parent 09cc258d9b
commit 45de19163f
1 changed files with 13 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package mineplex.staffServer.ui.pet;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Map;
import java.util.stream.Collectors;
import org.bukkit.entity.Player;
@ -59,10 +60,15 @@ public class SupportPetPage extends SupportPage
return new ShopItem(item, false, true);
}
private Map<PetType, String> getPets()
{
return getShop().getPetClients().get(_target.getAccountId()).getPets();
}
private void addPet(PetType petType, int slot)
{
// Owns the pet
if (getShop().getPetClients().get(_target.getAccountId()).getPets().containsKey(petType))
if (getPets().containsKey(petType))
{
addItem(slot, getPetIcon(petType, true));
addGlow(slot);
@ -83,12 +89,12 @@ public class SupportPetPage extends SupportPage
{
if (success)
{
getShop().loadPetClient(getPlayer(), _target, (petSuccess) ->
{
playSuccess();
message("Successfully gave " + C.cYellow + petType.getName() + " Pet" + C.mBody + " to " + C.cYellow + _target.getName());
getPets().put(petType, petType.getName());
refresh();
});
}
else
{