本文整理匯總了Java中org.bukkit.entity.HumanEntity.closeInventory方法的典型用法代碼示例。如果您正苦於以下問題:Java HumanEntity.closeInventory方法的具體用法?Java HumanEntity.closeInventory怎麽用?Java HumanEntity.closeInventory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.HumanEntity
的用法示例。
在下文中一共展示了HumanEntity.closeInventory方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clearInventory
import org.bukkit.entity.HumanEntity; //導入方法依賴的package包/類
public void clearInventory(Location l) {
BlockMenu menu = getInventory(l);
for(HumanEntity human: new ArrayList<>(menu.toInventory().getViewers())) {
human.closeInventory();
}
inventories.get(l).delete(l);
inventories.remove(l);
}
示例2: withTitle
import org.bukkit.entity.HumanEntity; //導入方法依賴的package包/類
/**
* Change the title of the inventory and <i>optionally</i> update it to all viewers
*
* @param title new title of the inventory
* @param refresh if <code>true</code>, the inventory will be re-opened to all viewers
* @return the InventoryMenuBuilder
*/
public InventoryMenuBuilder withTitle(String title, boolean refresh) {
validateInit();
InventoryHelper.changeTitle(this.inventory, title);
if (refresh) {
for (HumanEntity viewer : this.inventory.getViewers()) {
viewer.closeInventory();
viewer.openInventory(this.inventory);
}
}
return this;
}
示例3: close
import org.bukkit.entity.HumanEntity; //導入方法依賴的package包/類
public void close() {
for(HumanEntity human: new ArrayList<>(toInventory().getViewers())) {
human.closeInventory();
}
}
示例4: refreshInventory
import org.bukkit.entity.HumanEntity; //導入方法依賴的package包/類
/**
* Simply an alias that executes {@link HumanEntity#closeInventory()} and then
* {@link HumanEntity#openInventory(Inventory)}.
*
* @param holder The HumanEntity that you wish to refresh the inventory for.
*/
public void refreshInventory(HumanEntity holder){
holder.closeInventory();
holder.openInventory(getInventory());
}