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


Java PlayerShearEntityEvent.getEntity方法代码示例

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


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

示例1: onShear

import org.bukkit.event.player.PlayerShearEntityEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onShear(PlayerShearEntityEvent event) {
    Entity entity = event.getEntity();

    String username = webPlayerBridge.entityId2Username.get(entity.getEntityId());
    if (username == null) {
        return;
    }

    Player player = event.getPlayer();
    String playerName = player.getDisplayName();

    webPlayerBridge.notifySheared(username, playerName);
}
 
开发者ID:satoshinm,项目名称:WebSandboxMC,代码行数:15,代码来源:EntityListener.java

示例2: onPlayerShearEntity

import org.bukkit.event.player.PlayerShearEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerShearEntity(PlayerShearEntityEvent event) {
	if (!(event.getEntity() instanceof Sheep)) {
		return;
	}

	Player player = event.getPlayer();
	NormalAchievements category = NormalAchievements.SHEARS;
	if (!shouldIncreaseBeTakenIntoAccount(player, category)) {
		return;
	}

	updateStatisticAndAwardAchievementsIfAvailable(player, category, 1);
}
 
开发者ID:PyvesB,项目名称:AdvancedAchievements,代码行数:15,代码来源:AchieveShearListener.java

示例3: PlayerShear

import org.bukkit.event.player.PlayerShearEntityEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void PlayerShear(final PlayerShearEntityEvent event)
{
	if (!(event.getEntity() instanceof Player))
		return;
	final Player player = (Player) event.getEntity();
	if (plugin.isLoggedIn(player))
		return;
	event.setCancelled(true);
}
 
开发者ID:ST-DDT,项目名称:CrazyLogin,代码行数:11,代码来源:DynamicPlayerListener.java

示例4: onPlayerShear

import org.bukkit.event.player.PlayerShearEntityEvent; //导入方法依赖的package包/类
/**
 * Handler that prevents sheep shearing
 *
 * @param e The event
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerShear(PlayerShearEntityEvent e) {
    if (e.getEntity() instanceof Sheep && isFromParty(e.getEntity())) {
        e.setCancelled(true);
    }
}
 
开发者ID:Gibstick,项目名称:DiscoSheep,代码行数:12,代码来源:PartyEvents.java

示例5: onPlayerShearEntity

import org.bukkit.event.player.PlayerShearEntityEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onPlayerShearEntity (PlayerShearEntityEvent event) {
	
	int sheepShearMultiplier = Main.getPluginMain().getConfig().getInt("sheep shearing multiplier");
	sheepShearMultiplier = sheepShearMultiplier - 1;
	
	if (sheepShearMultiplier > 0) {
		
		Entity entity = event.getEntity();
		
		if (entity.getType().equals(EntityType.SHEEP)) {
		
			Sheep sheep = (Sheep) entity;
			
			int woolAmount = 0;
			
			for (int i = 0; i < sheepShearMultiplier; i ++) {
				
				woolAmount = woolAmount + ThreadLocalRandom.current().nextInt(1, 4);

			}
			
			ItemStack wool = new ItemStack(Material.WOOL, woolAmount, sheep.getColor().getData());
			
			entity.getWorld().dropItem(entity.getLocation(), wool);
			
		}
		
	}

}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:33,代码来源:Events.java

示例6: onPlayerShearEntity

import org.bukkit.event.player.PlayerShearEntityEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onPlayerShearEntity (PlayerShearEntityEvent event) {
	
	int sheepShearMultiplier = SQBoosters.multipliers[2];
	sheepShearMultiplier = sheepShearMultiplier - 1;
	
	if (sheepShearMultiplier > 0) {
		
		Entity entity = event.getEntity();
		
		if (entity.getType().equals(EntityType.SHEEP)) {
		
			Sheep sheep = (Sheep) entity;
			
			int woolAmount = 0;
			
			for (int i = 0; i < sheepShearMultiplier; i ++) {
				
				woolAmount = woolAmount + ThreadLocalRandom.current().nextInt(1, 4);

			}
			
			ItemStack wool = new ItemStack(Material.WOOL, woolAmount, sheep.getColor().getData());
			
			entity.getWorld().dropItem(entity.getLocation(), wool);
			
		}
		
	}

}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:33,代码来源:Events.java


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