Java Code Examples for org.bukkit.event.entity.EntityRegainHealthEvent#setCancelled()
The following examples show how to use
org.bukkit.event.entity.EntityRegainHealthEvent#setCancelled() .
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: DeathListener.java From Civs with GNU General Public License v3.0 | 6 votes |
@EventHandler(ignoreCancelled = true) public void onFoodHeal(EntityRegainHealthEvent event) { if (event.getRegainReason() != EntityRegainHealthEvent.RegainReason.SATIATED || ConfigManager.getInstance().getFoodHealInCombat()) { return; } if (!(event.getEntity() instanceof Player)) { return; } Player player = (Player) event.getEntity(); Civilian civilian = CivilianManager.getInstance().getCivilian(player.getUniqueId()); if (!civilian.isInCombat()) { return; } event.setCancelled(true); }
Example 2
Source File: HorseHealingModule.java From UHC with MIT License | 5 votes |
@EventHandler(ignoreCancelled = true) public void on(EntityRegainHealthEvent event) { if (isEnabled()) return; if (event.getEntityType() != EntityType.HORSE) return; event.setCancelled(true); }
Example 3
Source File: UHPluginListener.java From KTP with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onEntityRegainHealth(final EntityRegainHealthEvent ev) { if (ev.getRegainReason() == RegainReason.SATIATED) ev.setCancelled(true); if (ev.getEntity() instanceof Player) { Bukkit.getScheduler().runTaskLater(this.p, new BukkitRunnable() { @Override public void run() { p.updatePlayerListName((Player)ev.getEntity()); } }, 1L); } }
Example 4
Source File: EntityListener.java From AuthMeReloaded with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void entityRegainHealthEvent(EntityRegainHealthEvent event) { if (listenerService.shouldCancelEvent(event)) { event.setAmount(0); event.setCancelled(true); } }