当前位置: 首页>>代码示例>>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;未经允许,请勿转载。