SteamWar/FightSystem
Archiviert
13
1

Fix Many Typos and use less Inventories

Dieser Commit ist enthalten in:
Chaoscaot 2021-01-27 12:18:10 +01:00
Ursprung 07f3cdc4cf
Commit 6cc140ff99

Datei anzeigen

@ -68,16 +68,16 @@ public class PersonalKitCreator extends BasicListener {
kits.removeIf(kit -> !kit.getName().toLowerCase().contains(qry.toLowerCase()));
List<SWListInv.SWListEntry<PersonalKit>> entries = new ArrayList<>(kits.size());
kits.forEach(kit -> entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, "§e" + kit.getName(), new ArrayList<>(), kit.isInUse(), clickType -> {}), kit)));
SWListInv<PersonalKit> inv = new SWListInv<>(player, "§eKit wählen", false, entries, (clickType, kit) -> showKit(player, kit));
SWListInv<PersonalKit> inv = new SWListInv<>(player, "§eKit wählen", false, entries, (clickType, kit) -> preview(player, kit));
if(entries.isEmpty())
inv.setItem(22, new SWItem(Material.BARRIER, "§cKeine Kits gefunden"));
inv.setItem(48, Material.NETHER_STAR, "§eNeues Kit", clickType -> {
SWAnvilInv anvilInv = new SWAnvilInv(player, "§eKit namen eingeben");
SWAnvilInv anvilInv = new SWAnvilInv(player, "Kitname eingeben");
anvilInv.setItem(Material.LEATHER_CHESTPLATE);
anvilInv.setCallback(s -> {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(PersonalKit.nameInUse(user.getId(), Config.SchematicType.toDB(), s)) {
player.sendMessage(FightSystem.PREFIX + "§cDieser Kit name wird bereits genutzt!");
player.sendMessage(FightSystem.PREFIX + "§cDieser Kitname wird bereits genutzt!");
player.closeInventory();
return;
}
@ -96,29 +96,8 @@ public class PersonalKitCreator extends BasicListener {
inv.open();
}
private static void showKit(Player player, PersonalKit kit) {
SWInventory inv = new SWInventory(player, 9, "§e" + kit.getName());
inv.setItem(0, Material.LEATHER_CHESTPLATE, "§aKit benutzen", clickType -> useKit(player, kit));
inv.setItem(1, Material.GLASS, "§bPreview", clickType -> preview(player, kit));
inv.setItem(4, SWItem.getMaterial("WOOD_AXE"), "§6Kit bearbeiten", clickType -> openKitCreator(player, kit));
inv.setItem(8, Material.BARRIER, "§cKit Löschen", clickType -> {
player.closeInventory();
SWInventory conf = new SWInventory(player, 0, "§cKit " + kit.getName() + " wirklich löchen?");
conf.setItem(8, SWItem.getDye(1), "§cAbbrechen", click -> player.closeInventory());
conf.setItem(0, SWItem.getDye(10), "§aLöschen", click -> {
player.closeInventory();
if(kit.isInUse()) {
useKit(player, PersonalKit.get(SteamwarUser.get(player.getUniqueId()).getId(), Config.SchematicType.toDB()).get(0));
}
kit.delete();
});
conf.open();
});
inv.open();
}
public static void preview(Player player, PersonalKit kit){
SWInventory inv = new SWInventory(player, 54, "§e" + kit.getName());
SWInventory inv = new SWInventory(player, 54, kit.getName());
//36 = Inventargröße
for(int i = 0; i < 36; i++){
@ -139,11 +118,21 @@ public class PersonalKitCreator extends BasicListener {
}
}
inv.setItem(45, SWItem.getDye(10), (byte)10, "§aKit wählen", (click) -> {
inv.setItem(45, Material.LEATHER_CHESTPLATE, "§aKit benutzen", clickType -> useKit(player, kit));
inv.setItem(49, SWItem.getMaterial("WOOD_AXE"), "§7Kit bearbeiten", clickType -> openKitCreator(player, kit));
inv.setItem(53, Material.BARRIER, "§cKit löschen", clickType -> {
player.closeInventory();
useKit(player, kit);
SWInventory conf = new SWInventory(player, 0, "§cKit " + kit.getName() + " wirklich löchen?");
conf.setItem(8, SWItem.getDye(1), "§cAbbrechen", click -> player.closeInventory());
conf.setItem(0, SWItem.getDye(10), "§aLöschen", click -> {
player.closeInventory();
if(kit.isInUse()) {
useKit(player, PersonalKit.get(SteamwarUser.get(player.getUniqueId()).getId(), Config.SchematicType.toDB()).get(0));
}
kit.delete();
});
conf.open();
});
inv.setItem(53, SWItem.getDye(1), (byte)1, "§cZurück", (click) -> showKit(player, kit));
inv.open();
}