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


Java Player.setAllowFlight方法代码示例

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


在下文中一共展示了Player.setAllowFlight方法的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: stopSpectating

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void stopSpectating(Player player, boolean sendMsg) {
    PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player);

    profile.getSpectatingMatch().getSpectators().remove(player.getUniqueId());
    profile.setStatus(PlayerStatus.LOBBY);
    profile.setSpectatingMatch(null);

    GameUtils.resetPlayer(player);

    player.getInventory().setContents(GameUtils.getLobbyInventory());
    player.updateInventory();
    player.setAllowFlight(false);
    player.setShowEntities(new ArrayList<>());

    ManagerHandler.getConfig().teleportToSpawn(player);
    ManagerHandler.getEntityHider().showAllPlayers(player);

    if (sendMsg) {
        player.sendMessage(ChatColor.RED + "You are no longer spectating the match.");
    }
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:22,代码来源:SpectateManager.java

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

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

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

示例8: e

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@GameEvent
public void e(@Nonnull PlayerMoveEvent event) {
    Player player = event.getPlayer();
    if (player.getLocation().getBlock().getRelative(0, -1, 0).getType() != Material.AIR && (!player.isFlying())) {
        player.setAllowFlight(true);
    }
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:8,代码来源:DoubleJumpFeature.java

示例9: cancelMatch

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void cancelMatch(String cancelReason) {
    this.sendMessage(ChatColor.DARK_RED + "The match has been canceled for: " + ChatColor.RED + cancelReason);

    for (Player player : getPlayers()) {
    	if (this.leftMatch.contains(player.getUniqueId())) continue;

    	GameUtils.resetPlayer(player);

        PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player);
        profile.setStatus(PlayerStatus.LOBBY);
        profile.setCurrentMatch(null);

        if (profile.getParty() != null) {
        	if (profile.getParty().getLeader() == player) {
                player.getInventory().setContents(GameUtils.getPartyLeaderInventory());
        	}
        	else {
                player.getInventory().setContents(GameUtils.getPartyMemberInventory());
        	}
        }
        else {
            player.getInventory().setContents(GameUtils.getLobbyInventory());
        }

        player.setMaximumNoDamageTicks(19);
        player.setAllowFlight(false);
        player.updateInventory();

        ManagerHandler.getEntityHider().showAllPlayers(player);
        ManagerHandler.getConfig().teleportToSpawn(player);
        ManagerHandler.getScoreboardHandler().getPlayerBoard(player.getUniqueId()).addUpdates(getPlayers());
    }

    cleanSpectators();

    ManagerHandler.getMatchManager().getMatches().remove(this.identifier);

    this.matchStatus = MatchStatus.CANCELED;
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:41,代码来源:FfaMatch.java

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

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

示例12: updateSpectators

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void updateSpectators() {
	for (String list : getSpectators()) {
		Player t = Bukkit.getPlayerExact(list);
		if (t == null || !t.isOnline())
			continue;
		
		t.setAllowFlight(true);
		
		for (Player p : Bukkit.getOnlinePlayers()) {
			if (getSpectators().contains(p.getName()))
				continue;
			p.hidePlayer(t);
		}
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:16,代码来源:Walls.java

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

示例14: onDamage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onDamage(EntityDamageEvent event) {
    if (!(event.getEntity() instanceof Player)) return;
    Player player = (Player) event.getEntity();
    if (!TGM.get().getMatchManager().getMatch().getMatchStatus().equals(MatchStatus.MID) || teamManagerModule.getTeam(player).isSpectator()) return;
    if (player.getHealth() - event.getFinalDamage() >= 0.5) return;

    createDeath(event);
    removeLife(player);

    event.setDamage(0);
    TGM.get().getModule(SpawnPointHandlerModule.class).spawnPlayer(TGM.get().getPlayerManager().getPlayerContext(player), teamManagerModule.getTeam(player), false);

    if (getLives(player) <= 0) {
        player.setGameMode(GameMode.SPECTATOR);
        player.setAllowFlight(true);
        player.setFlying(true);
        player.getInventory().clear();

        if (player.getLocation().getY() < 0) {
            player.teleport(teamManagerModule.getTeam(player).getSpawnPoints().get(0).getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
        }

        MatchTeam team = teamManagerModule.getTeam(player);
        updateScoreboardTeamLine(team, getAlivePlayers(team).size());

        Bukkit.broadcastMessage(team.getColor() + player.getName() + ChatColor.RED + " has been eliminated!");
        player.sendTitle("", ChatColor.RED + "You have been eliminated.");

    } else {
        showLives(player);
        player.teleport(teamManagerModule.getTeam(player).getSpawnPoints().get(0).getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
    }

    if (lastTeamAlive()) {
        MatchTeam winnerTeam = teamManagerModule.getTeams().stream().filter(matchTeam -> !matchTeam.isSpectator()).filter(matchTeam -> getAlivePlayers(matchTeam).size() > 0).findFirst().get();
        if (winnerTeam == null) {
            winnerTeam = teamManagerModule.getTeams().get(1);
        }
        TGM.get().getMatchManager().endMatch(winnerTeam);
        return;
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:44,代码来源:BlitzModule.java

示例15: executePlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void executePlayer(Player p, PlayerData pd, String[] args) {
    p.setAllowFlight(!p.getAllowFlight());
    p.sendMessage(ChatColor.AQUA + "Flying " + (p.getAllowFlight() ? "en" : "dis") + "abled!");
}
 
开发者ID:edasaki,项目名称:ZentrelaCore,代码行数:6,代码来源:FlyCommand.java


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