mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-23 02:42:31 +00:00
Fix shops not being shown after re-join
This commit is contained in:
parent
09fef5b38c
commit
0a06a69e65
@ -23,6 +23,12 @@ public class ShopUpdateListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLeave(PlayerQuitEvent e) {
|
public void onPlayerLeave(PlayerQuitEvent e) {
|
||||||
|
// If done without delay, Bukkit#getOnlinePlayers() would still
|
||||||
|
// contain the player even though he left, so the shop updater
|
||||||
|
// would show the shop again.
|
||||||
|
new BukkitRunnable(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
for (Shop shop : plugin.getShopUtils().getShops()) {
|
for (Shop shop : plugin.getShopUtils().getShops()) {
|
||||||
if (shop.hasItem()) {
|
if (shop.hasItem()) {
|
||||||
shop.getItem().resetVisible(e.getPlayer());
|
shop.getItem().resetVisible(e.getPlayer());
|
||||||
@ -34,6 +40,8 @@ public class ShopUpdateListener implements Listener {
|
|||||||
|
|
||||||
plugin.getShopUtils().resetPlayerLocation(e.getPlayer());
|
plugin.getShopUtils().resetPlayerLocation(e.getPlayer());
|
||||||
}
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent e) {
|
public void onPlayerTeleport(PlayerTeleportEvent e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user