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


Java Material.MOB_SPAWNER属性代码示例

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


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

示例1: onPlayerInteract

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent e) {
	if (!cm.isDisableChangeSpawnerType) {
		return;
	}
	if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
		if (e.getClickedBlock().getType() == Material.MOB_SPAWNER) {
			if (e.getItem() == null) {
				return;
			}
			if (e.getPlayer().isOp()) {
				return;
			}
			if (e.getItem().getType() == Material.MONSTER_EGG || e.getItem().getType() == Material.MONSTER_EGGS) {
				e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:19,代码来源:AntiUseEggsChangeSpawnerType.java

示例2: onModify

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onModify(PlayerInteractEvent evt) {
    if (!preventSpawnerModify || evt.getItem() == null || evt.getAction() != Action.RIGHT_CLICK_BLOCK) return;
    
    Player player = evt.getPlayer();
    if (Perms.has(player)) return;
    
    if (evt.getClickedBlock().getType() == Material.MOB_SPAWNER) {
        Material type = evt.getItem().getType();
        if (type == Material.MONSTER_EGG || type == Material.MONSTER_EGGS) {
            evt.setCancelled(true);
            AzureAPI.log(player, messagePreventSpawnerModify);
        }
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:15,代码来源:SpawnerController.java

示例3: onBlockPlace

@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {

	if (event.getItemInHand().getType() != Material.MOB_SPAWNER)
		return;

	ItemStack is = event.getItemInHand();
	if (!is.hasItemMeta())
		return;

	ItemMeta im = is.getItemMeta();

	if (!im.hasLore())
		return;

	String lore = im.getLore().toString();

	if (!lore.contains("Spawner:"))
		return;

	EntityType entity = getEntity(lore);

	if (entity == EntityType.AREA_EFFECT_CLOUD) {
		event.setCancelled(true);
		return;
	}

	setSpawner(event.getBlock(), entity);
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:29,代码来源:BlockPlace.java

示例4: ShopItem

public ShopItem(Material material, short value, int amount, int buyPrice, int sellPrice, String displayName,
		List<String> lore, boolean useDisplayName, String enchantments, String enchantmentLevels, int limit,
		String extraData) {
	this.amount = amount;
	ItemStack item = new ItemStack(material, amount, value);
	ItemMeta itemMeta = item.getItemMeta();

	if (useDisplayName) {
		itemMeta.setDisplayName(displayName);
	}

	if (!extraData.equalsIgnoreCase("") && !extraData.equalsIgnoreCase(" ") && material == Material.MOB_SPAWNER) {
		itemMeta.setLore(Arrays.asList("Spawner: " + extraData));
	}

	item.setItemMeta(itemMeta);
	addEnchantments(enchantments, enchantmentLevels, item);
	this.item = item;

	lore.addAll(Arrays.asList("Linker muis knop - kopen " + buyPrice + " coins"));
	if (sellPrice > 0)
		lore.addAll(Arrays.asList("Rechter muis knop - verkopen " + sellPrice + " coins"));

	if (!extraData.equalsIgnoreCase("") && !extraData.equalsIgnoreCase(" ") && material == Material.MOB_SPAWNER) {
		lore.addAll(Arrays.asList(" ", "Spawner: " + extraData));
	}

	this.limit = limit;

	if (isLimited()) {
		lore.addAll(Arrays.asList("Jouw faction kan dit item maximaal " + limit + "X kopen"));
	}

	ItemStack shopItem = new ItemStack(material, amount, value);
	ItemMeta shopItemMeta = shopItem.getItemMeta();
	shopItemMeta.setDisplayName(displayName);
	shopItemMeta.setLore(lore);
	shopItem.setItemMeta(shopItemMeta);
	addEnchantments(enchantments, enchantmentLevels, shopItem);
	this.displayItem = shopItem;

	this.sellPrice = sellPrice;
	this.buyPrice = buyPrice;

	this.itemID = ShopsModule.getInstance().getItemID(item);
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:46,代码来源:ShopItem.java


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