From a957dc3a62c09cc9838092d729255f609cb61629 Mon Sep 17 00:00:00 2001 From: BONNe Date: Fri, 29 Mar 2019 00:42:51 +0200 Subject: [PATCH] Update to BentoBox API 1.4.0 --- .../bentobox/challenges/panel/CommonGUI.java | 9 ++++++++- .../challenges/panel/admin/AdminGUI.java | 9 ++++++++- .../panel/admin/EditChallengeGUI.java | 17 +++++++++++++++-- .../challenges/panel/admin/EditLevelGUI.java | 18 ++++++++++++++++-- .../panel/admin/EditSettingsGUI.java | 8 +++++++- .../challenges/panel/user/ChallengesGUI.java | 8 +++++++- .../challenges/panel/util/ItemSwitchGUI.java | 17 +++++++++++++++-- .../challenges/panel/util/NumberGUI.java | 8 +++++++- .../challenges/panel/util/StringListGUI.java | 8 +++++++- .../bentobox/challenges/utils/GuiUtils.java | 8 +++++++- 10 files changed, 97 insertions(+), 13 deletions(-) diff --git a/src/main/java/world/bentobox/challenges/panel/CommonGUI.java b/src/main/java/world/bentobox/challenges/panel/CommonGUI.java index 37c8a3b..3b534f8 100644 --- a/src/main/java/world/bentobox/challenges/panel/CommonGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/CommonGUI.java @@ -20,6 +20,7 @@ import world.bentobox.challenges.ChallengesAddon; import world.bentobox.challenges.ChallengesManager; import world.bentobox.challenges.database.object.Challenge; import world.bentobox.challenges.database.object.ChallengeLevel; +import world.bentobox.challenges.utils.GuiUtils; import world.bentobox.challenges.utils.LevelStatus; @@ -239,7 +240,13 @@ public abstract class CommonGUI return null; } - return new PanelItem(icon, name, description, false, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(description). + glow(false). + clickHandler(clickHandler). + build(); } diff --git a/src/main/java/world/bentobox/challenges/panel/admin/AdminGUI.java b/src/main/java/world/bentobox/challenges/panel/admin/AdminGUI.java index 92f57cc..76f5dcc 100644 --- a/src/main/java/world/bentobox/challenges/panel/admin/AdminGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/admin/AdminGUI.java @@ -8,6 +8,7 @@ import org.bukkit.inventory.ItemStack; import net.wesjd.anvilgui.AnvilGUI; import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.builders.PanelBuilder; +import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.util.Util; import world.bentobox.challenges.ChallengesAddon; @@ -453,6 +454,12 @@ public class AdminGUI extends CommonGUI }; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength()), glow, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())). + glow(glow). + clickHandler(clickHandler). + build(); } } \ No newline at end of file diff --git a/src/main/java/world/bentobox/challenges/panel/admin/EditChallengeGUI.java b/src/main/java/world/bentobox/challenges/panel/admin/EditChallengeGUI.java index 90d02af..f67165b 100644 --- a/src/main/java/world/bentobox/challenges/panel/admin/EditChallengeGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/admin/EditChallengeGUI.java @@ -11,6 +11,7 @@ import java.util.*; import net.wesjd.anvilgui.AnvilGUI; import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.builders.PanelBuilder; +import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.user.User; import world.bentobox.challenges.ChallengesAddon; import world.bentobox.challenges.database.object.Challenge; @@ -281,7 +282,13 @@ public class EditChallengeGUI extends CommonGUI return null; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength()), glow, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())). + glow(glow). + clickHandler(clickHandler). + build(); } @@ -1250,7 +1257,13 @@ public class EditChallengeGUI extends CommonGUI return null; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, lineLength), glow, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, lineLength)). + glow(glow). + clickHandler(clickHandler). + build(); } diff --git a/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java b/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java index 55ec410..834db93 100644 --- a/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java @@ -253,7 +253,13 @@ public class EditLevelGUI extends CommonGUI return null; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength()), glow, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, this.addon.getChallengesSettings().getLoreLineLength())). + glow(glow). + clickHandler(clickHandler). + build(); } @@ -697,7 +703,15 @@ public class EditLevelGUI extends CommonGUI return null; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, lineLength), glow, clickHandler, false); + + + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, lineLength)). + glow(glow). + clickHandler(clickHandler). + build(); } diff --git a/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java b/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java index 419c145..a6ed710 100644 --- a/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java @@ -453,7 +453,13 @@ public class EditSettingsGUI extends CommonGUI return new PanelItemBuilder().build(); } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.settings.getLoreLineLength()), glow, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, this.settings.getLoreLineLength())). + glow(glow). + clickHandler(clickHandler). + build(); } diff --git a/src/main/java/world/bentobox/challenges/panel/user/ChallengesGUI.java b/src/main/java/world/bentobox/challenges/panel/user/ChallengesGUI.java index e092adb..3c1a89c 100644 --- a/src/main/java/world/bentobox/challenges/panel/user/ChallengesGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/user/ChallengesGUI.java @@ -438,7 +438,13 @@ public class ChallengesGUI extends CommonGUI glow = false; } - return new PanelItem(icon, name, description, glow, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(description). + glow(glow). + clickHandler(clickHandler). + build(); } diff --git a/src/main/java/world/bentobox/challenges/panel/util/ItemSwitchGUI.java b/src/main/java/world/bentobox/challenges/panel/util/ItemSwitchGUI.java index 6507bfc..4969f1e 100644 --- a/src/main/java/world/bentobox/challenges/panel/util/ItemSwitchGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/util/ItemSwitchGUI.java @@ -13,6 +13,7 @@ import java.util.function.BiConsumer; import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelListener; import world.bentobox.bentobox.api.panels.builders.PanelBuilder; +import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.user.User; import world.bentobox.challenges.utils.GuiUtils; @@ -125,7 +126,13 @@ public class ItemSwitchGUI return null; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.lineLength), false, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, this.lineLength)). + glow(false). + clickHandler(clickHandler). + build(); } @@ -143,7 +150,13 @@ public class ItemSwitchGUI { CustomPanelItem(ItemStack item) { - super(item.clone(), "", Collections.emptyList(), false, null, false); + super(new PanelItemBuilder(). + icon(item.clone()). + name(""). + description(Collections.emptyList()). + glow(false). + clickHandler(null)); + this.getItem().setItemMeta(item.getItemMeta()); } diff --git a/src/main/java/world/bentobox/challenges/panel/util/NumberGUI.java b/src/main/java/world/bentobox/challenges/panel/util/NumberGUI.java index 9e5efa2..6cae14d 100644 --- a/src/main/java/world/bentobox/challenges/panel/util/NumberGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/util/NumberGUI.java @@ -239,7 +239,13 @@ public class NumberGUI return null; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.lineLength), glow, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, this.lineLength)). + glow(glow). + clickHandler(clickHandler). + build(); } diff --git a/src/main/java/world/bentobox/challenges/panel/util/StringListGUI.java b/src/main/java/world/bentobox/challenges/panel/util/StringListGUI.java index b634401..6f34299 100644 --- a/src/main/java/world/bentobox/challenges/panel/util/StringListGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/util/StringListGUI.java @@ -180,7 +180,13 @@ public class StringListGUI return null; } - return new PanelItem(icon, name, GuiUtils.stringSplit(description, this.lineLength), false, clickHandler, false); + return new PanelItemBuilder(). + icon(icon). + name(name). + description(GuiUtils.stringSplit(description, this.lineLength)). + glow(false). + clickHandler(clickHandler). + build(); } diff --git a/src/main/java/world/bentobox/challenges/utils/GuiUtils.java b/src/main/java/world/bentobox/challenges/utils/GuiUtils.java index 8d0918b..62076be 100644 --- a/src/main/java/world/bentobox/challenges/utils/GuiUtils.java +++ b/src/main/java/world/bentobox/challenges/utils/GuiUtils.java @@ -13,6 +13,7 @@ import java.util.List; import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.builders.PanelBuilder; +import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; /** @@ -347,7 +348,12 @@ public class GuiUtils { private BorderBlock(ItemStack icon) { - super(icon.clone(), " ", Collections.emptyList(), false, null, false); + super(new PanelItemBuilder(). + icon(icon.clone()). + name(" "). + description(Collections.emptyList()). + glow(false). + clickHandler(null)); }