Java Code Examples for org.bukkit.entity.LivingEntity#getType()
The following examples show how to use
org.bukkit.entity.LivingEntity#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatsListener.java From ScoreboardStats with MIT License | 6 votes |
/** * Tracks the mob kills. * * @param event the death event */ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) public void onMobDeath(EntityDeathEvent event) { LivingEntity entity = event.getEntity(); //killer is null if it's not a player Player killer = entity.getKiller(); //Check if it's not player because we are already handling it if (entity.getType() != EntityType.PLAYER && Settings.isActiveWorld(entity.getWorld().getName())) { database.getStats(killer).ifPresent(stats -> { //If the cache entry is loaded and the player isn't null, increase the mob kills stats.onMobKill(); ReplaceManager.getInstance().forceUpdate(killer, "mob", stats.getMobkills()); }); } }
Example 2
Source File: PlayerDeathMessageByEliteMob.java From EliteMobs with GNU General Public License v3.0 | 4 votes |
public static String intializeDeathMessage(Player player, LivingEntity livingEntity) { String deathMessage; /* Deal with players dying from Elite Mobs */ switch (livingEntity.getType()) { case BLAZE: deathMessage = deathMessageSender(MobCombatSettingsConfig.BLAZE_DEATH_MESSAGE, player, livingEntity); break; case CREEPER: deathMessage = deathMessageSender(MobCombatSettingsConfig.CREEPER_DEATH_MESSAGE, player, livingEntity); break; case ENDERMAN: deathMessage = deathMessageSender(MobCombatSettingsConfig.ENDERMAN_DEATH_MESSAGE, player, livingEntity); break; case ENDERMITE: deathMessage = deathMessageSender(MobCombatSettingsConfig.ENDERMITE_DEATH_MESSAGE, player, livingEntity); break; case IRON_GOLEM: deathMessage = deathMessageSender(MobCombatSettingsConfig.IRONGOLEM_DEATH_MESSAGE, player, livingEntity); break; case POLAR_BEAR: deathMessage = deathMessageSender(MobCombatSettingsConfig.POLARBEAR_DEATH_MESSAGE, player, livingEntity); break; case SILVERFISH: deathMessage = deathMessageSender(MobCombatSettingsConfig.SILVERFISH_DEATH_MESSAGE, player, livingEntity); break; case SKELETON: deathMessage = deathMessageSender(MobCombatSettingsConfig.SKELETON_DEATH_MESSAGE, player, livingEntity); break; case SPIDER: deathMessage = deathMessageSender(MobCombatSettingsConfig.SPIDER_DEATH_MESSAGE, player, livingEntity); break; case WITCH: deathMessage = deathMessageSender(MobCombatSettingsConfig.WITCH_DEATH_MESSAGE, player, livingEntity); break; case ZOMBIE: deathMessage = deathMessageSender(MobCombatSettingsConfig.ZOMBIE_DEATH_MESSAGE, player, livingEntity); break; case HUSK: deathMessage = deathMessageSender(MobCombatSettingsConfig.HUSK_DEATH_MESSAGE, player, livingEntity); break; case PIG_ZOMBIE: deathMessage = deathMessageSender(MobCombatSettingsConfig.ZOMBIE_PIGMAN_DEATH_MESSAGE, player, livingEntity); break; case STRAY: deathMessage = deathMessageSender(MobCombatSettingsConfig.STRAY_DEATH_MESSAGE, player, livingEntity); break; case WITHER_SKELETON: deathMessage = deathMessageSender(MobCombatSettingsConfig.WITHER_SKELETON_DEATH_MESSAGE, player, livingEntity); break; default: deathMessage = deathMessageSender(MobCombatSettingsConfig.DEFAULT_DEATH_MESSAGE, player, livingEntity); break; } return deathMessage; }