本文整理汇总了Java中org.bukkit.entity.Player.setFlySpeed方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setFlySpeed方法的具体用法?Java Player.setFlySpeed怎么用?Java Player.setFlySpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.setFlySpeed方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
);
}
示例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);
}
示例3: 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));
}
示例4: 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());
}
示例5: 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();
}
示例6: resetPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetPlayer(Player player) {
player.getInventory().clear();
player.getInventory().setChestplate(new ItemBuilder().material(Material.ELYTRA).unbreakable(true).get());
player.setGameMode(GameMode.ADVENTURE);
player.setAllowFlight(player.hasPermission("lobby.fly"));
player.setWalkSpeed(0.2f);
player.setFlySpeed(0.1f);
player.setPotionParticles(false);
player.hideTitle();
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 15, 0.5, 0.5, 0.5, 0);
}
示例7: 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());
}
示例8: executePlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void executePlayer(Player p, PlayerData pd, String[] args) {
try {
p.setFlySpeed(Float.parseFloat(args[0]));
p.sendMessage(ChatColor.AQUA + "Flyspeed set to " + p.getFlySpeed());
} catch (Exception e) {
p.sendMessage("Use as /flyspeed <0.0-1.0>");
}
}
示例9: resetFlySpeed
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetFlySpeed(Player player) {
player.setFlySpeed(0.1f);
}
示例10: setFlySpeed
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static boolean setFlySpeed(UUID player, float speed){
if(speed > 0.99f){
return false;
} else {
Player p = Bukkit.getServer().getPlayer(player);
p.setFlySpeed(speed);
return true;
}
}