當前位置: 首頁>>代碼示例>>Java>>正文


Java FoodLevelChangeEvent.setFoodLevel方法代碼示例

本文整理匯總了Java中org.bukkit.event.entity.FoodLevelChangeEvent.setFoodLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java FoodLevelChangeEvent.setFoodLevel方法的具體用法?Java FoodLevelChangeEvent.setFoodLevel怎麽用?Java FoodLevelChangeEvent.setFoodLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.entity.FoodLevelChangeEvent的用法示例。


在下文中一共展示了FoodLevelChangeEvent.setFoodLevel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onFoodLevelChange

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
                    }
                }
            }
        }
    }
}
 
開發者ID:JordanOsterberg,項目名稱:SkywarsSeries,代碼行數:26,代碼來源:FoodLevel.java

示例2: onPlayerHunger

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:JCThePants,項目名稱:PV-Star,代碼行數:27,代碼來源:PlayerEventListener.java

示例3: onFoodRegen

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
				}
			}
		}
	}
}
 
開發者ID:WeaselBuilds,項目名稱:WeaselsWalls,代碼行數:17,代碼來源:FoodRegen.java

示例4: onHunger

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onHunger(FoodLevelChangeEvent event) {
    if (isSpectating((Player) event.getEntity())) {
        event.setCancelled(true);
        event.setFoodLevel(20);
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:8,代碼來源:SpectatorModule.java

示例5: handleHungerChange

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:8,代碼來源:HungerMatchModule.java

示例6: onFood

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
		}
		
	}
}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:11,代碼來源:DropEventListener.java

示例7: onFoodLevelChange

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:12,代碼來源:GeneralEvents.java

示例8: onFoodLevelChange

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onFoodLevelChange(FoodLevelChangeEvent event) {
	if (Scheduler.getState() != State.PVP) {
		event.setFoodLevel(20);
		event.setCancelled(true);
		return;
	}
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:9,代碼來源:Events.java

示例9: checkFood

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:MrLittleKitty,項目名稱:AnnihilationPro,代碼行數:11,代碼來源:Areas.java

示例10: onFeed

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:Hansdekip,項目名稱:BlockParty-1.8,代碼行數:10,代碼來源:FeedListener.java

示例11: onHungerChange

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onHungerChange(FoodLevelChangeEvent event) {
   MMPlayer player = MMGames.getPlugin().getPlayer(event.getEntity().getName());
   if (!(player.inGame() && GameSettings.HUNGER)) {
      event.setFoodLevel(20);
   }
}
 
開發者ID:PaulBGD,項目名稱:MiniMiniGames,代碼行數:8,代碼來源:WorldListener.java

示例12: onFoodLevelChange

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onFoodLevelChange(FoodLevelChangeEvent event) {
    if (event.getEntity().getWorld().getName().equals("lobby")) {
        event.setCancelled(true);
        event.setFoodLevel(20);
    }
}
 
開發者ID:cancabron,項目名稱:Annihilation,代碼行數:8,代碼來源:PlayerListener.java

示例13: foodControl

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOW)
public void foodControl(FoodLevelChangeEvent event) {
    if(pl.getConfig().getBoolean(Settings.FOODCONTROL.getPath())) {
        if(pl.getJailManager().isPlayerJailed(event.getEntity().getUniqueId())) {
            int min = pl.getConfig().getInt(Settings.FOODCONTROLMIN.getPath());
            int max = pl.getConfig().getInt(Settings.FOODCONTROLMAX.getPath());

            if (event.getFoodLevel() <  min) {
                event.setFoodLevel(min);
            }else {
                event.setFoodLevel(max);
            }
        }
    }
}
 
開發者ID:graywolf336,項目名稱:Jail,代碼行數:16,代碼來源:PlayerListener.java

示例14: noHunger

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void noHunger(FoodLevelChangeEvent e){
	e.setCancelled(true);
	e.setFoodLevel(20);
}
 
開發者ID:OverloadedCore,項目名稱:kaosEssentials,代碼行數:6,代碼來源:Core.java

示例15: onFoodLevelChange

import org.bukkit.event.entity.FoodLevelChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onFoodLevelChange(FoodLevelChangeEvent event) {
	event.setFoodLevel(20);
	if (event.getEntity() instanceof Player)
		((Player) event.getEntity()).setHealth(20);
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:7,代碼來源:Events.java


注:本文中的org.bukkit.event.entity.FoodLevelChangeEvent.setFoodLevel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。