Team Color #164
@ -529,7 +529,11 @@ public class TeamCommand extends BasicCommand {
|
||||
return;
|
||||
|
||||
List<SWListInv.SWListEntry<String>> colors = new ArrayList<>();
|
||||
COLOR_CODES.forEach(stringSWListEntry -> colors.add(new SWListInv.SWListEntry<>(stringSWListEntry.getItem().setName(stringSWListEntry.getItem().getTitle() + Team.get(user.getTeam()).getTeamKuerzel()), stringSWListEntry.getObject())));
|
||||
COLOR_CODES.forEach(stringSWListEntry -> {
|
||||
SWItem item = stringSWListEntry.getItem().clone();
|
||||
item.setName(stringSWListEntry.getItem().getTitle() + Team.get(user.getTeam()).getTeamKuerzel());
|
||||
colors.add(new SWListInv.SWListEntry<>(item, stringSWListEntry.getObject()));
|
||||
|
||||
});
|
||||
|
||||
SWListInv<String> inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> {});
|
||||
inv.setCallback((click, element) -> {
|
||||
|
@ -156,4 +156,18 @@ public class SWItem {
|
||||
public void setLore(List<String> lore) {
|
||||
this.lore = lore;
|
||||
}
|
||||
|
||||
public SWItem clone() {
|
||||
SWItem item;
|
||||
if(color != 0) {
|
||||
item = new SWItem(title, color);
|
||||
}else {
|
||||
item = new SWItem(material, title);
|
||||
}
|
||||
item.setLore(lore);
|
||||
item.setCallback(callback);
|
||||
item.setEnchanted(enchanted);
|
||||
item.setHideAttributes(hideAttributes);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ public class SWListInv<T> extends SWInventory {
|
||||
|
||||
@Override
|
||||
public void open(){
|
||||
setCallback(-999, (InvCallback.ClickType click) -> close());
|
||||
if(elements.size() > 54){
|
||||
if(page != 0)
|
||||
addItem(45, new SWItem("§eSeite zurück", 10), (InvCallback.ClickType click) -> {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Nutze Inventory.close() (also inv.close());
Variable 'inv' might not have been initialized.
Dann musst du den Callback evtl. nach der Initialisierung setzen.