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


Java Material.ENCHANTMENT_TABLE屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.ENCHANTMENT_TABLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.ENCHANTMENT_TABLE屬性的具體用法?Java Material.ENCHANTMENT_TABLE怎麽用?Java Material.ENCHANTMENT_TABLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.ENCHANTMENT_TABLE屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openEnchanting

public InventoryView openEnchanting(Location location, boolean force) {
    if (!force) {
        Block block = location.getBlock();
        if (block.getType() != Material.ENCHANTMENT_TABLE) {
            return null;
        }
    }
    if (location == null) {
        location = getLocation();
    }
    getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
    if (force) {
        getHandle().openContainer.checkReachable = false;
    }
    return getHandle().openContainer.getBukkitView();
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:16,代碼來源:CraftHumanEntity.java

示例2: onInteract

@Override
public void onInteract(PlayerInteractEvent e, EquipmentSlot es)
{
	Player p = e.getPlayer();
	if(hasPermission(enchant_open, p))
	{	
	
	Location loc = new Location(p.getWorld(), 10000.0D, 255.0D, 10000.0D);
	//Can't be handled differently :(
	Block im5 = loc.getBlock();
       if(im5.getType() != Material.ENCHANTMENT_TABLE)
       {
          im5.setType(Material.ENCHANTMENT_TABLE);
       }
	
       p.openEnchanting(loc, true);
	}
	super.onInteract(e, es);
}
 
開發者ID:benfah,項目名稱:Bags2,代碼行數:19,代碼來源:BagEnchant.java

示例3: onGameStart

/**
 * Give 128 bookshelves, thousands of xp levels, 64 tables and 64 anvils to all the players
 *
 * @param game Game
 */
@Override
public void onGameStart(SurvivalGame game)
{
    ItemStack tables = new ItemStack(Material.ENCHANTMENT_TABLE, 64);
    ItemStack anvils = new ItemStack(Material.ANVIL, 64);
    ItemStack bookshelves = new ItemStack(Material.BOOKSHELF, 64);
    ItemStack lapis = new ItemStack(Material.INK_SACK, 64, (short)4);

    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.getInventory().addItem(tables);
        p.getInventory().addItem(anvils);
        p.getInventory().addItem(bookshelves);
        p.getInventory().addItem(lapis);
        p.setLevel(111111);
    }
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:27,代碼來源:InfiniteEnchanterModule.java

示例4: onPlayerInteract

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getAction() == Action.LEFT_CLICK_BLOCK && event.hasItem()) {
        // The player didn't click an enchantment table, Creative players will instantly destroy.
        Player player = event.getPlayer();
        if (event.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE && player.getGameMode() != GameMode.CREATIVE) {

            // The player didn't click with an enchanted book.
            ItemStack stack = event.getItem();
            if (stack != null && stack.getType() == Material.ENCHANTED_BOOK) {
                ItemMeta meta = stack.getItemMeta();
                if (meta instanceof EnchantmentStorageMeta) {
                    EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) meta;
                    for (Enchantment enchantment : enchantmentStorageMeta.getStoredEnchants().keySet()) {
                        enchantmentStorageMeta.removeStoredEnchant(enchantment);
                    }

                    event.setCancelled(true);
                    player.setItemInHand(EMPTY_BOOK);
                    player.sendMessage(ChatColor.GREEN + "You reverted this item to its original form.");
                }
            }
        }
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:25,代碼來源:BookDeenchantListener.java

示例5: isInteractiveBlock

/**
 * checks if this block would give a reaction if you click on it without
 * shifting, e.g. opening a chest or switching a lever
 */
public static boolean isInteractiveBlock(Block b) {
	if (b == null || b.getState() == null) {
		return false;
	}
	if (b.getType() == Material.WORKBENCH || b.getType() == Material.ENCHANTMENT_TABLE || b.getType() == Material.ANVIL || b.getType() == Material.BREWING_STAND || b.getState() instanceof InventoryHolder || b.getState() instanceof NoteBlock) {
		return true;
	}
	if (b.getState().getData() instanceof Button || b.getState().getData() instanceof Lever || b.getState().getData() instanceof Door || b.getState().getData() instanceof TrapDoor || b.getState().getData() instanceof Gate || b.getState().getData() instanceof Comparator) {
		if (b.getType() != Material.IRON_DOOR && b.getType() != Material.IRON_DOOR_BLOCK && b.getType() != Material.IRON_TRAPDOOR) {
			return true;
		}
	}
	return false;
}
 
開發者ID:RoboTricker,項目名稱:Transport-Pipes,代碼行數:18,代碼來源:HitboxUtils.java

示例6: onCraftItem

private static void onCraftItem(Recipe recipe, CraftingInventory inventory)
{
    if (recipe.getResult().getType() == Material.ENCHANTMENT_TABLE)
        inventory.setResult(new ItemStack(Material.AIR));
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:5,代碼來源:KillForEnchantmentModule.java

示例7: onInteract

@EventHandler
public void onInteract(PlayerInteractEvent e) {
    PAUser u = PAServer.getUser(e.getPlayer());

    if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
        if (e.getItem() == null) return;
        e.setCancelled(true);
        if (Cosmetic.useCosmetic(u, e.getItem().getType())) return;

        switch (e.getItem().getType()) {
            case NETHER_STAR:
                e.setCancelled(true);
                LobbyMenu.openMenu(u, LobbyMenu.MenuType.SERVERS);
                break;
            case REDSTONE:
                e.setCancelled(true);
                u.sendMessage(PAData.LOBBY.getPrefix() + "&cNo estamos listos aún");
                //LobbyMenu.openMenu(u, LobbyMenu.MenuType.COSMETICOS);
                break;
            case WOOD_AXE:
                e.setCancelled(true);
                u.sendToServer("cons");
                break;
        }

        if (e.getClickedBlock() == null) return;
        if (e.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE) {
            e.setCancelled(true);
            u.sendMessage(PAData.LOBBY.getPrefix() + "&cActualmente estamos trabajando en esto, disculpen las molestias");
        }
    }

    if (!u.isOnRank(PACmd.Grupo.Builder)) {
        if (e.getClickedBlock() != null) {
            if (e.getClickedBlock().getType().equals(Material.TRAP_DOOR) || e.getClickedBlock().getType().equals(Material.IRON_TRAPDOOR)
                    || e.getClickedBlock().getType().equals(Material.FENCE_GATE) || e.getClickedBlock().getType().equals(Material.FIRE)
                    || e.getClickedBlock().getType().equals(Material.CAULDRON) || e.getClickedBlock().getRelative(BlockFace.UP).getType().equals(Material.FIRE)
                    || e.getClickedBlock().getType() == Material.CHEST || e.getClickedBlock().getType() == Material.TRAPPED_CHEST
                    || e.getClickedBlock().getType() == Material.DROPPER || e.getClickedBlock().getType() == Material.DISPENSER
                    || e.getClickedBlock().getType() == Material.BED_BLOCK || e.getClickedBlock().getType() == Material.BED
                    || e.getClickedBlock().getType() == Material.WORKBENCH || e.getClickedBlock().getType() == Material.BREWING_STAND
                    || e.getClickedBlock().getType() == Material.ANVIL || e.getClickedBlock().getType() == Material.DARK_OAK_FENCE_GATE
                    || e.getClickedBlock().getType() == Material.SPRUCE_FENCE_GATE || e.getClickedBlock().getType() == Material.FURNACE
                    || e.getClickedBlock().getType() == Material.BURNING_FURNACE || e.getClickedBlock().getType() == Material.HOPPER
                    || e.getClickedBlock().getType() == Material.STONE_BUTTON || e.getClickedBlock().getType() == Material.WOOD_BUTTON) {
                e.setCancelled(true);
            }
        }
    }
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:50,代碼來源:PlayerEvents.java


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