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


Java Material.ENDER_CHEST属性代码示例

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


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

示例1: onCraft

/**
 * Prevents crafting of EnderChest unless the player has permission
 *
 * @param event
 */
@EventHandler(priority = EventPriority.LOW)
public void onCraft(CraftItemEvent event) {
    if (DEBUG) {
        plugin.getLogger().info(event.getEventName());
    }
    Player player = (Player) event.getWhoClicked();
    if (Util.inWorld(player) || player.getWorld().equals(IslandWorld.getNetherWorld())) {
        if (event.getRecipe().getResult().getType() == Material.ENDER_CHEST) {
            if (!(player.hasPermission(Settings.PERMPREFIX + "craft.enderchest"))) {
                Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("general.errors.no-permission"));
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:20,代码来源:IslandGuard.java

示例2: onEnderChestEvent

/**
 * Prevents usage of an Ender Chest
 *
 * @param event
 */

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEnderChestEvent(PlayerInteractEvent event) {
    if (DEBUG) {
        plugin.getLogger().info("Ender chest " + event.getEventName());
    }
    Player player = (Player) event.getPlayer();
    if (Util.inWorld(player) || player.getWorld().equals(IslandWorld.getNetherWorld())) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (event.getClickedBlock().getType() == Material.ENDER_CHEST) {
                if (!(event.getPlayer().hasPermission(Settings.PERMPREFIX + "craft.enderchest"))) {
                    Util.sendMessage(player, plugin.getLocale(player.getUniqueId()).get("general.errors.no-permission"));
                    event.setCancelled(true);
                }
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:23,代码来源:IslandGuard.java

示例3: onPlayerInteract

@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent event)
{
    if (this.canDoAction(event.getPlayer()))
        return;

    if (event.getItem() != null && (event.getItem().getType() == Material.ENDER_PEARL || event.getItem().getType() == Material.SNOW_BALL || event.getItem().getType() == Material.EGG || isPieceOfArmor(event.getItem())))
    {
        event.setCancelled(true);
        event.getPlayer().updateInventory();
    }

    if (event.getClickedBlock() != null && (event.getClickedBlock().getType() == Material.CHEST || event.getClickedBlock().getType() == Material.ENDER_CHEST))
    {
        event.setCancelled(true);
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:17,代码来源:PlayerProtectionListener.java

示例4: getTradingItem

private VillagerTrade getTradingItem(MerchantCategory category,
		ItemStack stack, Game game, Player player) {
	for (VillagerTrade trade : category.getOffers()) {
		if ((trade.getItem1().getType() != Material.AIR)
				|| (trade.getRewardItem().getType() != Material.AIR)) {
			ItemStack iStack = toItemStack(trade, player, game);
			if ((iStack.getType() == Material.ENDER_CHEST)
					&& (stack.getType() == Material.ENDER_CHEST))
				return trade;
			if (((iStack.getType() == Material.POTION) || ((Main
					.getInstance().getCurrentVersion().startsWith("v1_9")) && ((iStack
					.getType().equals(Material.valueOf("TIPPED_ARROW")))
					|| (iStack.getType().equals(Material
							.valueOf("LINGERING_POTION"))) || (iStack
						.getType()
					.equals(Material.valueOf("SPLASH_POTION"))))))
					&& (((PotionMeta) iStack.getItemMeta())
							.getCustomEffects().equals(((PotionMeta) stack
							.getItemMeta()).getCustomEffects()))) {
				return trade;
			}
			if (iStack.equals(stack)) {
				return trade;
			}
		}
	}
	return null;
}
 
开发者ID:Ldcr993519867,项目名称:BedwarsXP,代码行数:28,代码来源:XPItemShop.java

示例5: onPlayerBlockChange

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerBlockChange(final PlayerBlockTransformEvent event) {
    cancelUnlessInteracting(event, event.getPlayerState());

    if(!event.isCancelled() && event.getNewState().getType() == Material.ENDER_CHEST) {
        cancel(event, true, event.getWorld(), event.getPlayer(), new TranslatableComponent("match.enderChestsDisabled"));
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:EventFilterMatchModule.java

示例6: removeRecipe

/**
 * Removes the ender-chest crafting recipe from the server meaning it can only be obtained from creative mode.
 */
private void removeRecipe() {
    for (Iterator<Recipe> iterator = Bukkit.recipeIterator(); iterator.hasNext();) {
        if (iterator.next().getResult().getType() == Material.ENDER_CHEST) {
            iterator.remove();
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:10,代码来源:EnderChestRemovalListener.java

示例7: 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

示例8: onEnderChestOpen

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEnderChestOpen(PlayerInteractEvent event) {
    if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.ENDER_CHEST) {
        event.setCancelled(true);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:6,代码来源:EnderChestRemovalListener.java

示例9: onCommand

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,代码行数:59,代码来源:PartyListArgument.java


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