From 230bbb41183d4e1a3ed39d1c3be6115b598f01c5 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 23 May 2020 11:14:58 +0200 Subject: [PATCH 1/2] Show ranks in gui list Signed-off-by: Lixfel --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 63ac2b3..72a8407 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -1,5 +1,6 @@ package de.steamwar.schematicsystem.commands; +import com.google.common.collect.Lists; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; @@ -165,6 +166,8 @@ class GUI { m = SWItem.getMaterial(schem.getItem()); SWItem item = new SWItem(m, "§e" + schem.getSchemName(), Collections.singletonList("§7" + schem.getSchemType().name()), !schem.getSchemType().writeable(), click -> {}); + if(schem.getRank() > 0) + item.setLore(Lists.newArrayList("§7" + schem.getSchemType().name(), "§8Rang " + schem.getRank())); schemList.add(new SWListInv.SWListEntry<>(item, schem)); } From a1478864d01733bef308380759d93fa7dc39e071 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 23 May 2020 11:20:50 +0200 Subject: [PATCH 2/2] Show ranks in gui + fix bug in gui status Signed-off-by: Lixfel --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 4 +++- .../steamwar/schematicsystem/commands/SchematicCommand.java | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 72a8407..48ccd64 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -101,7 +101,9 @@ class GUI { if(schem.getSchemOwner() == SteamwarUser.get(p.getUniqueId()).getId()){ if(schem.getSchemType().writeable()){ List checkedSchematics = CheckedSchematic.getLastDeclined(p.getUniqueId()); - for(CheckedSchematic checkedSchematic : checkedSchematics) { + ListIterator i = checkedSchematics.listIterator(checkedSchematics.size()); + while(i.hasPrevious()) { + CheckedSchematic checkedSchematic = i.previous(); if(checkedSchematic.getSchemName().equals(schem.getSchemName()) && checkedSchematic.getSchemOwner() == schem.getSchemOwner()) { inv.setItem(1, SWItem.getDye(10), (byte) 10, "§eStatus " + schem.getSchemType().name(), Collections.singletonList("§7" + checkedSchematic.getDeclineReason()), false, click -> {}); diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index fdc6a90..ec42e79 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -292,6 +292,9 @@ public class SchematicCommand implements CommandExecutor { type.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eTyp ändern"))); type.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName())); } + if(schematic.getRank() > 0){ + type.addExtra("§8Rang " + schematic.getRank()); + } player.spigot().sendMessage(type); if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())){