Fixed items not updating immediately.

This commit is contained in:
Jonathan Williams 2014-08-09 04:29:34 -05:00
parent 8fe4e39207
commit b0f6435661
3 changed files with 7 additions and 2 deletions

View File

@ -112,6 +112,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void run()
{
Plugin.getInventoryManager().addItemToInventory(Player, gadget.getGadgetType().name(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget)gadget).getAmmo().getQuantity() : gadget.getQuantity()));
Refresh();
}
}, this, (gadget instanceof ItemGadget ? ((ItemGadget)gadget).getAmmo() : gadget), CurrencyType.Coins, Player));
}

View File

@ -93,6 +93,7 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void run()
{
Plugin.getInventoryManager().addItemToInventory(Player, "Mount", mount.GetName(), 1);
Refresh();
}
}, this, mount, CurrencyType.Coins, Player));
}

View File

@ -68,6 +68,11 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
{
final String uuidString = player.getUniqueId().toString();
if (_items.containsKey(item))
{
Get(player).addItem(new ClientItem(_items.get(item), count));
}
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
@ -94,8 +99,6 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
updateItems();
Get(player).addItem(new ClientItem(_items.get(item), count));
synchronized (_inventoryLock)
{
_repository.incrementClientInventoryItem(uuidString, _items.get(item).Id, count);