mirror of
https://github.com/filoghost/ChestCommands.git
synced 2024-11-26 03:55:40 +01:00
Add method to refresh all open inventories of a menu
This commit is contained in:
parent
73ae9b45c0
commit
7ff586e3b3
@ -42,4 +42,6 @@ public interface IconMenu {
|
||||
*/
|
||||
ItemInventory open(Player player);
|
||||
|
||||
void refreshOpenInventories();
|
||||
|
||||
}
|
@ -21,6 +21,7 @@ import me.filoghost.chestcommands.inventory.DefaultItemInventory;
|
||||
import me.filoghost.chestcommands.util.Preconditions;
|
||||
import me.filoghost.chestcommands.util.collection.ArrayGrid;
|
||||
import me.filoghost.chestcommands.util.collection.Grid;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class BaseIconMenu implements IconMenu {
|
||||
@ -73,4 +74,13 @@ public abstract class BaseIconMenu implements IconMenu {
|
||||
return itemInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshOpenInventories() {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
DefaultItemInventory itemInventory = MenuManager.getOpenItemInventory(player);
|
||||
if (itemInventory.getIconMenu() == this) {
|
||||
itemInventory.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user