当前位置: 首页>>代码示例>>Java>>正文


Java Player.setFoodLevel方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.setFoodLevel方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setFoodLevel方法的具体用法?Java Player.setFoodLevel怎么用?Java Player.setFoodLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.setFoodLevel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetPlayer(Player player) {
    player.setLevel(0);
    player.setExp(0);
    player.setFoodLevel(20);
    player.setHealth(20);
    player.setHealthScale(20);
    player.setExhaustion(0);
    player.getInventory().clear();
    ItemStack blankItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
    ItemMeta blankMeta = blankItem.getItemMeta();
    blankMeta.setDisplayName("" + ChatColor.RED);
    blankItem.setItemMeta(blankMeta);
    for(int i=9; i<=35; i++) {
        player.getInventory().setItem(i, blankItem);
    }
    player.getInventory().setHelmet(new ItemStack(Material.AIR, 1));
    player.getInventory().setChestplate(new ItemStack(Material.AIR, 1));
    player.getInventory().setLeggings(new ItemStack(Material.AIR, 1));
    player.getInventory().setBoots(new ItemStack(Material.AIR, 1));
    for(PotionEffect potionEffect : player.getActivePotionEffects()) {
        player.removePotionEffect(potionEffect.getType());
    }
    player.setFireTicks(0);
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:25,代码来源:Utils.java

示例2: onPreStart

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void onPreStart() {
    Location spawnLocation = Utils.parseLocation((String) this.getGameMap().fetchSetting("startPosition"));
    for(Player player : Bukkit.getOnlinePlayers()) {
        if(!this.getAPI().getGameManager().isAlive(player)) continue;
        player.teleport(spawnLocation);
        player.setGameMode(GameMode.ADVENTURE);
        player.setFoodLevel(1);
    }
    this.potionDropLocation = Utils.parseLocation((String) this.getGameMap().fetchSetting("potionDropPosition"));
    this.potionVelocityMultiplier = Double.parseDouble((String) this.getGameMap().fetchSetting("potionVelocityMultiplier"));
    this.healthDropPerTwoSeconds = Double.parseDouble((String) this.getGameMap().fetchSetting("healthDropPerTwoSeconds"));
    this.potionDropPerSecond = Integer.parseInt((String) this.getGameMap().fetchSetting("potionDropPerSecond"));

    this.poisonEffectDelayInSeconds = Integer.parseInt((String) this.getGameMap().fetchSetting("poisonEffectDelayInSeconds"))+1;
    this.witherEffectDelayInSeconds = Integer.parseInt((String) this.getGameMap().fetchSetting("witherEffectDelayInSeconds"))+1;
    this.slownessEffectDelayInSeconds = Integer.parseInt((String) this.getGameMap().fetchSetting("slownessEffectDelayInSeconds"))+1;
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:19,代码来源:PotionDropGame.java

示例3: handleLogin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void handleLogin(Player p)
{
    super.handleLogin(p);
    p.setGameMode(GameMode.ADVENTURE);
    p.setLevel(0);
    p.setExp(0);
    p.setFoodLevel(20);
    p.setSaturation(20);

    Location spec = new Location(AgarMC.get().getWorld(), origin.getX() + dimensions / 2, origin.getY() + 20, origin.getZ() + dimensions / 2);
    spec.setPitch(90);
    p.teleport(spec);
    p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
    if (gamePlayers.size() >= SamaGamesAPI.get().getGameManager().getGameProperties().getMaxSlots())
        this.status = Status.IN_GAME;
    Titles.sendTabTitle(p, ChatColor.GREEN + "Bienvenue sur " + ChatColor.AQUA + "SamaGames" + ChatColor.GREEN + " !\n",
            ChatColor.AQUA + "\nTeamSpeak : " + ChatColor.GREEN + "ts.samagames.net");
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:20,代码来源:AgarGame.java

示例4: onJoin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();

    event.setJoinMessage(null);

    if (!Skywars.getInstance().isSingleServerMode()) {
        player.setGameMode(GameMode.ADVENTURE);
        player.getInventory().clear();
        player.setMaxHealth(20);
        player.setHealth(player.getMaxHealth());
        player.setFoodLevel(25);

        player.teleport(Skywars.getInstance().getLobbyPoint());
    }
}
 
开发者ID:JordanOsterberg,项目名称:SkywarsSeries,代码行数:17,代码来源:PlayerJoin.java

示例5: joinLobby

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public synchronized boolean joinLobby(Player player) {
    if (this.canJoinLobby(player)) {
        this.lobby.add(player);
        this.storeTemporaryInventory(player);
        player.getInventory().setArmorContents(new ItemStack[4]);
        player.getInventory().clear();
        player.updateInventory();
        player.setHealth(player.getMaxHealth());
        player.setFoodLevel(20);
        player.setExp(0);
        player.setLevel(0);
        player.setGameMode(GameMode.ADVENTURE);
        player.teleport(this.getArena().getLobbyMeta().getLobbySpawn());
        return true;
    }
    return false;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:18,代码来源:HelperGameEntity.java

示例6: startup

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**Called when the first button within the entry Module was just pushed
  * Takes appropriate startup actions and then sets the state to RUNNING.
  */
private void startup() {
	getServer().getPluginManager().registerEvents(this, this);
	
	activePlayers = new LinkedList<>(getServer().getOnlinePlayers());
	
	// Backing up player modes to restore upon dungeon stop
	playersSnapshotAtStart = new ArrayList<GameMode>();// backup copy of gamemode
	for (int i=0; i<activePlayers.size(); i++) {
		playersSnapshotAtStart.add(activePlayers.get(i).getGameMode());
	}
	
	for (Player p : activePlayers) {
		p.setFoodLevel(18);
		p.setGameMode(GameMode.ADVENTURE);
		p.sendMessage("Your mode was set to adventure...");
		
		giveStartingGear(p);

	}
	
	state = State.RUNNING;
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:26,代码来源:DunGen.java

示例7: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void reset(Player player, boolean heal) {
    if (heal) player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
    player.setFoodLevel(20);
    player.setSaturation(20);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[]{new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR)});
    player.setItemOnCursor(new ItemStack(Material.AIR));

    player.getActivePotionEffects().forEach(potionEffect -> {
        try {
            player.removePotionEffect(potionEffect.getType());
        } catch (NullPointerException ignored) {}
    });

    player.setFireTicks(0);
    player.setFallDistance(0);
    player.setTotalExperience(0);
    player.setExp(0);
    player.setLevel(0);
    player.setWalkSpeed(0.2F);
    player.setFlySpeed(0.1F);

    player.setSneaking(false);
    player.setInvulnerable(false);
    player.setCanPickupItems(true);
    player.setCollidable(true);
    player.setFlying(false);
    player.setAllowFlight(false);

    player.resetTitle();

    for (Attribute attribute : Attribute.values()) {
        if (player.getAttribute(attribute) == null) continue;
        for (AttributeModifier modifier : player.getAttribute(attribute).getModifiers()) {
            player.getAttribute(attribute).removeModifier(modifier);
        }
    }
    player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).addModifier(new AttributeModifier(UUID.randomUUID(), "generic.attackSpeed", 24.000D, AttributeModifier.Operation.ADD_SCALAR));

    player.updateInventory();
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:42,代码来源:Players.java

示例8: onPlayerJoin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Should be executed when the player joins the server.
 */
protected void onPlayerJoin() {
	// Resets
	Player player = getPlayer();
	player.setLevel(0);
	player.setExp(0);
	player.setFoodLevel(20);
	player.setSaturation(20);
	player.setHealth(20);
	
	// TODO coherence
	getPlayer().sendMessage(ChatColor.GOLD + "Bienvenue en Apsorbtion !");
}
 
开发者ID:SamaGames,项目名称:Absorption,代码行数:16,代码来源:GamePlayer.java

示例9: resetPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetPlayer(Player player) {
    player.setCanPickupItems(false);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[4]);
    player.setHealth(20.0);
    player.setFoodLevel(20);
    player.setFireTicks(1);
    player.getActivePotionEffects().forEach(effect -> player.removePotionEffect(effect.getType()));
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:10,代码来源:GameUtils.java

示例10: StartGame

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void StartGame() {
	gameSituation = true;
	startTime = System.currentTimeMillis();
	for (Player players : Bukkit.getOnlinePlayers()) {
		players.setGameMode(GameMode.SURVIVAL);
		players.getInventory().clear();
		players.setFoodLevel(20);
		players.setMaxHealth(40);
		players.teleport(findLocation(players));
	}
}
 
开发者ID:masste,项目名称:McPlayUHC,代码行数:12,代码来源:GameManager.java

示例11: setSpectator

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void setSpectator(Player player, String prefix, Location spawn) {
    if (!PREFIXES.containsKey(player.getName()))
        PREFIXES.put(player.getName(), prefix);

    player.setFoodLevel(20);
    player.setLevel(0);
    player.setGameMode(GameMode.ADVENTURE);
    player.setAllowFlight(true);
    player.setPlayerListName(prefix + player.getDisplayName());
    player.setDisplayName(prefix + player.getDisplayName());
    player.setExp(0);
    player.setHealthScale(20);
    player.setHealth(20);
    player.setTotalExperience(0);
    player.setCanPickupItems(false);
    player.setCustomName(prefix + player.getDisplayName());
    player.setCustomNameVisible(true);
    for (PotionEffect eff : player.getActivePotionEffects()) {
        player.removePotionEffect(eff.getType());
    }
    player.teleport(spawn);

    for (Player p : Bukkit.getOnlinePlayers()) {
        p.hidePlayer(player);
    }

    PlayerUtil.addDeadPlayer(player);
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:29,代码来源:Spectator.java

示例12: removeSpectator

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void removeSpectator(Player player) {
    player.setFoodLevel(20);
    player.setLevel(0);
    player.setGameMode(GameMode.SURVIVAL);
    player.setAllowFlight(false);
    player.setExp(0);
    player.setHealthScale(20);
    player.setHealth(20);
    player.setTotalExperience(0);
    player.setCanPickupItems(false);
    for (PotionEffect eff : player.getActivePotionEffects()) {
        player.removePotionEffect(eff.getType());
    }

    if (PREFIXES.containsKey(player.getName())) {
        player.setCustomName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
        player.setPlayerListName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
        player.setDisplayName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
        player.setCustomNameVisible(true);
    }

    for (Player p : Bukkit.getOnlinePlayers()) {
        p.showPlayer(player);
    }

    PlayerUtil.removeDeadPlayer(player);
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:28,代码来源:Spectator.java

示例13: onPlayerJoin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
	Player p = event.getPlayer();
	joinTimes.put(event.getPlayer().getName(), new Date());
	event.setJoinMessage(null);
	p.setHealth(20);
	p.setFoodLevel(20);
	p.getInventory().clear();
	
	Location l = event.getPlayer().getWorld().getSpawnLocation();
	l.setX(14.5);
	l.setY(10.5);
	l.setZ(-795.5);
	l.setPitch(0.5F);
	l.setYaw(90 * RandomUtil.between(1, 4));
	
	
	
	p.teleport(l);
	p.setGameMode(GameMode.SURVIVAL);
	p.getInventory().addItem(Lobby.book);
	p.getInventory().addItem(Lobby.compass);
	Lobby.addPotionEffect(event.getPlayer(), new PotionEffect(PotionEffectType.SPEED, 2147483647, 2));
	
	if (Gamer.get(p.getName()).getRank().getLevel() >= RankType.ADMIN.getLevel())
		event.getPlayer().addAttachment(Lobby.getInstance(), "bukkit.command.gamemode", true);
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:28,代码来源:Events.java

示例14: join

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean join(Player player, Team team) {
    this.storeTemporaryInventory(player);
    player.getInventory().clear();
    player.updateInventory();
    player.setHealth(player.getMaxHealth());
    player.setFoodLevel(20);
    player.setExp(0);
    player.setLevel(0);
    if (team == Team.RED) {
        player.getInventory().setArmorContents(this.arena.getTeamMeta().getRedItems());
        this.redTeam.add(player);
        if (this.arena.getTeamMeta().getRedSpawnPoint() != null)
            player.teleport(this.arena.getTeamMeta().getRedSpawnPoint());
        else
            player.teleport(this.arena.getBallSpawnLocation());
        player.sendMessage(Language.PREFIX + this.arena.getTeamMeta().getJoinMessage());
        if (this.getHologram() != null) {
            this.getHologram().show(player);
        }
    } else {
        player.getInventory().setArmorContents(this.arena.getTeamMeta().getBlueItems());
        this.blueTeam.add(player);
        if (this.arena.getTeamMeta().getBlueSpawnPoint() != null)
            player.teleport(this.arena.getTeamMeta().getBlueSpawnPoint());
        else
            player.teleport(this.arena.getBallSpawnLocation());
        player.sendMessage(Language.PREFIX + this.arena.getTeamMeta().getJoinMessage());
        if (this.getHologram() != null) {
            this.getHologram().show(player);
        }
    }
    return true;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:35,代码来源:EventGameEntity.java

示例15: onHungerChange

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onHungerChange(FoodLevelChangeEvent e){
    if(e.getEntity() instanceof Player){
        Player p = (Player) e.getEntity();
            p.setSaturation(1000);
            p.setFoodLevel(20);

    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:10,代码来源:HungerFixListener.java


注:本文中的org.bukkit.entity.Player.setFoodLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。