File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 11group ' fr.minuskube.inv'
2- version ' 1.1.0 '
2+ version ' 1.1.1 '
33
44apply plugin : ' java'
55apply plugin : ' maven'
Original file line number Diff line number Diff line change 1313import java .util .List ;
1414import java .util .Optional ;
1515
16+ @ SuppressWarnings ("unchecked" )
1617public class SmartInventory {
1718
1819 private String id ;
@@ -32,6 +33,17 @@ private SmartInventory() {}
3233 public Inventory open (Player player , int page ) {
3334 InventoryManager manager = SmartInvsPlugin .manager ();
3435
36+ Optional <SmartInventory > oldInv = manager .getInventory (player );
37+
38+ oldInv .ifPresent (inv -> {
39+ inv .getListeners ().stream ()
40+ .filter (listener -> listener .getType () == InventoryCloseEvent .class )
41+ .forEach (listener -> ((InventoryListener <InventoryCloseEvent >) listener )
42+ .accept (new InventoryCloseEvent (player .getOpenInventory ())));
43+
44+ manager .setInventory (player , null );
45+ });
46+
3547 InventoryContents contents = new InventoryContents .Impl (this );
3648 contents .pagination ().page (page );
3749
@@ -56,9 +68,9 @@ public void close(Player player) {
5668 .forEach (listener -> ((InventoryListener <InventoryCloseEvent >) listener )
5769 .accept (new InventoryCloseEvent (player .getOpenInventory ())));
5870
71+ manager .setInventory (player , null );
5972 player .closeInventory ();
6073
61- manager .setInventory (player , null );
6274 manager .setContents (player , null );
6375 }
6476
Original file line number Diff line number Diff line change 11name : SmartInvs
2- version : 1.1.0
2+ version : 1.1.1
33description : Inventory API for your Bukkit Plugins.
44author : MinusKube
55website : https://github.com/MinusKube/SmartInvs
You can’t perform that action at this time.
0 commit comments