Improve GUI
Dieser Commit ist enthalten in:
Ursprung
dc92ce6fda
Commit
d5e7f82c5b
@ -27,6 +27,8 @@ class SWItem_14 {
|
|||||||
private SWItem_14(){}
|
private SWItem_14(){}
|
||||||
|
|
||||||
static Material getMaterial(String material) {
|
static Material getMaterial(String material) {
|
||||||
|
if("CAULDRON_ITEM".equals(material))
|
||||||
|
return Material.CAULDRON;
|
||||||
try{
|
try{
|
||||||
return Material.valueOf(material);
|
return Material.valueOf(material);
|
||||||
}catch(IllegalArgumentException e){
|
}catch(IllegalArgumentException e){
|
||||||
|
@ -33,6 +33,7 @@ public class SWListInv<T> extends SWInventory {
|
|||||||
private final List<SWListEntry<T>> elements;
|
private final List<SWListEntry<T>> elements;
|
||||||
|
|
||||||
private final Map<Integer, SWItem> customItems = new HashMap<>();
|
private final Map<Integer, SWItem> customItems = new HashMap<>();
|
||||||
|
private final boolean dynamicSize;
|
||||||
private ListCallback<T> callback;
|
private ListCallback<T> callback;
|
||||||
private int page;
|
private int page;
|
||||||
private boolean opened = false;
|
private boolean opened = false;
|
||||||
@ -46,6 +47,7 @@ public class SWListInv<T> extends SWInventory {
|
|||||||
callback = c;
|
callback = c;
|
||||||
elements = l;
|
elements = l;
|
||||||
page = 0;
|
page = 0;
|
||||||
|
this.dynamicSize = dynamicSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,7 +57,7 @@ public class SWListInv<T> extends SWInventory {
|
|||||||
callbacks.clear();
|
callbacks.clear();
|
||||||
setCallback(-999, (ClickType click) -> player.closeInventory());
|
setCallback(-999, (ClickType click) -> player.closeInventory());
|
||||||
|
|
||||||
if(elements.size() > 54){
|
if(sizeBiggerMax()){
|
||||||
if(page != 0)
|
if(page != 0)
|
||||||
setItem(45, SWItem.getDye(10), (byte)10, "§eSeite zurück", (ClickType click) -> {
|
setItem(45, SWItem.getDye(10), (byte)10, "§eSeite zurück", (ClickType click) -> {
|
||||||
page--;
|
page--;
|
||||||
@ -73,7 +75,7 @@ public class SWListInv<T> extends SWInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ipageLimit = elements.size() - page*45;
|
int ipageLimit = elements.size() - page*45;
|
||||||
if(ipageLimit > 45 && elements.size() > 54){
|
if(ipageLimit > 45 && sizeBiggerMax()){
|
||||||
ipageLimit = 45;
|
ipageLimit = 45;
|
||||||
}
|
}
|
||||||
int i = page*45;
|
int i = page*45;
|
||||||
@ -134,6 +136,10 @@ public class SWListInv<T> extends SWInventory {
|
|||||||
return schemList;
|
return schemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean sizeBiggerMax(){
|
||||||
|
return dynamicSize ? elements.size() > 45 : elements.size() > 54;
|
||||||
|
}
|
||||||
|
|
||||||
private static int dynamicSize(int size){
|
private static int dynamicSize(int size){
|
||||||
return (size>45) ? 54 : (size + 9-size%9);
|
return (size>45) ? 54 : (size + 9-size%9);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren