@EventHandler(priority = EventPriority.LOWEST)
  public void EntityRegainHealthEvent(EntityRegainHealthEvent event) {
    if (event.isCancelled()) {
      return;
    }

    Entity entity = event.getEntity();
    if (!(entity instanceof Player)) {
      return;
    }

    Player player = (Player) entity;
    String name = player.getName().toLowerCase();

    if (PlayerCache.getInstance().isAuthenticated(name)) {
      return;
    }

    if (!data.isAuthAvailable(name)) {
      if (!Settings.isForcedRegistrationEnabled) {
        return;
      }
    }

    event.setCancelled(true);
  }
Esempio n. 2
0
  @EventHandler
  public void onEntityRegainHealth(EntityRegainHealthEvent event) {
    if (!(event.getEntity() instanceof Player)) return;

    Player p = (Player) event.getEntity();
    if (event.getRegainReason() == RegainReason.SATIATED && !p.hasPermission("fastfood.autoregain"))
      event.setCancelled(true);
  }
	@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
	public void onEntityRegainHealth(final EntityRegainHealthEvent event)
	{
		if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
			&& ess.getUser(event.getEntity()).isAfk() && ess.getSettings().getFreezeAfkPlayers())
		{
			event.setCancelled(true);
		}
	}
Esempio n. 4
0
 @EventHandler
 public void onHealthRegenerate(EntityRegainHealthEvent event) {
   EntityType entityType = event.getEntityType();
   if (entityType.equals(EntityType.PLAYER)) {
     if (GameManager.INSTANCE.getSession((Player) event.getEntity()) == null) return;
     if (event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.SATIATED)) {
       event.setCancelled(true);
     }
   }
 }
Esempio n. 5
0
 @EventHandler(priority = EventPriority.NORMAL)
 public void onEntityRegainHealth(EntityRegainHealthEvent event) {
   if (event.isCancelled()) return;
   Entity entity = event.getEntity();
   if (!(entity instanceof Player)) return;
   if (!Conf.vampiresCantRegainHealthFrom.contains(event.getRegainReason())) return;
   Player player = (Player) entity;
   VPlayer vplayer = VPlayers.i.get(player);
   if (!vplayer.isVampire()) return;
   event.setCancelled(true);
 }
 @Override
 public void onEntityRegainHealth(EntityRegainHealthEvent event) {
   if (usesPowerups != null) {
     debug.i("regaining health");
     Powerup p = usesPowerups.puActive.get((Player) event.getEntity());
     if (p != null) {
       if (p.canBeTriggered()) {
         if (p.isEffectActive(PowerupType.HEAL)) {
           event.setCancelled(true);
           p.commit(event);
         }
       }
     }
   }
 }
Esempio n. 7
0
 // EventHandlers for in-game
 @EventHandler
 public void onRegen(EntityRegainHealthEvent e) {
   if (e.getRegainReason() == RegainReason.SATIATED || e.getRegainReason() == RegainReason.REGEN)
     e.setCancelled(true);
 }