当前位置: 首页>>代码示例>>Java>>正文


Java Material.BARRIER属性代码示例

本文整理汇总了Java中org.bukkit.Material.BARRIER属性的典型用法代码示例。如果您正苦于以下问题:Java Material.BARRIER属性的具体用法?Java Material.BARRIER怎么用?Java Material.BARRIER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.BARRIER属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playSound

public static void playSound(InventoryClickEvent event) {
    if (event.getSlot() == -999) {
        return;
    }

    HumanEntity human = event.getWhoClicked();
    if (!(human instanceof Player)) {
        return;
    }

    ItemStack clicked = event.getCurrentItem();
    if (clicked == null || clicked.getType() == Material.AIR) {
        return;
    }

    if (clicked.getType() == Material.BARRIER) {
        ((Player) human).playSound(human.getLocation(), Sound.BLOCK_ANVIL_PLACE, 1, 1);
    } else if (clicked != null && !clicked.equals(PLACEHOLDER)) {
        ((Player) human).playSound(human.getLocation(), Sound.UI_BUTTON_CLICK, 1, 1);
    }
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:21,代码来源:PageGUI.java

示例2: mainMenu

public static Inventory mainMenu() {
	Inventory i = Bukkit.createInventory(null, 54, Messager.color("&bMain Menu"));
	
	
	ItemStack pending = new ItemStack(Material.BARRIER);
	ItemMeta pendingMeta = pending.getItemMeta();
	pendingMeta.setDisplayName(Messager.color("&cCurrent Ban Requests"));
	pendingMeta.setLore(Arrays.asList(Messager.color("&7Pending: " + Main.getPendingRequests())));
	pending.setItemMeta(pendingMeta);
	
	i.setItem(20, pending);
	
	// Remove the archived ones for now.
	
	/**
	ItemStack archive = new ItemStack(Material.CHEST);
	ItemMeta archiveMeta = archive.getItemMeta();
	archiveMeta.setDisplayName(Messager.color("&7Archived Requests"));
	archive.setItemMeta(archiveMeta);
	
	i.setItem(24, archive);
	**/
	
	return i;
}
 
开发者ID:JustBru00,项目名称:EpicBanRequests,代码行数:25,代码来源:GUIManager.java

示例3: bowEnchantGUI

public static void bowEnchantGUI(Player player){
    bowGUI = Bukkit.createInventory(null, 9, ChatColor.DARK_GRAY + " Bow Enchantments");

    ItemStack filler = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7);
    ItemMeta fillerMeta = filler.getItemMeta();
    fillerMeta.setDisplayName(ChatColor.GRAY + "");
    filler.setItemMeta(fillerMeta);

    ItemStack back = new ItemStack(Material.ARROW);
    ItemMeta backMeta = back.getItemMeta();
    backMeta.setDisplayName(ChatColor.RED + "Previous");
    back.setItemMeta(backMeta);

    ItemStack empty = new ItemStack(Material.BARRIER);
    ItemMeta emptyMeta = empty.getItemMeta();
    emptyMeta.setDisplayName(ChatColor.RED + "There are currently no bow enchants!");
    empty.setItemMeta(emptyMeta);

    bowGUI.setItem(0, filler);
    bowGUI.setItem(1, filler);
    bowGUI.setItem(2, filler);
    bowGUI.setItem(3, filler);
    bowGUI.setItem(4, empty);
    bowGUI.setItem(5, filler);
    bowGUI.setItem(6, filler);
    bowGUI.setItem(7, filler);
    bowGUI.setItem(8, back);

    player.openInventory(bowGUI);
}
 
开发者ID:Warvale,项目名称:Scorch,代码行数:30,代码来源:EnchantsCommand.java

示例4: onCloseInventory

@EventHandler
public void onCloseInventory(InventoryCloseEvent event)
{
	if(event.getInventory().getTitle() == Survival.Words.get("Firestriker"))
	{
		Inventory inv = event.getInventory();
		Player player = (Player) event.getPlayer();
		if(inv.getItem(0) != null)
			player.getWorld().dropItem(player.getLocation(), inv.getItem(0));
		if(inv.getItem(1) != null && inv.getItem(1).getType() != Material.BARRIER)
			player.getInventory().addItem(inv.getItem(1));
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:13,代码来源:FirestrikerClick.java

示例5: onInventoryClick

/**
 * Disable barrier taking in the players inventories
 *
 * @param event Event
 */
@EventHandler
public void onInventoryClick(InventoryClickEvent event)
{
    if (event.getClickedInventory() != null && event.getClickedInventory().getType() == InventoryType.PLAYER && event.getCurrentItem() != null && event.getCurrentItem().getType() == Material.BARRIER)
        event.setCancelled(true);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:11,代码来源:NineSlotsModule.java

示例6: onItemSpawn

/**
 * Remove barrier on drop
 *
 * @param event Event
 */
@EventHandler
public void onItemSpawn(ItemSpawnEvent event)
{
    if (event.getEntityType() != EntityType.DROPPED_ITEM)
        return;

    if (event.getEntity().getItemStack().getType() == Material.BARRIER)
        event.setCancelled(true);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:14,代码来源:NineSlotsModule.java

示例7: newInventory

public static void newInventory(CommandSender sender) {
Inventory tpmenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Menu - Page 1");

ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(" ");
empty.setItemMeta(emptyMeta);

ItemStack close = new ItemStack(Material.BARRIER);
ItemStack nextpage = new ItemStack(Material.SIGN);
ItemStack previouspage = new ItemStack(Material.SIGN);
ItemMeta npMeta = nextpage.getItemMeta();
ItemMeta ppMeta = previouspage.getItemMeta();
ItemMeta closeMeta = close.getItemMeta();
closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
   npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
   ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");
   
   for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
   	Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
    ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1,(byte) 3);
    SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
    skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport to " + ChatColor.GREEN + targetPlayer.getName());
    skullsMeta.setOwner(targetPlayer.getName());
    skulls.setItemMeta(skullsMeta);
    
    int beginningSlot = 9;
    tpmenu.setItem(i+beginningSlot, skulls);
   }
   
tpmenu.setItem(0, empty);
tpmenu.setItem(1, empty);
tpmenu.setItem(2, empty);
tpmenu.setItem(3, empty);
tpmenu.setItem(4, empty);
tpmenu.setItem(5, empty);
tpmenu.setItem(6, empty);
tpmenu.setItem(7, empty);
tpmenu.setItem(8, empty);
tpmenu.setItem(45, empty);
tpmenu.setItem(46, empty);
tpmenu.setItem(47, empty);
tpmenu.setItem(48, empty);
tpmenu.setItem(49, close);
tpmenu.setItem(50, empty);
tpmenu.setItem(51, empty);
tpmenu.setItem(52, empty);
tpmenu.setItem(53, nextpage);

((HumanEntity) sender).openInventory(tpmenu);
  }
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportMenu.java

示例8: newInventory

public static void newInventory(CommandSender sender) {
Inventory tpheremenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1");

ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(" ");
empty.setItemMeta(emptyMeta);

ItemStack close = new ItemStack(Material.BARRIER);
ItemStack nextpage = new ItemStack(Material.SIGN);
ItemStack previouspage = new ItemStack(Material.SIGN);
ItemMeta npMeta = nextpage.getItemMeta();
ItemMeta ppMeta = previouspage.getItemMeta();
ItemMeta closeMeta = close.getItemMeta();
closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
   npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
   ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");
   
   for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
   	Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
    ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1,(byte) 3);
    SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
    skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you.");
    skullsMeta.setOwner(targetPlayer.getName());
    skulls.setItemMeta(skullsMeta);
    
    int beginningSlot = 9;
    tpheremenu.setItem(i+beginningSlot, skulls);
   }
   
tpheremenu.setItem(0, empty);
tpheremenu.setItem(1, empty);
tpheremenu.setItem(2, empty);
tpheremenu.setItem(3, empty);
tpheremenu.setItem(4, empty);
tpheremenu.setItem(5, empty);
tpheremenu.setItem(6, empty);
tpheremenu.setItem(7, empty);
tpheremenu.setItem(8, empty);
tpheremenu.setItem(45, empty);
tpheremenu.setItem(46, empty);
tpheremenu.setItem(47, empty);
tpheremenu.setItem(48, empty);
tpheremenu.setItem(49, close);
tpheremenu.setItem(50, empty);
tpheremenu.setItem(51, empty);
tpheremenu.setItem(52, empty);
tpheremenu.setItem(53, nextpage);

((HumanEntity) sender).openInventory(tpheremenu);
  }
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportHereMenu.java

示例9: newInventory

public static void newInventory(CommandSender sender) {
    Inventory tpmenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Menu - Page 1");

    ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
    ItemMeta emptyMeta = empty.getItemMeta();
    emptyMeta.setDisplayName(" ");
    empty.setItemMeta(emptyMeta);

    ItemStack close = new ItemStack(Material.BARRIER);
    ItemStack nextpage = new ItemStack(Material.SIGN);
    ItemStack previouspage = new ItemStack(Material.SIGN);
    ItemMeta npMeta = nextpage.getItemMeta();
    ItemMeta ppMeta = previouspage.getItemMeta();
    ItemMeta closeMeta = close.getItemMeta();
    closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
    npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
    ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");

    for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
        Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
        ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
        SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
        skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport to " + ChatColor.GREEN + targetPlayer.getName());
        skullsMeta.setOwner(targetPlayer.getName());
        skulls.setItemMeta(skullsMeta);

        int beginningSlot = 9;
        tpmenu.setItem(i + beginningSlot, skulls);
    }

    tpmenu.setItem(0, empty);
    tpmenu.setItem(1, empty);
    tpmenu.setItem(2, empty);
    tpmenu.setItem(3, empty);
    tpmenu.setItem(4, empty);
    tpmenu.setItem(5, empty);
    tpmenu.setItem(6, empty);
    tpmenu.setItem(7, empty);
    tpmenu.setItem(8, empty);
    tpmenu.setItem(45, empty);
    tpmenu.setItem(46, empty);
    tpmenu.setItem(47, empty);
    tpmenu.setItem(48, empty);
    tpmenu.setItem(49, close);
    tpmenu.setItem(50, empty);
    tpmenu.setItem(51, empty);
    tpmenu.setItem(52, empty);
    tpmenu.setItem(53, nextpage);

    ((HumanEntity) sender).openInventory(tpmenu);
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportMenu.java

示例10: newInventory

public static void newInventory(CommandSender sender) {
    Inventory tpheremenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1");

    ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
    ItemMeta emptyMeta = empty.getItemMeta();
    emptyMeta.setDisplayName(" ");
    empty.setItemMeta(emptyMeta);

    ItemStack close = new ItemStack(Material.BARRIER);
    ItemStack nextpage = new ItemStack(Material.SIGN);
    ItemStack previouspage = new ItemStack(Material.SIGN);
    ItemMeta npMeta = nextpage.getItemMeta();
    ItemMeta ppMeta = previouspage.getItemMeta();
    ItemMeta closeMeta = close.getItemMeta();
    closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
    npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
    ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");

    for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
        Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
        ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
        SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
        skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you.");
        skullsMeta.setOwner(targetPlayer.getName());
        skulls.setItemMeta(skullsMeta);

        int beginningSlot = 9;
        tpheremenu.setItem(i + beginningSlot, skulls);
    }

    tpheremenu.setItem(0, empty);
    tpheremenu.setItem(1, empty);
    tpheremenu.setItem(2, empty);
    tpheremenu.setItem(3, empty);
    tpheremenu.setItem(4, empty);
    tpheremenu.setItem(5, empty);
    tpheremenu.setItem(6, empty);
    tpheremenu.setItem(7, empty);
    tpheremenu.setItem(8, empty);
    tpheremenu.setItem(45, empty);
    tpheremenu.setItem(46, empty);
    tpheremenu.setItem(47, empty);
    tpheremenu.setItem(48, empty);
    tpheremenu.setItem(49, close);
    tpheremenu.setItem(50, empty);
    tpheremenu.setItem(51, empty);
    tpheremenu.setItem(52, empty);
    tpheremenu.setItem(53, nextpage);

    ((HumanEntity) sender).openInventory(tpheremenu);
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportHereMenu.java

示例11: doInteraction

public void doInteraction(Player player, ItemStack stack)
{
    if (stack.getType() == Material.COMPASS)
    {
        this.hub.getGuiManager().openGui(player, new GuiMain(this.hub));
    }
    else if (stack.getType() == Material.SKULL_ITEM)
    {
        this.hub.getGuiManager().openGui(player, new GuiProfile(this.hub));
    }
    else if (stack.getType() == Material.ENDER_CHEST)
    {
        this.hub.getGuiManager().openGui(player, new GuiCosmetics(this.hub));
    }
    else if (stack.getType() == Material.GOLD_INGOT)
    {
        this.hub.getGuiManager().openGui(player, new GuiShop(this.hub));
    }
    else if (stack.getType() == Material.BARRIER && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
    {
        this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).quitPlayer(player);
    }
    else if (stack.getType() == Material.ENDER_PEARL && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
    {
        this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).failPlayer(player);
    }
    else if (player.getInventory().getHeldItemSlot() == 6)
    {
        this.hub.getServer().getScheduler().runTask(this.hub, () -> this.hub.getCosmeticManager().getGadgetManager().useSelectedCosmetic(player, stack));
    }
    else if (stack.getType() == Material.ELYTRA)
    {
        if (stack.getEnchantments().isEmpty())
        {
            ItemStack elytra = new ItemStack(Material.ELYTRA);
            ItemMeta meta = elytra.getItemMeta();
            meta.spigot().setUnbreakable(true);
            elytra.setItemMeta(meta);

            player.getInventory().setChestplate(elytra);
            this.setInventoryToPlayer(player);
        }
        else
        {
            player.getInventory().setChestplate(null);
            this.setInventoryToPlayer(player);
        }

        player.playSound(player.getLocation(), Sound.ENTITY_HORSE_SADDLE, 1F, 1F);
    }
    else if (stack.getType() == Material.FEATHER && player.isGliding() && player.getVelocity().lengthSquared() != 0)
    {
        if (!SamaGamesAPI.get().getPermissionsManager().hasPermission(player, "network.vip"))
        {
            player.sendMessage(ChatColor.RED + "Devenez VIP pour utiliser le booster.");
            return;
        }

        Vector velocity = player.getVelocity().add(player.getLocation().getDirection().normalize().multiply(1.5D));
        ((CraftPlayer)player).getHandle().motX = velocity.getX();
        ((CraftPlayer)player).getHandle().motY = velocity.getY();
        ((CraftPlayer)player).getHandle().motZ = velocity.getZ();
        ((CraftPlayer)player).getHandle().velocityChanged = true;
        player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 2F, 2F);

        this.hub.getServer().getScheduler().runTask(this.hub, () -> SamaGamesAPI.get().getAchievementManager().getAchievementByID(5).unlock(player.getUniqueId()));
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:68,代码来源:StaticInventory.java


注:本文中的org.bukkit.Material.BARRIER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。