Merge pull request 'Add Custom Callbacks for SWListInv' (#218) from hotfix_custom_callbacks into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
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:
Commit
10dfc034e3
@ -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);
|
||||||
|
if(!callbacks.containsKey(-999)) {
|
||||||
setCallback(-999, (ClickType click) -> player.closeInventory());
|
setCallback(-999, (ClickType click) -> player.closeInventory());
|
||||||
|
}
|
||||||
|
|
||||||
if (sizeBiggerMax()) {
|
if (sizeBiggerMax()) {
|
||||||
if (page != 0) {
|
if (page != 0) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren