本文整理了Java中org.bukkit.Bukkit.createInventory()
方法的一些代码示例,展示了Bukkit.createInventory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.createInventory()
方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:createInventory
暂无
代码示例来源:origin: elBukkit/MagicPlugin
private void showGenericInventory(Player showPlayer) {
Inventory inventory = title != null && !title.isEmpty()
? Bukkit.createInventory(showPlayer, inventoryType, title)
: Bukkit.createInventory(showPlayer, inventoryType);
showPlayer.openInventory(inventory);
}
代码示例来源:origin: lucko/helper
public Gui(Player player, int lines, String title) {
this.player = Objects.requireNonNull(player, "player");
this.initialTitle = Text.colorize(Objects.requireNonNull(title, "title"));
this.inventory = Bukkit.createInventory(player, lines * 9, this.initialTitle);
this.slots = new HashMap<>();
}
代码示例来源:origin: FunnyGuilds/FunnyGuilds
public GuiWindow(String name, int rows) {
name = getValidName(name);
this.inv = Bukkit.createInventory(null, rows > 6 ? 6 * 9 : rows * 9, name);
this.items = new HashMap<>(rows > 6 ? 6 * 9 : rows * 9);
windows.put(name, this);
}
代码示例来源:origin: filoghost/ChestCommands
@Override
public Inventory getInventory() {
/*
* This inventory will not do anything.
* I'm 90% sure that it doesn't break any other plugin,
* because the only way you can get here is using InventoryClickEvent,
* that is cancelled by ChestCommands, or using InventoryOpenEvent.
*/
return Bukkit.createInventory(null, iconMenu.getSize());
}
代码示例来源:origin: FunnyGuilds/FunnyGuilds
public GuiWindow(String name, List<ItemStack> items) {
name = this.getValidName(name);
this.inv = Bukkit.createInventory(null, this.roundUp(items.size()), name);
this.items = new HashMap<>(this.roundUp(items.size()));
windows.put(name, this);
}
代码示例来源:origin: ProSavage/SavageFactions
public static String toBase64(ItemStack[] is, int size) {
Inventory inventory = Bukkit.createInventory(null, size);
inventory.setContents(is);
return toBase64(inventory);
}
代码示例来源:origin: BedwarsRel/BedwarsRel
public void createTeamInventory() {
Inventory inventory =
Bukkit.createInventory(null, InventoryType.ENDER_CHEST, BedwarsRel._l("ingame.teamchest"));
this.setInventory(inventory);
}
代码示例来源:origin: drtshock/PlayerVaults
public static String toBase64(ItemStack[] is, int size) {
Inventory inventory = Bukkit.createInventory(null, size);
inventory.setContents(is);
return toBase64(inventory, size);
}
代码示例来源:origin: Dytanic/CloudNet
public Inventory create(MobConfig mobConfig, ServerMob mob)
{
Inventory inventory = Bukkit.createInventory(null, mobConfig.getInventorySize(), ChatColor.translateAlternateColorCodes('&', mob.getDisplay() + NetworkUtils.SPACE_STRING));
for (Map.Entry<Integer, MobItemLayout> mobItem : mobConfig.getDefaultItemInventory().entrySet())
inventory.setItem(mobItem.getKey() - 1, transform(mobItem.getValue()));
return inventory;
}
代码示例来源:origin: Bkm016/TabooLib
public Inventory build() {
Inventory inventory = Bukkit.createInventory(new MenuBuilderHolder(lock, items), rows, name);
items.forEach((key, value) -> inventory.setItem(key, value.getItemStack()));
return inventory;
}
}
代码示例来源:origin: jiongjionger/NeverLag
public GUIMaker(Inventory inv) {
if (inv.getType() == InventoryType.CHEST) { // 自定义大小的 Inventory
this.inv = Bukkit.createInventory(inv.getHolder(), inv.getSize(), inv.getTitle());
} else { // 自定义类型的 Inventory
this.inv = Bukkit.createInventory(inv.getHolder(), inv.getType(), inv.getTitle());
}
this.inv.setContents(inv.getContents());
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
@Override
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.PORTABLE_DUSTBIN, true)) {
e.setCancelled(true);
p.openInventory(Bukkit.createInventory(null, 9 * 3, ChatColor.DARK_RED + "Delete Items"));
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 1, 1);
return true;
}
else return false;
}
});
代码示例来源:origin: MinusKube/SmartInvs
@Override
public Inventory open(SmartInventory inv, Player player) {
Preconditions.checkArgument(inv.getColumns() == 9,
"The column count for the chest inventory must be 9, found: %s.", inv.getColumns());
Preconditions.checkArgument(inv.getRows() >= 1 && inv.getRows() <= 6,
"The row count for the chest inventory must be between 1 and 6, found: %s", inv.getRows());
InventoryManager manager = inv.getManager();
Inventory handle = Bukkit.createInventory(player, inv.getRows() * inv.getColumns(), inv.getTitle());
fill(handle, manager.getContents(player).get());
player.openInventory(handle);
return handle;
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
private Inventory inject(Location l, int[] slots) {
int size = BlockStorage.getInventory(l).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: slots) {
inv.setItem(slot, BlockStorage.getInventory(l).getItemInSlot(slot));
}
return inv;
}
代码示例来源:origin: FunnyGuilds/FunnyGuilds
public void open(HumanEntity entity) {
Inventory inv = Bukkit.createInventory(entity, this.wrap().getSize(), this.wrap().getTitle());
inv.setContents(this.wrap().getContents());
entity.openInventory(inv);
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
private Inventory inject(Block b) {
int size = BlockStorage.getInventory(b).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(b).getItemInSlot(slot));
}
return inv;
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
private Inventory inject(Location l) {
int size = BlockStorage.getInventory(l).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(l).getItemInSlot(slot));
}
return inv;
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
private Inventory inject(Location l) {
int size = BlockStorage.getInventory(l).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(l).getItemInSlot(slot));
}
return inv;
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
private static Inventory inject(Location l) {
int size = BlockStorage.getInventory(l).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(l).getItemInSlot(slot));
}
return inv;
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
private Inventory inject(Block b) {
int size = BlockStorage.getInventory(b).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(b).getItemInSlot(slot));
}
return inv;
}
内容来源于网络,如有侵权,请联系作者删除!