@EventHandler public void onEat(FoodLevelChangeEvent event) { if (event.getEntityType() == EntityType.PLAYER) { Player player = (Player)event.getEntity(); int foodLevelAdded = player.getFoodLevel() - event.getFoodLevel(); // Monitor added food level (food consumed) only if (foodLevelAdded < 0) { MagicDataService magicDataService = MagicDataService.getInstance(); PlayerMagicData data = magicDataService.getMagicData(player.getName()); if (player.getFoodLevel() < MagicDataService.MAX_FOOD_LEVEL) { data.addFoodLevelsToRegen(foodLevelAdded); } else // Reached maximum, make sure it doesn't regenerate for any reason { data.setFoodLevelsToRegen(0); data.setLastTimeRegenerated(0); } } } }
@EventHandler public void onFoodLevelChange(FoodLevelChangeEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); Game game = Skywars.getInstance().getGame(player); if (game != null && game.getGamePlayer(player) != null) { GamePlayer gamePlayer = game.getGamePlayer(player); if (!(game.isState(Game.GameState.ACTIVE) || game.isState(Game.GameState.DEATHMATCH))) { if (gamePlayer.isTeamClass()) { if (gamePlayer.getTeam().isPlayer(player)) { event.setFoodLevel(25); event.setCancelled(true); } } else { if (gamePlayer.getPlayer() == player) { event.setFoodLevel(25); event.setCancelled(true); } } } } } }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlace(FoodLevelChangeEvent event) { Entity entity = event.getEntity(); if(!(entity instanceof Player)) { return; } if(options.modeHungerLoss || !modeCoordinator.isInMode(((Player) entity).getUniqueId())) { return; } event.setCancelled(true); }
@EventHandler(priority = EventPriority.HIGH) public void onHunger(FoodLevelChangeEvent flce) { if (!(flce.getEntity() instanceof Player)) { return; } Player player = (Player) flce.getEntity(); Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player); if (game == null) { return; } if (game.getState() == GameState.RUNNING) { if (game.isSpectator(player) || game.getCycle().isEndGameRunning()) { flce.setCancelled(true); return; } flce.setCancelled(false); return; } flce.setCancelled(true); }
/** * Prevents changing of hunger while having a special permission and being on your island * @param e */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onHungerChange(final FoodLevelChangeEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName() + " food level = " + ((Player)e.getEntity()).getFoodLevel() + " new food level = " + e.getFoodLevel()); } // Allow food increases if (e.getFoodLevel() - ((Player)e.getEntity()).getFoodLevel() > 0) { return; } if (e.getEntity().hasPermission(Settings.PERMPREFIX + "nohunger")) { if(plugin.getGrid().playerIsOnIsland((Player) e.getEntity())) { e.setCancelled(true); } } }
@EventHandler public void onFoodChange(FoodLevelChangeEvent event){ if(Minigame.getCurrentMinigame()!=null){ switch(Minigame.getCurrentMinigame().getMap().getType()){ case CIRCLE_OF_BOOM: if(((CircleOfBoom)Minigame.getCurrentMinigame()).isCorrer()){ ((Player) event.getEntity()).setFoodLevel(20); } else { ((Player) event.getEntity()).setFoodLevel(6); } event.setCancelled(true); break; case KEY_QUEST: break; case WATER_THE_MONUMENT: break; default: break; } } }
@EventHandler(priority = EventPriority.HIGHEST) private void onPlayerHunger(FoodLevelChangeEvent event) { if (!(event.getEntity() instanceof Player)) return; Player p = (Player)event.getEntity(); IArenaPlayer player = ArenaPlayer.get(p); if (player == null) return; IArena arena = player.getArena(); if (arena == null) return; // get settings IContextSettings settings = player.getContextSettings(); if (settings == null) return; // prevent hunger if (!settings.isHungerEnabled()) { event.setFoodLevel(20); event.setCancelled(true); } }
@EventHandler(priority=EventPriority.HIGH) public void onFoodRegen(FoodLevelChangeEvent e){ if(e.getEntity() instanceof Player){ Player p = (Player) e.getEntity(); Game g = GameManager.getInstance().getGame(p); if(g != null){ if(g.gs == GameStage.Lobby || g.gs == GameStage.Build){ if(e.getFoodLevel() != 20){ e.setFoodLevel(20); } } } } }
@EventHandler public void onFoodLevelChange(FoodLevelChangeEvent event) { Entity e = event.getEntity(); ArenaManager am = SimpleSurvivalGames.instance.getArenaManager(); // Is the entity a player if(e instanceof Player) { Player p = (Player) e; // Is the current in any arean if(am.isInArena(p)) { ArenaPlayer ap = am.getPlayer(p); // The food level of the player may not be changed when he's in the lobby or when he's a spectator if(ap.isInLobby() || ap.isSpectator()) event.setCancelled(true); } } }
@EventHandler public void onHunger(FoodLevelChangeEvent event) { if (isSpectating((Player) event.getEntity())) { event.setCancelled(true); event.setFoodLevel(20); } }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void handleHungerChange(final FoodLevelChangeEvent event) { if(event.getEntity() instanceof Player) { int oldFoodLevel = ((Player) event.getEntity()).getFoodLevel(); event.setFoodLevel(oldFoodLevel); } }
@EventHandler public void onFood(FoodLevelChangeEvent e) { KingdomFactionsPlayer player = PlayerModule.getInstance().getPlayer(e.getEntity()); if(player != null) { if(player.getKingdom().getType() == KingdomType.GEEN) { e.setFoodLevel(20); } } }
@EventHandler protected void onFoodLevelChange(FoodLevelChangeEvent e) { if (e.getEntity() instanceof Player && !e.getEntity().hasMetadata("NPC") && SkyWarsReloaded.getPC().getPlayer(((Player) e.getEntity()).getUniqueId()).isSpectating()) { e.setCancelled(true); ((Player) e.getEntity()).setFoodLevel(20); ((Player) e.getEntity()).setSaturation(20); } }
@EventHandler public void onFoodChange(FoodLevelChangeEvent e) { Entity ent = e.getEntity(); if(ent instanceof Player) { GamePlayer hungry = SkyWarsReloaded.getPC().getPlayer(((Player) ent).getUniqueId()); if (hungry.inGame()) { Game game = hungry.getGame(); if (game != null) { if (game.getState() == GameState.PREGAME) { e.setCancelled(true); } } } } }
@EventHandler public void onFoodChange(FoodLevelChangeEvent e) { Entity ent = e.getEntity(); if(ent instanceof Player) { if (inLobbyWorld((Player) ent) && SkyWarsReloaded.getCfg().hungerDisabled()) { e.setCancelled(true); } } }
@EventHandler public void onFoodLevelChange(FoodLevelChangeEvent event) { event.setFoodLevel(20); Gamer g = Gamer.get(event.getEntity().getName()); if (g.getVariable("arena") != null) { Arena a = (Arena) g.getVariable("arena"); if (a.getState() == ArenaState.STARTED) return; } ((Player) event.getEntity()).setHealth(20); }
@EventHandler public void onFoodLevelChange(FoodLevelChangeEvent event) { if (Scheduler.getState() != State.PVP) { event.setFoodLevel(20); event.setCancelled(true); return; } }
@EventHandler @SuppressWarnings("unused") public void onEntityEat(FoodLevelChangeEvent e) { if (e.getEntity() instanceof Player) { Player player = (Player) e.getEntity(); if (player.getFoodLevel() < e.getFoodLevel()) { DACManager.getBackend().checkFastEat(player); } } }
@EventHandler public void onHungerChange(FoodLevelChangeEvent e){ if(e.getEntity() instanceof Player){ Player p = (Player) e.getEntity(); p.setSaturation(1000); p.setFoodLevel(20); } }
@EventHandler public void onFoodChange(FoodLevelChangeEvent e) { if (!(e.getEntity() instanceof Player)) { return; } Player p = (Player) e.getEntity(); if (!Utils.isInArena(p)) { return; } e.setCancelled(true); }
@EventHandler public void onHunger(FoodLevelChangeEvent event) { Game game = Chambers.getInstance().getGameManager().getGame(); if (game.getInvincibilityTime() > 0) { event.setCancelled(true); } }
@EventHandler public void onHunger(FoodLevelChangeEvent event) { Game game = Chambers.getInstance().getGameManager().getGame(); if (!game.hasStarted()) { event.setCancelled(true); } }
@EventHandler public void onHunger(FoodLevelChangeEvent event) { if (!(event.getEntity() instanceof Player)) { return; } Player player = (Player) event.getEntity(); PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player); if (profile.getStatus() == PlayerStatus.PLAYING) { return; } event.setCancelled(true); }
@EventHandler public void FoodLevel(FoodLevelChangeEvent event){ Entity p = event.getEntity(); if(!(p instanceof Player)){ return; } Player p1 = (Player)p; Arena a = new ArenaManager().getArena(p1); if(a==null||!a.isGame()){ event.setCancelled(true); } }
/** * Stop hunger depletion on the Hub */ @EventHandler public void onFoodLevelChange(FoodLevelChangeEvent event) { if (event.getEntity() instanceof Player && hub.hasPlayer((Player)event.getEntity())) { event.setCancelled(true); } }
@Override protected Float[] get(final Event e, final Player[] source) { return get(source, new Getter<Float, Player>() { @Override public Float get(final Player p) { if (getTime() >= 0 && e instanceof FoodLevelChangeEvent && p.equals(((FoodLevelChangeEvent) e).getEntity()) && !Delay.isDelayed(e)) { return 0.5f * ((FoodLevelChangeEvent) e).getFoodLevel(); } else { return 0.5f * p.getFoodLevel(); } } }); }
@EventHandler public void onFoodLevelChange(FoodLevelChangeEvent event) { HumanEntity entity = event.getEntity(); if (entity instanceof Player) { Player player = (Player) entity; Rotation rotation = manager.getRotationManager().getRotation(player); if (rotation != null && rotation.getState() == RotationState.INGAME) { MinigameAttributes attr = rotation.getCurrentMinigame().getAttributes(); if (attr.alwaysSaturated()) event.setCancelled(true); } else if (!manager.getMinigameSettings().lobbyHunger() && rotation != null && rotation.getState() != RotationState.INGAME) event.setCancelled(true); } }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerFoodLevelChange(FoodLevelChangeEvent evt) { if (evt.getEntity() instanceof Player) { Player player = (Player)evt.getEntity(); if (perkService.playerHasPerk(player, SurvivorTree.ExplorerId)) { if (player.getFoodLevel() > evt.getFoodLevel() && new Random(Calendar.getInstance().getTimeInMillis()).nextInt(2) == 1) { evt.setCancelled(true); } } } }
@EventHandler(priority = EventPriority.LOWEST) public void onFoodLevelChange(FoodLevelChangeEvent evt) { if (!usingBeeLoginMod) return; HumanEntity EPlayer = evt.getEntity(); if (EPlayer instanceof Player) { Player player = (Player) EPlayer; if (!loginStatus.get(player.getName().toLowerCase())) { evt.setCancelled(true); } } }
@EventHandler(ignoreCancelled = true,priority = EventPriority.LOW) public void checkFood(FoodLevelChangeEvent event) { Area a = getArea(new Loc(event.getEntity().getLocation(),false)); if(a != null && !a.getAllowHunger()) { event.setFoodLevel(20); //event.setCancelled(true); } }
@EventHandler public void onHungerGain(FoodLevelChangeEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); if (PlayerList.isPlayerPlaying(player.getUniqueId().toString())) { event.setCancelled(true); } } }
@EventHandler(priority = EventPriority.HIGH) public void onFoodLevelChange(FoodLevelChangeEvent e) { try { if (e.getEntity() instanceof Player && config.getBoolean("InvisibilityFeatures.DisableHunger")) { Player p = (Player) e.getEntity(); if (plugin.getVanishStateMgr().isVanished(p.getUniqueId()) && e.getFoodLevel() <= p.getFoodLevel()) e.setCancelled(true); } } catch (Exception er) { plugin.logException(er); } }
/** * Handles players losing food in the lobby * * @param e an event representing a player losing food * @see FoodLevelChangeEvent * @since 2.1.0 */ @EventHandler public void onFoodLevelChange(FoodLevelChangeEvent e) { HumanEntity entity = e.getEntity(); if (!(entity instanceof Player) || ArenaManager.getInstance().getArena((Player) entity) == null) return; e.setCancelled(true); }
@EventHandler public void onHunger(FoodLevelChangeEvent e){ if (!(e.getEntity() instanceof Player)){ return; } Player p = (Player) e.getEntity(); Region r = RedProtect.get().rm.getTopRegion(p.getLocation()); if (r != null && !r.canHunger()){ e.setCancelled(true); } }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerHungerEvent(FoodLevelChangeEvent e) { if (e.getEntityType() == EntityType.PLAYER) { for (Minigame mg : Minigame.getMinigameInstances()) { if (!mg.getConfigManager().isHungerEnabled() && mg.isPlayer((e.getEntity()).getName())) { e.setCancelled(true); } } } }
@EventHandler public void onFeed(FoodLevelChangeEvent e) { if (BlockParty.onFloorPlayers.containsKey(e.getEntity().getName())) { e.setFoodLevel(20); } if (BlockParty.inLobbyPlayers.containsKey(e.getEntity().getName())) { e.setFoodLevel(20); } }