mirror of
https://github.com/CarmJos/UserPrefix.git
synced 2024-09-19 12:05:47 +00:00
[v2.3.1] [F] 修复前缀数量超过一页时翻页可能出现错误的问题
This commit is contained in:
parent
548f1d366f
commit
d752461c74
2
pom.xml
2
pom.xml
@ -13,7 +13,7 @@
|
||||
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<artifactId>userprefix</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<version>2.3.1</version>
|
||||
|
||||
<name>UserPrefix</name>
|
||||
<description>轻便、高效、实时的用户前缀系统。</description>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user