v1.1
This commit is contained in:
parent
7d9ea90485
commit
8b5a40bad1
|
@ -4,6 +4,7 @@ import com.io.yutian.aulib.AuLib;
|
|||
import com.io.yutian.aulib.gui.button.Button;
|
||||
import com.io.yutian.aulib.gui.button.ClickType;
|
||||
import com.io.yutian.aulib.gui.button.ItemButton;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
|
@ -16,7 +17,7 @@ public class Gui extends IGui {
|
|||
|
||||
private Map<Integer, Button> buttons = new HashMap<>();
|
||||
|
||||
public Gui(Player player, String title, int size) {
|
||||
public Gui(Player player, Component title, int size) {
|
||||
super(player, title, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ public abstract class IGui implements InventoryHolder {
|
|||
public Inventory inventory;
|
||||
public Player player;
|
||||
|
||||
private String title;
|
||||
private Component title;
|
||||
private int size;
|
||||
|
||||
public IGui(Player player, String title, int size) {
|
||||
this.inventory = Bukkit.createInventory(this, size, Component.text(title));
|
||||
public IGui(Player player, Component title, int size) {
|
||||
this.inventory = Bukkit.createInventory(this, size, title);
|
||||
this.title = title;
|
||||
this.size = size;
|
||||
this.player = player;
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.io.yutian.aulib.AuLib;
|
|||
import com.io.yutian.aulib.gui.button.Button;
|
||||
import com.io.yutian.aulib.gui.button.ClickType;
|
||||
import com.io.yutian.aulib.gui.button.ItemButton;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
|
@ -15,11 +16,11 @@ import java.util.Map;
|
|||
public class PageGui extends IGui {
|
||||
|
||||
private int page = 1;
|
||||
private int maxPage = 1;
|
||||
private int maxPage;
|
||||
|
||||
private Map<Integer, Page> pages = new HashMap<>();
|
||||
|
||||
public PageGui(Player player, String title, int size, int maxPage) {
|
||||
public PageGui(Player player, Component title, int size, int maxPage) {
|
||||
super(player, title, size);
|
||||
this.maxPage = maxPage;
|
||||
}
|
||||
|
@ -41,8 +42,7 @@ public class PageGui extends IGui {
|
|||
Button button = entry.getValue();
|
||||
if (button.isAsynchronous()) {
|
||||
AuLib.inst().getServer().getScheduler().runTaskAsynchronously(AuLib.inst(), ()->{
|
||||
if (button instanceof ItemButton) {
|
||||
ItemButton itemButton = (ItemButton) button;
|
||||
if (button instanceof ItemButton itemButton) {
|
||||
if (itemButton.getItem() != null) {
|
||||
inventory.setItem(entry.getKey(), itemButton.getItem());
|
||||
return;
|
||||
|
@ -51,8 +51,7 @@ public class PageGui extends IGui {
|
|||
inventory.setItem(entry.getKey(), button.getItemStack());
|
||||
});
|
||||
} else {
|
||||
if (button instanceof ItemButton) {
|
||||
ItemButton itemButton = (ItemButton) button;
|
||||
if (button instanceof ItemButton itemButton) {
|
||||
if (itemButton.getItem() != null) {
|
||||
inventory.setItem(entry.getKey(), itemButton.getItem());
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue
Block a user