當前位置: 首頁>>代碼示例>>Java>>正文


Java Bukkit.createInventory方法代碼示例

本文整理匯總了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);
}
 
開發者ID:ijoeleoli,項目名稱:ZorahPractice,代碼行數:21,代碼來源:PartyEventMenu.java

示例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());
}
 
開發者ID:EntryPointKR,項目名稱:MCLibrary,代碼行數:9,代碼來源:BaseInventoryFactory.java

示例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;
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:12,代碼來源:AContainer.java

示例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;
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:13,代碼來源:SimpleMovingInventory.java

示例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);
}
 
開發者ID:Personinblack,項目名稱:black,代碼行數:11,代碼來源:ChestPage.java

示例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());

}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:37,代碼來源:PremiosShopEvent.java

示例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);
}
 
開發者ID:benNek,項目名稱:AsgardAscension,代碼行數:12,代碼來源:MainInventory.java

示例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);
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:13,代碼來源:FichasMenu.java

示例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;
}
 
開發者ID:RoboTricker,項目名稱:Transport-Pipes,代碼行數:28,代碼來源:CreativeCommandExecutor.java

示例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);
}
 
開發者ID:WoutDev,項目名稱:Mega-Walls,代碼行數:15,代碼來源:Gui.java

示例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);
}
 
開發者ID:NyaaCat,項目名稱:Ourtown,代碼行數:41,代碼來源:SpawnGUI.java

示例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());
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:14,代碼來源:WeaponShop.java

示例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;
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:6,代碼來源:MenuManager.java

示例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;
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:5,代碼來源:ItemInventory.java

示例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);
}
 
開發者ID:ijoeleoli,項目名稱:ZorahPractice,代碼行數:60,代碼來源:PartyListArgument.java


注:本文中的org.bukkit.Bukkit.createInventory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。