From d752461c7435c71327662f70a784d7ce274690ec Mon Sep 17 00:00:00 2001 From: CarmJos Date: Thu, 13 Jan 2022 01:00:46 +0800 Subject: [PATCH] =?UTF-8?q?[v2.3.1]=20[F]=20=E4=BF=AE=E5=A4=8D=E5=89=8D?= =?UTF-8?q?=E7=BC=80=E6=95=B0=E9=87=8F=E8=B6=85=E8=BF=87=E4=B8=80=E9=A1=B5?= =?UTF-8?q?=E6=97=B6=E7=BF=BB=E9=A1=B5=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../userprefix/util/gui/AutoPagedGUI.java | 134 +++++++++--------- 2 files changed, 71 insertions(+), 65 deletions(-) diff --git a/pom.xml b/pom.xml index 065026f..77d9b5c 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ cc.carm.plugin userprefix - 2.3.0 + 2.3.1 UserPrefix 轻便、高效、实时的用户前缀系统。 diff --git a/src/main/java/cc/carm/plugin/userprefix/util/gui/AutoPagedGUI.java b/src/main/java/cc/carm/plugin/userprefix/util/gui/AutoPagedGUI.java index f532daf..cc2473e 100644 --- a/src/main/java/cc/carm/plugin/userprefix/util/gui/AutoPagedGUI.java +++ b/src/main/java/cc/carm/plugin/userprefix/util/gui/AutoPagedGUI.java @@ -7,81 +7,87 @@ import org.bukkit.inventory.ItemStack; public class AutoPagedGUI extends CommonPagedGUI { - ItemStack previousPageUI; - ItemStack nextPageUI; - ItemStack noPreviousPageUI; - ItemStack noNextPageUI; - int previousPageSlot = -1; - int nextPageSlot = -1; + ItemStack previousPageUI; + ItemStack nextPageUI; + ItemStack noPreviousPageUI; + ItemStack noNextPageUI; + int previousPageSlot = -1; + int nextPageSlot = -1; - public AutoPagedGUI(GUIType type, String name, int[] range) { - super(type, name, range); - } + public AutoPagedGUI(GUIType type, String name, int[] range) { + super(type, name, range); + } - public AutoPagedGUI(GUIType type, String name, int a, int b) { - super(type, name, a, b); - } + public AutoPagedGUI(GUIType type, String name, int a, int b) { + super(type, name, a, b); + } - public void setPreviousPageUI(ItemStack lastPageUI) { - this.previousPageUI = lastPageUI; - } + public void setPreviousPageUI(ItemStack lastPageUI) { + this.previousPageUI = lastPageUI; + } - public void setNextPageUI(ItemStack nextPageUI) { - this.nextPageUI = nextPageUI; - } + public void setNextPageUI(ItemStack nextPageUI) { + this.nextPageUI = nextPageUI; + } - public void setNoPreviousPageUI(ItemStack noPreviousPageUI) { - this.noPreviousPageUI = noPreviousPageUI; - } + public void setNoPreviousPageUI(ItemStack noPreviousPageUI) { + this.noPreviousPageUI = noPreviousPageUI; + } - public void setNoNextPageUI(ItemStack noNextPageUI) { - this.noNextPageUI = noNextPageUI; - } + public void setNoNextPageUI(ItemStack noNextPageUI) { + this.noNextPageUI = noNextPageUI; + } - public void setPreviousPageSlot(int slot) { - this.previousPageSlot = slot; - } + public void setPreviousPageSlot(int slot) { + this.previousPageSlot = slot; + } - public void setNextPageSlot(int slot) { - this.nextPageSlot = slot; - } + public void setNextPageSlot(int slot) { + this.nextPageSlot = slot; + } - @Override - public void openGUI(Player user) { - if (previousPageSlot >= 0) - if (hasPreviousPage()) { - setItem(previousPageSlot, new GUIItem(previousPageUI == null ? PluginConfig.GUI.Items.PREVIOUS_PAGE.get() : previousPageUI) { - @Override - public void onClick(ClickType type) { - if (type == ClickType.RIGHT) { - goFirstPage(); - } else { - goPreviousPage(); - } - PluginConfig.Sounds.GUI_CLICK.play(user); - openGUI(user); - } - }); - } + @Override + public void openGUI(Player user) { + if (previousPageSlot >= 0) { + if (hasPreviousPage()) { + setItem(previousPageSlot, new GUIItem(previousPageUI == null ? PluginConfig.GUI.Items.PREVIOUS_PAGE.get() : previousPageUI) { + @Override + public void onClick(ClickType type) { + if (type == ClickType.RIGHT) { + goFirstPage(); + } else { + goPreviousPage(); + } + PluginConfig.Sounds.GUI_CLICK.play(user); + openGUI(user); + } + }); + } else { + setItem(previousPageSlot, null); + } + } - if (nextPageSlot >= 0) - if (hasNextPage()) { - setItem(nextPageSlot, new GUIItem(nextPageUI == null ? PluginConfig.GUI.Items.NEXT_PAGE.get() : nextPageUI) { - @Override - public void onClick(ClickType type) { - if (type == ClickType.RIGHT) { - goLastPage(); - } else { - goNextPage(); - } - PluginConfig.Sounds.GUI_CLICK.play(user); - openGUI(user); - } - }); - } + if (nextPageSlot >= 0) { + if (hasNextPage()) { + setItem(nextPageSlot, new GUIItem(nextPageUI == null ? PluginConfig.GUI.Items.NEXT_PAGE.get() : nextPageUI) { + @Override + public void onClick(ClickType type) { + if (type == ClickType.RIGHT) { + goLastPage(); + } else { + goNextPage(); + } + PluginConfig.Sounds.GUI_CLICK.play(user); + openGUI(user); + } + }); + } else { + setItem(nextPageSlot, null); + } + } - super.openGUI(user); - } + super.openGUI(user); + } }