public class GUI
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected boolean |
cancelOnOuter |
protected boolean |
cancelOnSelf |
protected boolean |
cancelOnTarget |
protected org.bukkit.inventory.ItemStack |
emptyItem |
protected java.util.Map<java.lang.String,java.lang.Object> |
flags |
protected org.bukkit.inventory.Inventory |
inv |
protected java.util.SortedMap<java.lang.Integer,GUIItem> |
items |
protected GUIListener |
listener |
protected @NotNull java.lang.String |
title |
protected @NotNull GUIType |
type |
限定符和类型 | 方法和说明 |
---|---|
protected void |
applyToInventory(org.bukkit.inventory.Inventory inventory) |
static void |
closeAll() |
protected void |
fillEmptySlots(@NotNull org.bukkit.inventory.Inventory inventory) |
java.lang.Object |
getFlag(java.lang.String flag) |
java.lang.String |
getGUIName() |
GUIType |
getGUIType() |
GUIItem |
getItem(int index) |
java.util.SortedMap<java.lang.Integer,GUIItem> |
getItems() |
static GUI |
getOpenedGUI(org.bukkit.entity.Player player) |
static java.util.Map<java.util.UUID,GUI> |
getOpenedGUIs() |
static org.bukkit.plugin.java.JavaPlugin |
getPlugin() |
static boolean |
hasOpenedGUI(org.bukkit.entity.Player player) |
static void |
initialize(org.bukkit.plugin.java.JavaPlugin plugin) |
void |
onClose()
关闭GUI时执行的代码
|
void |
onDrag(org.bukkit.event.inventory.InventoryDragEvent event)
拖动GUI内物品是执行的代码
|
void |
onUpdate()
当GUI更新时执行的代码
|
void |
openGUI(org.bukkit.entity.Player player) |
void |
rawClickListener(org.bukkit.event.inventory.InventoryClickEvent event) |
void |
removeFlag(java.lang.String flag) |
static void |
removeOpenedGUI(org.bukkit.entity.Player player) |
void |
setCancelOnOuter(boolean b)
设置是否取消点击GUI外的事件
如果不取消,玩家可以把物品从GUI或背包中丢出去
|
void |
setCancelOnSelf(boolean b)
设置是否取消点击自己背包内物品的事件
如果不取消,玩家可以从自己的背包中拿取物品。
|
void |
setCancelOnTarget(boolean b)
设置是否取消点击GUI内物品的事件
如果不取消,玩家可以从GUI中拿取物品。
|
void |
setEmptyItem(org.bukkit.inventory.ItemStack item) |
void |
setFlag(java.lang.String flag,
java.lang.Object obj) |
void |
setItem(GUIItem item,
int... index) |
void |
setItem(int index,
@Nullable GUIItem item) |
void |
setItem(int row,
int column,
@NotNull GUIItem item)
设置GUI上方(箱子部分)
|
void |
setItemStack(int index,
@Nullable org.bukkit.inventory.ItemStack item) |
void |
setItemStack(org.bukkit.inventory.ItemStack item,
int... index) |
static void |
setOpenedGUI(org.bukkit.entity.Player player,
GUI gui) |
void |
updateTitle(@NotNull java.lang.String title) |
void |
updateView()
更新玩家箱子的视图
|
@NotNull protected final @NotNull GUIType type
@NotNull protected @NotNull java.lang.String title
protected org.bukkit.inventory.Inventory inv
protected final java.util.SortedMap<java.lang.Integer,GUIItem> items
protected org.bukkit.inventory.ItemStack emptyItem
protected boolean cancelOnTarget
protected boolean cancelOnSelf
protected boolean cancelOnOuter
protected final java.util.Map<java.lang.String,java.lang.Object> flags
protected GUIListener listener
public GUI(@NotNull @NotNull GUIType type, @NotNull @NotNull java.lang.String title)
public static void initialize(org.bukkit.plugin.java.JavaPlugin plugin)
public static org.bukkit.plugin.java.JavaPlugin getPlugin()
public static java.util.Map<java.util.UUID,GUI> getOpenedGUIs()
public java.util.SortedMap<java.lang.Integer,GUIItem> getItems()
public final void setItem(int index, @Nullable @Nullable GUIItem item)
public void setItemStack(int index, @Nullable @Nullable org.bukkit.inventory.ItemStack item)
public void setItem(GUIItem item, int... index)
public void setItemStack(org.bukkit.inventory.ItemStack item, int... index)
public void setItem(int row, int column, @NotNull @NotNull GUIItem item)
row
- 行数,1为第1行column
- 列数,1为第1列item
- GUIItempublic GUIItem getItem(int index)
public void setEmptyItem(org.bukkit.inventory.ItemStack item)
protected void fillEmptySlots(@NotNull @NotNull org.bukkit.inventory.Inventory inventory)
protected void applyToInventory(org.bukkit.inventory.Inventory inventory)
public void updateTitle(@NotNull @NotNull java.lang.String title)
public void updateView()
public void setCancelOnTarget(boolean b)
b
- 是否取消public void setCancelOnSelf(boolean b)
b
- 是否取消public void setCancelOnOuter(boolean b)
b
- 是否取消public java.lang.Object getFlag(java.lang.String flag)
public void setFlag(java.lang.String flag, java.lang.Object obj)
public void removeFlag(java.lang.String flag)
public void rawClickListener(org.bukkit.event.inventory.InventoryClickEvent event)
public void openGUI(org.bukkit.entity.Player player)
public void onDrag(org.bukkit.event.inventory.InventoryDragEvent event)
event
- InventoryDragEventpublic void onClose()
public void onUpdate()
public GUIType getGUIType()
public java.lang.String getGUIName()
public static void setOpenedGUI(org.bukkit.entity.Player player, GUI gui)
public static boolean hasOpenedGUI(org.bukkit.entity.Player player)
public static GUI getOpenedGUI(org.bukkit.entity.Player player)
public static void removeOpenedGUI(org.bukkit.entity.Player player)
public static void closeAll()
Copyright © 2024. All rights reserved.