From 0ef5f6dcb9418978b7202becab54c99c22fe82aa Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 1 Jan 2021 02:15:12 +0100 Subject: [PATCH] Fixing Stuff... --- .../steamwar/bungeecore/commands/TeamCommand.java | 6 +++++- src/de/steamwar/bungeecore/inventory/SWItem.java | 14 ++++++++++++++ .../steamwar/bungeecore/inventory/SWListInv.java | 1 - 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 9b25543..51b33d0 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -529,7 +529,11 @@ public class TeamCommand extends BasicCommand { return; List> 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 inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> {}); inv.setCallback((click, element) -> { diff --git a/src/de/steamwar/bungeecore/inventory/SWItem.java b/src/de/steamwar/bungeecore/inventory/SWItem.java index 2e9d80c..f5a4476 100644 --- a/src/de/steamwar/bungeecore/inventory/SWItem.java +++ b/src/de/steamwar/bungeecore/inventory/SWItem.java @@ -156,4 +156,18 @@ public class SWItem { public void setLore(List 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; + } } diff --git a/src/de/steamwar/bungeecore/inventory/SWListInv.java b/src/de/steamwar/bungeecore/inventory/SWListInv.java index bd43730..1161260 100644 --- a/src/de/steamwar/bungeecore/inventory/SWListInv.java +++ b/src/de/steamwar/bungeecore/inventory/SWListInv.java @@ -40,7 +40,6 @@ public class SWListInv 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) -> {