From 65edcfae44fcf7201280506527e67beb36cfadc6 Mon Sep 17 00:00:00 2001 From: ASangarin Date: Thu, 29 Aug 2019 20:45:48 +0100 Subject: [PATCH] Small changes to edition classes --- src/main/java/net/Indyuce/mmoitems/api/edition/Edition.java | 2 ++ .../java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java | 3 +++ .../java/net/Indyuce/mmoitems/api/edition/StatEdition.java | 3 +++ .../Indyuce/mmoitems/api/edition/process/EditionProcess.java | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmoitems/api/edition/Edition.java b/src/main/java/net/Indyuce/mmoitems/api/edition/Edition.java index 0ed7ee33..f2462f8c 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/edition/Edition.java +++ b/src/main/java/net/Indyuce/mmoitems/api/edition/Edition.java @@ -4,4 +4,6 @@ public interface Edition { public boolean output(String input); public void enable(String... message); + + public boolean shouldGoBack(); } diff --git a/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java b/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java index 2df4c23f..58840e75 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java +++ b/src/main/java/net/Indyuce/mmoitems/api/edition/NewItemEdition.java @@ -53,4 +53,7 @@ public class NewItemEdition implements Edition { Bukkit.getScheduler().runTask(MMOItems.plugin, () -> Bukkit.dispatchCommand(inv.getPlayer(), "mi create " + inv.getType().getId() + " " + input.toUpperCase().replace(" ", "_").replace("-", "_"))); return true; } + + public boolean shouldGoBack() + { return false; } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java b/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java index e6574cb9..1757e6f3 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java +++ b/src/main/java/net/Indyuce/mmoitems/api/edition/StatEdition.java @@ -61,4 +61,7 @@ public class StatEdition implements Edition { public boolean output(String input) { return input.equals("cancel") || stat.whenInput((EditionInventory) inv, ((EditionInventory) inv).getItemType().getConfigFile(), input, info); } + + public boolean shouldGoBack() + { return true; } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/edition/process/EditionProcess.java b/src/main/java/net/Indyuce/mmoitems/api/edition/process/EditionProcess.java index 3d456b68..63453e21 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/edition/process/EditionProcess.java +++ b/src/main/java/net/Indyuce/mmoitems/api/edition/process/EditionProcess.java @@ -21,7 +21,7 @@ public abstract class EditionProcess { public void input(String input) { if (edition.output(input)) { - inv.open(); + if(edition.shouldGoBack()) inv.open(); close(); } }