本文整理汇总了Java中org.bukkit.Bukkit.createInventory方法的典型用法代码示例。如果您正苦于以下问题:Java Bukkit.createInventory方法的具体用法?Java Bukkit.createInventory怎么用?Java Bukkit.createInventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Bukkit
的用法示例。
在下文中一共展示了Bukkit.createInventory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void open(Player player) {
PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player);
if (profile.getParty() == null) {
player.sendMessage(ChatColor.RED + "You must be in a party to open the event menu.");
return;
}
if (profile.getParty().getPlayers().size() < 2) {
player.sendMessage(ChatColor.RED + "You must have more than 2 players in your party to start an event.");
player.closeInventory();
return;
}
Inventory inv = Bukkit.createInventory(null, ManagerHandler.getLadderManager().getLadderAmount(), ChatColor.AQUA + "Party Events - Select an event");
inv.setItem(2, new ItemBuilder(Material.DIAMOND, ChatColor.AQUA + "Team Deathmatch", ChatColor.GRAY + "Click to select the", ChatColor.GRAY + "Team Deathmatch event.").getItem());
inv.setItem(6, new ItemBuilder(Material.DIAMOND, ChatColor.AQUA + "Free-for-All", ChatColor.GRAY + "Click to select the", ChatColor.GRAY + "Free-for-All event.").getItem());
player.openInventory(inv);
}
示例2: create
import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public Inventory create(GUI gui, HumanEntity viewer) {
GUISignature signature = gui.getSignature();
signature.title(titleCaught(signature.getTitle()));
return signature.getType() == InventoryType.CHEST ?
Bukkit.createInventory(null, signature.getSize(), signature.getTitle()) :
Bukkit.createInventory(null, signature.getType(), signature.getTitle());
}
示例3: inject
import org.bukkit.Bukkit; //导入方法依赖的package包/类
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, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(b).getItemInSlot(slot));
}
return inv;
}
示例4: getBlankPage
import org.bukkit.Bukkit; //导入方法依赖的package包/类
private Inventory getBlankPage(String name, int size) {
Inventory inv = Bukkit.createInventory(null, size, name);
for (int i = size - 8; i < size - 1; i++) {
inv.setItem(i,
new ItemBuilder(Material.STAINED_GLASS_PANE).setName(" ").setDamage((short) 7).build());
}
inv.setItem(size - 1, nextPage);
inv.setItem(size - 9, previousPage);
return inv;
}
示例5: showTo
import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void showTo(Player player) {
final Inventory inventory = Bukkit.createInventory(this, size, title);
for (Pane pane : panes) {
pane.displayOn(inventory);
}
player.openInventory(inventory);
}
示例6: init
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void init() {
casinoInventory = Bukkit.createInventory(null, 54, name);
//casinoInventory
//Primera fila
casinoInventory.setItem(1, new ItemMaker(Material.STICK).addUnsafeEnchant(Enchantment.KNOCKBACK, 10).setDisplayName(ChatColor.DARK_PURPLE + ChatColor.BOLD.toString() + "Palo de Billar").setLores("Niels Feijen usó éste palo.").build());
casinoInventory.setItem(3, new ItemMaker().getEnchantedBookMaker().addEnchantment(Enchantment.MENDING, 1).build());
casinoInventory.setItem(5, new ItemMaker().getEnchantedBookMaker().addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
casinoInventory.setItem(7, new ItemMaker().getEnchantedBookMaker().addEnchantment(Enchantment.DIG_SPEED, 5).build());
//Segunda fila
casinoInventory.setItem(10, new ItemMaker().getEnchantedBookMaker().addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
casinoInventory.setItem(12, new ItemMaker().getEnchantedBookMaker().addEnchantment(Enchantment.SILK_TOUCH, 1).build());
casinoInventory.setItem(14, new ItemMaker().getEnchantedBookMaker().addEnchantment(Enchantment.LOOT_BONUS_MOBS, 3).build());
casinoInventory.setItem(16, new ItemMaker(Material.EMERALD).setDisplayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Esmeralda").setAmount(9).build());
//Picos
casinoInventory.setItem(25, new ItemMaker(Material.DIAMOND_PICKAXE).addUnsafeEnchant(Enchantment.DIG_SPEED, 5).addUnsafeEnchant(Enchantment.MENDING, 1).addUnsafeEnchant(Enchantment.DURABILITY, 3).addUnsafeEnchant(Enchantment.SILK_TOUCH, 1).setDisplayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Baccarat").build());
casinoInventory.setItem(19, new ItemMaker(Material.DIAMOND_PICKAXE).addUnsafeEnchant(Enchantment.DIG_SPEED, 5).addUnsafeEnchant(Enchantment.MENDING, 1).addUnsafeEnchant(Enchantment.DURABILITY, 3).setDisplayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Baccarat").build());
casinoInventory.setItem(22, new ItemMaker(Material.DIAMOND_PICKAXE).addUnsafeEnchant(Enchantment.DIG_SPEED, 5).addUnsafeEnchant(Enchantment.MENDING, 1).addUnsafeEnchant(Enchantment.DURABILITY, 3).addUnsafeEnchant(Enchantment.LOOT_BONUS_BLOCKS, 3).setDisplayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Baccarat").build());
//Cuarta fila
casinoInventory.setItem(28, new ItemMaker(Material.DIAMOND).setDisplayName(ChatColor.BLUE + ChatColor.BOLD.toString() + "Diamantes").setAmount(9).build());
casinoInventory.setItem(30, new ItemMaker(Material.GOLD_INGOT).setDisplayName(ChatColor.GOLD + ChatColor.BOLD.toString() + "Oro").setAmount(9).build());
casinoInventory.setItem(32, new ItemMaker(Material.TOTEM).setDisplayName(ChatColor.GOLD + ChatColor.BOLD.toString() + "Totem de la Inmortalidad").build());
casinoInventory.setItem(34, new ItemMaker().getEnchantedBookMaker().addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
//Picos chetos
casinoInventory.setItem(40, new ItemMaker(Material.DIAMOND_PICKAXE).addUnsafeEnchant(Enchantment.DIG_SPEED, 10).addUnsafeEnchant(Enchantment.SILK_TOUCH, 1).setDisplayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Kappa").setUnbreakable().build());
casinoInventory.setItem(37, new ItemMaker(Material.DIAMOND_PICKAXE).addUnsafeEnchant(Enchantment.DIG_SPEED, 10).setDisplayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Kappa").setUnbreakable().build());
casinoInventory.setItem(43, new ItemMaker(Material.DIAMOND_PICKAXE).addUnsafeEnchant(Enchantment.DIG_SPEED, 10).addUnsafeEnchant(Enchantment.LOOT_BONUS_BLOCKS, 10).setDisplayName(ChatColor.YELLOW + ChatColor.BOLD.toString() + "Kappa").setUnbreakable().build());
//Sexta fila
casinoInventory.setItem(49, new ItemMaker(Material.PAPER).setDisplayName(ChatColor.DARK_GREEN + "Vale Casino").setLores("Item de Casino").build());
}
示例7: setupFoodEditMenu
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void setupFoodEditMenu(Player player, int food) {
Inventory inv = Bukkit.createInventory(player, 9, ChatColor.BOLD + "" + food + " Edit Menu");
inv.setItem(0, ItemStackGenerator.createItem(Material.PAPER, 0, 0, ChatColor.LIGHT_PURPLE + "Change name", null));
inv.setItem(1, ItemStackGenerator.createItem(Material.WORKBENCH, 0, 0, ChatColor.LIGHT_PURPLE + "Change item", null));
inv.setItem(2, ItemStackGenerator.createItem(Material.ARROW, 16, 0, ChatColor.LIGHT_PURPLE + "Change amount", null));
inv.setItem(3, ItemStackGenerator.createItem(Material.STICK, 0, 0, ChatColor.LIGHT_PURPLE + "Change data value", null));
inv.setItem(4, ItemStackGenerator.createItem(Material.WATER_LILY, 0, 0, ChatColor.LIGHT_PURPLE + "Add Effect", null));
inv.setItem(5, ItemStackGenerator.createItem(Material.BLAZE_POWDER, 0, 0, ChatColor.LIGHT_PURPLE + "Remove all Effects", null));
inv.setItem(8, ItemStackGenerator.createItem(Material.IRON_BARDING, 0, 0, ChatColor.LIGHT_PURPLE + "Test Food of the Gods", null));
player.openInventory(inv);
}
示例8: openInventory
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void openInventory(Player p){
Inventory inv = Bukkit.createInventory(null, 9, "Fichas");
new WCFichas(p).getPlayerFichas().keySet().forEach(f -> {
ItemStack i = f.getItemStack();
i.setAmount(1);
i.getItemMeta().setLore(Arrays.asList(ChatColor.AQUA + "Cantidad: " + ChatColor.GREEN + new WCFichas(p).getPlayerFichas().get(f)));
inv.addItem(i);
});
p.openInventory(inv);
}
示例9: onCommand
import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender cs, String[] args) {
if (!cs.hasPermission("transportpipes.creative")) {
return false;
}
if (cs instanceof Player) {
Inventory inv = Bukkit.createInventory(null, 9 * 3, LocConf.load(LocConf.CREATIVE_TITLE));
int i = 0;
List<ItemStack> ductItems = DuctItemUtils.getAllDuctItems();
for (ItemStack is : ductItems) {
ItemStack clonedIs = is.clone();
clonedIs.setAmount(16);
inv.setItem(i, clonedIs);
i++;
}
inv.setItem(i++, DuctItemUtils.getClonedWrenchItem());
((Player) cs).openInventory(inv);
} else {
cs.sendMessage("§cYou're not a player!");
}
return true;
}
示例10: open
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void open(Player p)
{
int size = 9;
for (int i = 1; i <= 6; i++)
{
if (9 * i > items.size())
size = 9 * i;
}
Inventory inv = Bukkit.createInventory(null, size, ChatColor.translateAlternateColorCodes('&', title));
p.openInventory(inv);
}
示例11: openGUI
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void openGUI(Player player, int page) {
Inventory inventory = Bukkit.createInventory(this, 54, I18n.format("user.select.gui.title"));
int pageCount;
pageCount = (spawnPoints.size() + 45 - 1) / 45;
int offset = 0;
if (page < 1 || page > pageCount) {
page = 1;
}
if (page > 1) {
offset = (page - 1) * (45);
}
setCurrentPage(page);
for (int i = 0; i < 45; i++) {
if (spawnPoints.size() > (offset + i)) {
String spawnName = spawnPoints.getOrDefault(offset + i, null);
if (spawnName != null) {
ItemStack itemStack = new ItemStack(plugin.config.gui_item);
addLore(plugin.config.spawnConfig.spawns.get(spawnName), itemStack);
inventory.setItem(i, itemStack);
continue;
}
}
break;
}
if (page > 1) {
ItemStack back = new ItemStack(Material.ARROW);
ItemMeta backItemMeta = back.getItemMeta();
backItemMeta.setDisplayName(I18n.format("user.info.back"));
back.setItemMeta(backItemMeta);
inventory.setItem(45, back);
}
if (page < pageCount) {
ItemStack nextPage = new ItemStack(Material.ARROW);
ItemMeta nextPageMeta = nextPage.getItemMeta();
nextPageMeta.setDisplayName(I18n.format("user.info.next_page"));
nextPage.setItemMeta(nextPageMeta);
inventory.setItem(53, nextPage);
}
player.openInventory(inventory);
}
示例12: init
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void init() {
weaponShop = Bukkit.createInventory(null, 27, name);
//weaponShop.setItem(9, AK.toItemStack());
weaponShop.setItem(10, Weapon.getBAZOOKA().toItemStack());
//weaponShop.setItem(11, Weapon.getCarabina.toItemStack());
weaponShop.setItem(12, Weapon.getGRENADE().toItemStack());
//weaponShop.setItem(13, Weapon.getHuntingRifle.toItemStack());
//weaponShop.setItem(14, new Olympia().toItemStack());
weaponShop.setItem(15, Weapon.getPYTHON().toItemStack());
//weaponShop.setItem(16, new RacistGrenade().toItemStack());
weaponShop.setItem(17, Weapon.getPYTHON().toItemStack());
}
示例13: createMenu
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static Inventory createMenu(Player p, String title, int rows, MenuItem[] info) {
Inventory inventory = Bukkit.createInventory(null, 9 * rows, title);
modifyMenu(p, inventory, info);
return inventory;
}
示例14: ItemInventory
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public ItemInventory(String name, int size, InventoryItem... items) {
this.inventory = Bukkit.createInventory(null, size, name);
this.items = items;
}
示例15: onCommand
import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void onCommand(CommandSender sender, String[] args) throws CommandException {
Player player = (Player) sender;
PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player);
Party party = profile.getParty();
if (party == null) {
throw new CommandException(Collections.singletonList("You do not have a party."));
}
boolean isLeader = false;
if (profile.getParty().getLeader().equals(player)) {
isLeader = true;
}
Inventory inv = Bukkit.createInventory(null, ManagerHandler.getPartyManager().getPartyInvAmount(), ChatColor.GOLD + "Party List");
if (!ManagerHandler.getPartyManager().getParties().isEmpty()) {
int i = 0;
for (Party pl : ManagerHandler.getPartyManager().getParties().values()) {
if (pl.equals(profile.getParty())) continue;
if (pl.getStatus() != PartyStatus.IDLE) continue;
ItemStack item = new ItemStack(Material.ENDER_CHEST);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GOLD + "Party of " + pl.getLeader().getName());
List<String> lore = new ArrayList<>();
int j = 0;
for (Player p : pl.getPlayers()) {
if (j > 6) {
lore.add("and more...");
break;
}
lore.add(p.getName());
j++;
}
if (isLeader) {
lore.add(ChatColor.GRAY + "Click to send this party a duel.");
} else {
lore.add(ChatColor.GRAY + "Click to view this party's info.");
}
meta.setLore(lore);
item.setItemMeta(meta);
inv.setItem(i, item);
i++;
}
}
player.openInventory(inv);
}