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


Java Material.ANVIL属性代码示例

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


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

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

示例2: onDamageSkull

@EventHandler
public void onDamageSkull(PlayerInteractEvent e) {
	if (cm.isAntiDamageSkull) {
		if (Action.RIGHT_CLICK_BLOCK == e.getAction()) {
			if (e.getItem() != null) {
				Material type = e.getItem().getType();
				if (Material.LAVA_BUCKET == type || Material.WATER_BUCKET == type) {
					fixSkull(e.getClickedBlock().getRelative(BlockFace.UP));
				} else if (Material.ANVIL == type) {
					for (BlockFace face : BLOCKFACE) {
						fixSkull(e.getClickedBlock().getRelative(face));
					}
				}
			}
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:17,代码来源:AntiDamageSkull.java

示例3: onBlockPlace

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
    if (!this.tracker.isEnabled(event.getBlock().getWorld())) return;

    if (event.getBlock().getType() == Material.ANVIL) {
        this.tracker.setPlacer(event.getBlock(), Bukkit.getOfflinePlayer(event.getPlayer().getUniqueId()));
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:8,代码来源:AnvilListener.java

示例4: onBlockBreak

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
    if (!this.tracker.isEnabled(event.getBlock().getWorld())) return;

    if (event.getBlock().getType() == Material.ANVIL) {
        this.tracker.clearPlacer(event.getBlock());
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:8,代码来源:AnvilListener.java

示例5: onBlockExplode

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockExplode(EntityExplodeEvent event) {
    if (!this.tracker.isEnabled(event.getLocation().getWorld())) return;

    // Remove all blocks that are destroyed from explosion
    for (Block block : event.blockList()) {
        if (block.getType() == Material.ANVIL) {
            this.tracker.clearPlacer(block);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:11,代码来源:AnvilListener.java

示例6: onAnvilFall

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAnvilFall(BlockFallEvent event) {
    if (!this.tracker.isEnabled(event.getEntity().getWorld())) return;

    if (event.getBlock().getType() == Material.ANVIL) {
        OfflinePlayer placer = tracker.getPlacer(event.getBlock());

        if (placer != null) {
            tracker.setOwner(event.getEntity(), tracker.getPlacer(event.getBlock()));
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:12,代码来源:AnvilListener.java

示例7: onAnvilLand

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAnvilLand(EntityChangeBlockEvent event) {
    if (!this.tracker.isEnabled(event.getEntity().getWorld())) return;

    if (event.getEntityType() == EntityType.FALLING_BLOCK && event.getTo() == Material.ANVIL) {
        OfflinePlayer owner = tracker.getOwner((FallingBlock) event.getEntity());
        if(owner != null) {
            tracker.setPlacer(event.getBlock(), tracker.getOwner((FallingBlock) event.getEntity()));
            tracker.setOwner((FallingBlock) event.getEntity(), null);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:12,代码来源:AnvilListener.java

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

示例9: onInteract

@EventHandler
public void onInteract(PlayerInteractEvent e) {
    final TOAUser u = TOA.getPlayer(e.getPlayer());

    if (e.getItem() != null) {
        Material m = e.getItem().getType();
        if (m == Material.WRITTEN_BOOK || m == Material.BOW || m == Material.SHEARS || m == Material.DIAMOND_SWORD) return;
        Ability.useAbility(u, e.getItem().getType());
        e.setCancelled(true);
    }

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

示例10: onPlace

@EventHandler(priority = EventPriority.MONITOR)
public void onPlace(ParticipantBlockTransformEvent event) {
    if(event.getNewState().getMaterial() == Material.ANVIL) {
        blocks().trackBlockState(event.getNewState(), new AnvilInfo(event.getPlayerState()));
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:6,代码来源:AnvilTracker.java

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

示例12: registerAbilities

/**
 * Registers all the abilities
 */
private void registerAbilities() {
	abilities = new ArrayList<>();
	Ability ability;
	
	// Haste
	ability = new Ability("Haste", Material.GOLD_BOOTS, 10, 100);
	ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE, ItemType.PICKAXE));
	ability.addDescription(ChatColor.GRAY + "Gives Haste Effect");
	ability.addDescription(ChatColor.GRAY + "Haste Level: " + ChatColor.RED + "I");
	abilities.add(ability);
	
	// Poison
	ability = new Ability("Poison", Material.BEETROOT, 15, 150);
	ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE));
	ability.addDescription(ChatColor.GRAY + "Poisons target enemy");
	ability.addDescription(ChatColor.GRAY + "Poison Level: " + ChatColor.RED + "I");
	ability.addDescription(ChatColor.GRAY + "Poison Duration: " + ChatColor.RED + "3 seconds");
	abilities.add(ability);
	
	// AoE (4 blocks)
	ability = new Ability("AoE", Material.GOLD_PICKAXE, 20, 750);
	ability.setItems(Arrays.asList(ItemType.PICKAXE));
	ability.addDescription(ChatColor.GRAY + "Destroys 4 blocks instead of 1");
	abilities.add(ability);
	
	// Magnet
	ability = new Ability("Magnet", Material.DETECTOR_RAIL, 25, 250);
	ability.setItems(Arrays.asList(ItemType.PICKAXE));
	ability.addDescription(ChatColor.GRAY + "Small chance to get crate key");
	ability.addDescription(ChatColor.GRAY + "Chance: " + ChatColor.RED + "0.01%");
	abilities.add(ability);
	
	// Flame
	ability = new Ability("Flame", Material.BLAZE_POWDER, 15, 750);
	ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE));
	ability.addDescription(ChatColor.GRAY + "Sets target on fire");
	ability.addDescription(ChatColor.GRAY + "Fire Duration: " + ChatColor.RED + "3 seconds");
	abilities.add(ability);
	
	// High Jump
	ability = new Ability("High Jump", Material.ELYTRA, 20, 200);
	ability.setItems(Arrays.asList(ItemType.BOOTS, ItemType.LEGGINGS, ItemType.CHESTPLATE, ItemType.HELMET));
	ability.addDescription(ChatColor.GRAY + "Jump 2 blocks high");
	ability.addDescription(ChatColor.GRAY + "Jump Level: " + ChatColor.RED + "II");
	abilities.add(ability);
	
	// Speed
	ability = new Ability("Speed", Material.FEATHER, 15, 150);
	ability.setItems(Arrays.asList(ItemType.BOOTS, ItemType.LEGGINGS, ItemType.CHESTPLATE, ItemType.HELMET));
	ability.addDescription(ChatColor.GRAY + "Gives speed boost");
	ability.addDescription(ChatColor.GRAY + "Speed Level: " + ChatColor.RED + "I");
	abilities.add(ability);
	
	// Lucky Repair
	ability = new Ability("Lucky Repair", Material.ANVIL, 25, 250);
	ability.setItems(Arrays.asList(ItemType.SWORD, ItemType.AXE, ItemType.PICKAXE));
	ability.addDescription(ChatColor.GRAY + "Small chance to repair item");
	ability.addDescription(ChatColor.GRAY + "Chance: " + ChatColor.RED + "0.01%");
	abilities.add(ability);
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:63,代码来源:AbilityManager.java


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