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


Java Player.setFlying方法代码示例

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


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

示例1: start

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Starts the tutorial for the given player.
 *
 * @param id The UUID of the player.
 */
public void start(UUID id)
{
	if (isWatchingTutorial(id))
	{
		p.getLogger().info(p.getServer().getPlayer(id).getName() + "(" + id + ") is trying to see the tutorial whilst watching it.");
		return;
	}

	Player player = p.getServer().getPlayer(id);

	// The player cannot move anymore (except with our teleportations)
	player.setFlySpeed(0f);
	player.setAllowFlight(true);
	player.setFlying(true);

	// All other players are hidden
	for (Player other : p.getServer().getOnlinePlayers())
	{
		player.hidePlayer(other);
		other.hidePlayer(player);
	}

	// The player's hour is updated, if needed
	if(tutorialHour != null)
	{
		player.setPlayerTime(tutorialHour, false);
	}


	// The tutorial is started
	viewers.put(
			id, p.getServer().getScheduler().runTaskTimer(p, new TutorialRunner(this, id), 10L, 10L)
	);
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:40,代码来源:Tutorial.java

示例2: stop

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Stops the tutorial for the given player.
 *
 * @param id The UUID of the player.
 * @param interrupted {@code true} if the tutorial is stopped because it was interrupted
 *                    using {@link #stopForAll(String)}, {@link #stop(UUID)} or if the
 *                    user disconnected.
 */
void stop(UUID id, final Boolean interrupted) // package-private
{
	if (!isWatchingTutorial(id)) return;

	Player player = p.getServer().getPlayer(id);

	if (player != null)
	{
		// The player can now move.
		player.setFlySpeed(0.1f);
		player.setFlying(false);
		player.setAllowFlight(false);

		// All other players are displayed
		for (Player other : p.getServer().getOnlinePlayers())
		{
			player.showPlayer(other);
			other.showPlayer(player);
		}

		player.resetPlayerTime();
	}

	try
	{
		viewers.get(id).cancel();
	}
	catch (IllegalStateException ignored) {}

	viewers.remove(id);

	onTutorialEnds(player, interrupted);
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:42,代码来源:Tutorial.java

示例3: setSpectating

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Toggles whether a player is in Spectator Mode.
 * @param player
 * @param toggle
 */
public void setSpectating(Player player, boolean toggle) {
    if(toggle && spec.contains(player)) return;
    if(!toggle && !spec.contains(player)) return;
    if(toggle) {
        player.setAllowFlight(true);
        player.setFlying(true);
        player.setGameMode(GameMode.SPECTATOR);
        spec.add(player);
    } else {
        player.setGameMode(GameMode.ADVENTURE);
        spec.remove(player);
    }
    this.setAlive(player, false);
    Bukkit.getServer().getPluginManager().callEvent(new PlayerAliveStatusEvent(player, false, toggle));
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:21,代码来源:GameManager.java

示例4: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void reset() {
    final Player bukkit = getBukkit();
    bukkit.closeInventory();
    clearInventory();
    bukkit.setExhaustion(0);
    bukkit.setFallDistance(0);
    bukkit.setFireTicks(0);
    bukkit.setFoodLevel(20); // full
    bukkit.setMaxHealth(20);
    bukkit.setHealth(bukkit.getMaxHealth());
    bukkit.setAbsorption(0);
    bukkit.setLevel(0);
    bukkit.setExp(0); // clear xp
    bukkit.setSaturation(5); // default
    bukkit.setFastNaturalRegeneration(false);
    bukkit.setSlowNaturalRegeneration(true);
    bukkit.setAllowFlight(false);
    bukkit.setFlying(false);
    bukkit.setSneaking(false);
    bukkit.setSprinting(false);
    bukkit.setFlySpeed(0.1f);
    bukkit.setKnockbackReduction(0);
    bukkit.setWalkSpeed(WalkSpeedKit.BUKKIT_DEFAULT);
    AttributeUtils.removeAllModifiers(bukkit);
    resetPotions();

    // we only reset bed spawn here so people don't have to see annoying messages when they respawn
    bukkit.setBedSpawnLocation(null);

    match.callEvent(new PlayerResetEvent(this));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:32,代码来源:MatchPlayer.java

示例5: onPlayerDeath

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
  public void onPlayerDeath(PlayerDeathEvent event) {
  	String dmessage = event.getDeathMessage() + "!";
Team.getTeam(event.getEntity()).leave(event.getEntity());
  	event.setDeathMessage(null);
      if (State.PRE)
          return;

if (event.getEntity().getKiller() instanceof Player) {
	Hive.getInstance().getDatabase().update(String.format("INSERT INTO kills (server,game_id,player,target) VALUES ('%s',%d,'%s','%s')","walls",Walls.ID,event.getEntity().getKiller().getName(),event.getEntity().getName()));
      }
else {
	Hive.getInstance().getDatabase().update(String.format("INSERT INTO kills (server,game_id,player,target) VALUES ('%s',%d,'%s','%s')","walls",Walls.ID,"natural",event.getEntity().getName()));
}

      Chat.server(dmessage.replace(event.getEntity().getName(), event.getEntity().getDisplayName() + "&c"));
      Walls.getSpectators().add(event.getEntity().getName());
      Player p = event.getEntity();
      Chat.player(p, "&2You are now a spectator and can watch the game.");
      Walls.updateSpectators();
p.setFlying(true);
  }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:23,代码来源:GameEvents.java

示例6: join

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public TeamColor join(Player p, String team) {
	if (team.equals("spec")) {
		// something special?
	}
	
	if (team.equals("red"))
		red.addPlayer(p);
	else if (team.equals("blue"))
		blue.addPlayer(p);
	
	Gamer g = Gamer.get(p);
	g.setVariable("arena", this);
	g.setVariable("team", team);

	p.setFlySpeed(0.1F);
	
	p.setAllowFlight(true);
	p.setFlying(true);
	p.setScoreboard(scoreboard);
	p.teleport(getSpawn());
	return TeamColor.valueOf(team.toUpperCase());
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:23,代码来源:Arena.java

示例7: onFly

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onFly(PlayerToggleFlightEvent event) {
    if (this.controller.getGameFromPlayer(event.getPlayer()) != null) {
        final Game game = this.controller.getGameFromPlayer(event.getPlayer());
        final Player player = event.getPlayer();
        if ((player.getGameMode() != GameMode.CREATIVE)) {
            event.setCancelled(true);
            player.setAllowFlight(false);
            player.setFlying(false);
            if (game.getArena().getTeamMeta().isAllowDoubleJump()) {
                player.setVelocity(player.getLocation().getDirection()
                        .multiply(game.getArena().getTeamMeta().getDoubleJumpMeta().getHorizontalStrength())
                        .setY(game.getArena().getTeamMeta().getDoubleJumpMeta().getVerticalStrength()));
                try {
                    game.getArena().getTeamMeta().getDoubleJumpSound().play(player.getLocation());
                } catch (final InterPreter19Exception e) {
                    Bukkit.getServer().getConsoleSender().sendMessage(BlockBallPlugin.PREFIX_CONSOLE + ChatColor.RED + "Invalid 1.8/1.9 sound. [DoubleJumpSound]");
                }
                game.getArena().getTeamMeta().getDoubleJumpParticle().play(player.getLocation());
            }
        }
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:24,代码来源:GameListener.java

示例8: 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

示例9: join

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public TeamColor join(Player p, String team) {
	Gamer g = Gamer.get(p);
	
	if (team.equals("spec")) {
		specPlayers.addPlayer(p);
		p.setScoreboard(specScoreboard);
		g.setInvisible(true);
	}
	else if (team.equals("red")) {
		specPlayers.addPlayer(p);
		red.addPlayer(p);
		p.setScoreboard(scoreboard);
		g.setNameTag(ChatColor.RED + p.getName());
	}
	else if (team.equals("blue")) {
		specPlayers.addPlayer(p);
		blue.addPlayer(p);
		p.setScoreboard(scoreboard);
		g.setNameTag(ChatColor.BLUE + p.getName());
	}
	
	g.setVariable("arena", this);
	g.setVariable("team", team);

	p.setFlySpeed(0.1F);
	
	p.setAllowFlight(true);
	p.setFlying(true);
	p.teleport(getSpawn());
	return TeamColor.valueOf(team.toUpperCase());
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:32,代码来源:Arena.java

示例10: e

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@GameEvent
public void e(@Nonnull PlayerToggleFlightEvent event) {
    final Player player = event.getPlayer();
    if (player.getGameMode() != GameMode.CREATIVE) {
        if (!disabled.contains(player.getUniqueId())) {
            event.setCancelled(true);
            player.setAllowFlight(false);
            player.setFlying(false);
            player.setVelocity(player.getLocation().getDirection().multiply(1.6).setY(1));
            player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 4, 1);
        }
    }
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:14,代码来源:DoubleJumpFeature.java

示例11: equipPlayingPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void equipPlayingPlayer(final Player player) {
    player.setFlying(false);
    player.setAllowFlight(false);
    player.getInventory().clear();
    player.getInventory().setItem(0, constructItem(Material.MAGMA_CREAM, 1, (byte) 0, ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "Se diviser", Arrays.asList(ChatColor.GRAY + "Divise toutes vos cellules en deux")));
    player.getInventory().setItem(1, constructItem(Material.SLIME_BALL, 1, (byte) 0, ChatColor.GREEN + "" + ChatColor.BOLD + "Ejecter de la Matière", Arrays.asList(ChatColor.GRAY + "Ejecte une cellule inerte dans votre direction")));
    player.getInventory().setItem(7, Utils.constructBook(constructItem(Material.WRITTEN_BOOK, 1, (byte) 0, ChatColor.LIGHT_PURPLE + "Règles", Arrays.asList(ChatColor.GRAY + "Visualiser les règles du jeu")), ChatColor.LIGHT_PURPLE + "Règles", "Infinity & Rigner", Utils.getRulesBookText()));
    player.getInventory().setItem(8, constructItem(Material.DIODE, 1, (byte) 0, ChatColor.DARK_GRAY + "" + ChatColor.BOLD + "Menu", Arrays.asList(ChatColor.GRAY + "Menu du jeu")));
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:10,代码来源:AgarGame.java

示例12: equipSpectatingPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void equipSpectatingPlayer(final Player player) {
    player.setAllowFlight(true);
    player.setFlying(true);
    player.getInventory().clear();
    player.getInventory().setItem(0, constructItem(Material.NETHER_STAR, 1, (byte) 0, ChatColor.AQUA + "" + ChatColor.BOLD + "Jouer", null));
    player.getInventory().setItem(4, Utils.constructBook(constructItem(Material.WRITTEN_BOOK, 1, (byte) 0, ChatColor.LIGHT_PURPLE + "Règles", Arrays.asList(ChatColor.GRAY + "Visualiser les règles du jeu")), ChatColor.LIGHT_PURPLE + "Règles", "Infinity & Rigner", Utils.getRulesBookText()));
    player.getInventory().setItem(1, constructItem(Material.WOOL, 1, (byte) 14, AgarMC.get().getGame().getGameType() == GameType.TEAMS ? ChatColor.AQUA + "" + ChatColor.BOLD + "Choisir son équipe" : ChatColor.AQUA + "" + ChatColor.BOLD + "Choisir sa couleur", null));
    player.getInventory().setItem(8, SamaGamesAPI.get().getGameManager().getCoherenceMachine().getLeaveItem());
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:10,代码来源:AgarGame.java

示例13: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void reset(Player player) {
	Bukkit.getOnlinePlayers().stream().filter(other -> other != player).forEach(other -> other.hidePlayer(player));
	player.setGameMode(GameMode.CREATIVE);
       player.setHealth(20.0);
       player.setFoodLevel(20);
       player.getActivePotionEffects().forEach(potionEffect -> player.removePotionEffect(potionEffect.getType()));
       player.setAllowFlight(true);
       player.setFlying(true);
       player.setVelocity(player.getVelocity().setY(1.1));
       player.getInventory().clear();
       player.getInventory().setArmorContents(null);
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:13,代码来源:PlayerDeathListener.java

示例14: onRespawn

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onRespawn(PlayerRespawnEvent event) {
	Player player = event.getPlayer();
       player.setGameMode(GameMode.SURVIVAL);
       player.setHealth(20.0);
       player.setFoodLevel(20);
       player.setAllowFlight(false);
       player.setFlying(false);
       player.setFireTicks(0);
       player.getActivePotionEffects().forEach(potionEffect -> player.removePotionEffect(potionEffect.getType()));
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:12,代码来源:PlayerRespawnListener.java

示例15: show

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void show(VPPlayer player) {
	Player p = player.getPlayer();
	Object nmsPlay = getNMSPlayer(p);
	Object arrayPlayer = ReflectionUtils.getArrayOf(nmsPlayer, nmsPlay);
	final ReflectionObject add = PacketUtils.craftPacket(PacketPlayOutPlayerInfo, addPlayerEnum.getClass(), arrayPlayer.getClass())
			.instance(addPlayerEnum, arrayPlayer);
	Object difficulty = ReflectionUtils.invoke(getDifficulty, enumDifficulty, player.getLocation().getWorld().getDifficulty().getValue());
	Object type = ReflectionUtils.invoke("getType", worldType, player.getLocation().getWorld().getWorldType().getName());
	Object gamemode = ReflectionUtils.invoke(getGamemode, enumGamemode, player.getGameMode().getValue());
	final ReflectionObject respawn = PacketUtils.craftPacket(PacketPlayOutRespawn, int.class, difficulty.getClass(), type.getClass(), gamemode.getClass())
			.instance(0, difficulty, type, gamemode);
	boolean flying = p.isFlying();
	Location location = player.getLocation();
	int level = player.getLevel();
	float xp = p.getExp();
	double maxHealth = p.getMaxHealth();
	double health = p.getHealth();
	PacketUtils.sendPacket(respawn, player);        
	p.setFlying(flying);
	player.teleport(location);
	p.updateInventory();
	player.setLevel(level);
	p.setExp(xp);
	p.setMaxHealth(maxHealth);
	p.setHealth(health);
	for(VPPlayer vp : VanillaPlusCore.getPlayerManager().getOnlinePlayers())
		PacketUtils.sendPacket(add, vp);
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:30,代码来源:CraftPlayerUtils.java


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