SteamWar/SpigotCore
Archiviert
13
0

Merge pull request 'Add Custom Callbacks for SWListInv' (#218) from hotfix_custom_callbacks into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #218
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-10-29 12:21:42 +02:00
Commit 10dfc034e3

Datei anzeigen

@ -28,6 +28,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
public class SWListInv<T> extends SWInventory { public class SWListInv<T> extends SWInventory {
@ -55,8 +56,10 @@ public class SWListInv<T> extends SWInventory {
public void open(){ public void open(){
opened = true; opened = true;
inventory.clear(); inventory.clear();
callbacks.clear(); callbacks.keySet().stream().filter(i -> i >= 0).collect(Collectors.toList()).forEach(callbacks::remove);
setCallback(-999, (ClickType click) -> player.closeInventory()); if(!callbacks.containsKey(-999)) {
setCallback(-999, (ClickType click) -> player.closeInventory());
}
if (sizeBiggerMax()) { if (sizeBiggerMax()) {
if (page != 0) { if (page != 0) {