Updated to support new GUI system.

This commit is contained in:
Brianna 2021-01-15 15:36:41 -06:00
parent 081bff7de6
commit d5ee89f1d7
6 changed files with 40 additions and 26 deletions

View File

@ -92,17 +92,17 @@ public class AnimatedKitGui extends Gui {
items.removeLast();
Iterator<KitItem> itemIter = items.iterator();
for (int i = 9; i < 18; i++) {
setItem(0, i, itemIter.next().getItem());
setItem(0, i, itemIter.next().getItemForDisplay());
}
}
// should we try to wrap it up?
if (finish) {
ItemStack item = getItem(13);
KitItem kitItem = items.stream().filter(i -> i.getItem().isSimilar(item)).findFirst().orElse(null);
KitItem kitItem = items.stream().filter(i -> isSimilar(item, i)).findFirst().orElse(null);
if (item == null) {
done = true; // idk.
} else if (item.isSimilar(give)) {
} else if (isSimilar(give, kitItem)) {
if (!done) {
done = true;
if (!Settings.AUTO_EQUIP_ARMOR_ROULETTE.getBoolean() || !ArmorType.equip(player, give)) {
@ -129,6 +129,20 @@ public class AnimatedKitGui extends Gui {
}
private boolean isSimilar(ItemStack item, KitItem kitItem) {
if (kitItem == null) return false;
switch (kitItem.getType()) {
case COMMAND:
case ECONOMY:
System.out.println("1 " + item.getItemMeta().getLore());
System.out.println("2 " + kitItem.getItemForDisplay().getItemMeta().getLore());
System.out.println(item.getItemMeta().getLore().get(0).equals(kitItem.getItemForDisplay().getItemMeta().getLore()));
return item.getItemMeta().getLore().get(0).equals(kitItem.getItemForDisplay().getItemMeta().getLore());
default:
return item.isSimilar(kitItem.getItemForDisplay());
}
}
private void finish() {
Bukkit.getScheduler().cancelTask(task);
exit();

View File

@ -32,7 +32,7 @@ public class CategoryEditorGui extends Gui {
// fill glass borders
Methods.fillGlass(this);
GuiUtils.mirrorFill(this, 1, 1, false, true, getDefaultItem());
mirrorFill(1, 1, false, true, getDefaultItem());
setButton(4, GuiUtils.createButtonItem(CompatibleMaterial.GREEN_DYE, "Create Category"),
(event) -> {

View File

@ -49,7 +49,7 @@ public class CategorySelectorGui extends Gui {
ItemStack glass2 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_2.getMaterial());
setDefaultItem(AIR);
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
mirrorFill(0, 0, true, true, glass2);
if (!glassless) {
if (Settings.RAINBOW.getBoolean()) {
@ -62,11 +62,11 @@ public class CategorySelectorGui extends Gui {
} else {
ItemStack glass1 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_1.getMaterial());
ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial());
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
GuiUtils.mirrorFill(this, 1, 0, true, true, glass2);
GuiUtils.mirrorFill(this, 0, 1, true, true, glass2);
GuiUtils.mirrorFill(this, 0, 2, true, true, glass3);
GuiUtils.mirrorFill(this, 0, 3, false, true, glass1);
mirrorFill(0, 0, true, true, glass2);
mirrorFill(1, 0, true, true, glass2);
mirrorFill(0, 1, true, true, glass2);
mirrorFill(0, 2, true, true, glass3);
mirrorFill(0, 3, false, true, glass1);
}
}

View File

@ -61,11 +61,11 @@ public class KitEditorGui extends DoubleGui {
ItemStack glass2 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_2.getMaterial());
ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial());
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
GuiUtils.mirrorFill(this, 0, 1, true, true, glass2);
GuiUtils.mirrorFill(this, 1, 0, true, true, glass2);
GuiUtils.mirrorFill(this, 0, 2, true, true, glass3);
GuiUtils.mirrorFill(this, 0, 3, false, true, glass1);
mirrorFill(0, 0, true, true, glass2);
mirrorFill(0, 1, true, true, glass2);
mirrorFill(1, 0, true, true, glass2);
mirrorFill(0, 2, true, true, glass3);
mirrorFill(0, 3, false, true, glass1);
// exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR),

View File

@ -72,7 +72,7 @@ public class KitSelectorGui extends Gui {
ItemStack glass2 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_2.getMaterial());
setDefaultItem(AIR);
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
mirrorFill(0, 0, true, true, glass2);
if (!glassless) {
if (Settings.RAINBOW.getBoolean()) {
@ -85,11 +85,11 @@ public class KitSelectorGui extends Gui {
} else {
ItemStack glass1 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_1.getMaterial());
ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial());
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
GuiUtils.mirrorFill(this, 1, 0, true, true, glass2);
GuiUtils.mirrorFill(this, 0, 1, true, true, glass2);
GuiUtils.mirrorFill(this, 0, 2, true, true, glass3);
GuiUtils.mirrorFill(this, 0, 3, false, true, glass1);
mirrorFill(0, 0, true, true, glass2);
mirrorFill(1, 0, true, true, glass2);
mirrorFill(0, 1, true, true, glass2);
mirrorFill(0, 2, true, true, glass3);
mirrorFill(0, 3, false, true, glass1);
}
}

View File

@ -193,12 +193,12 @@ public class Methods {
ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial(CompatibleMaterial.LIGHT_BLUE_STAINED_GLASS_PANE));
// edges will be type 3
GuiUtils.mirrorFill(gui, 0, 2, true, true, glass3);
GuiUtils.mirrorFill(gui, 1, 1, false, true, glass3);
gui.mirrorFill(0, 2, true, true, glass3);
gui.mirrorFill( 1, 1, false, true, glass3);
// decorate corners with type 2
GuiUtils.mirrorFill(gui, 0, 0, true, true, glass2);
GuiUtils.mirrorFill(gui, 1, 0, true, true, glass2);
GuiUtils.mirrorFill(gui, 0, 1, true, true, glass2);
gui.mirrorFill( 0, 0, true, true, glass2);
gui.mirrorFill( 1, 0, true, true, glass2);
gui.mirrorFill(0, 1, true, true, glass2);
}
}