本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}