當前位置: 首頁>>代碼示例>>Java>>正文


Java Player.setWalkSpeed方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Player.setWalkSpeed方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.setWalkSpeed方法的具體用法?Java Player.setWalkSpeed怎麽用?Java Player.setWalkSpeed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.setWalkSpeed方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

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

示例3: 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);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:12,代碼來源:Utils.java

示例4: executePlayer

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@Override
public void executePlayer(Player p, PlayerData pd, String[] args) {
    try {
        p.setWalkSpeed(Float.parseFloat(args[0]));
        p.sendMessage(ChatColor.AQUA + "Walkspeed set to " + p.getWalkSpeed());
    } catch (Exception e) {
        p.sendMessage("Use as /walkspeed <0.0-1.0>");
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:10,代碼來源:WalkSpeedCommand.java

示例5: resetWalkSpeed

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void resetWalkSpeed(Player player) {
    player.setWalkSpeed(0.2f);
}
 
開發者ID:lucko,項目名稱:helper,代碼行數:4,代碼來源:Players.java

示例6: items

import org.bukkit.entity.Player; //導入方法依賴的package包/類
private void items(Player p){
    WCCore.getInstance().debugLog("Task Items");
    if(files.getUsers().contains("Users." + p.getName() + ".bypass")
            && files.getUsers().getBoolean("Users." + p.getName() + ".bypass")) return;

    if (p.getInventory().getItemInMainHand() == null) {
        return;
    }
    //Comprobación extra
    //Palo
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.STICK.getItemStack())){
        if(p.getMaxHealth() != 30){
            p.setMaxHealth(30);
        }
        if(p.getWalkSpeed() > 0.2f){
            p.setWalkSpeed(0.2f);
        }
        return;
    }

    //Picos
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P1.getItemStack())){
        if(p.getMaxHealth() != 35){
            p.setMaxHealth(35);
        }
        if(p.getWalkSpeed() != 0.4f){
            p.setWalkSpeed(0.4f);
        }
        return;
    }
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P2.getItemStack())){
        if(p.getMaxHealth() != 35){
            p.setMaxHealth(35);
        }
        if(p.getWalkSpeed() != 0.4f){
            p.setWalkSpeed(0.4f);
        }
        return;

    }
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P3.getItemStack())){
        if(p.getMaxHealth() != 35){
            p.setMaxHealth(35);
        }
        if(p.getWalkSpeed() != 0.4f){
            p.setWalkSpeed(0.4f);
        }
        return;

    }

    if(!(p.getInventory().getItemInMainHand().isSimilar(itemsClass.STICK.getItemStack())
            || p.getInventory().getItemInMainHand().isSimilar(itemsClass.P1.getItemStack())
            || p.getInventory().getItemInMainHand().isSimilar(itemsClass.P2.getItemStack())
            || p.getInventory().getItemInMainHand().isSimilar(itemsClass.P3.getItemStack()))){
        if(p.getMaxHealth() > 20){
            p.setMaxHealth(20);
        }
        if(p.getWalkSpeed() > 0.2f){
            p.setWalkSpeed(0.2f);
        }
    }
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:64,代碼來源:MainRun.java

示例7: setPlayerSpeed

import org.bukkit.entity.Player; //導入方法依賴的package包/類
/**
 * Sets the player walk speed in a manner where resetSpeed will function.
 * @param player
 * @param speed
 */
public static void setPlayerSpeed(Player player, float speed) {
    if (player.getWalkSpeed() != speed)
        player.setWalkSpeed(speed);
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:10,代碼來源:PlayerUtils.java


注:本文中的org.bukkit.entity.Player.setWalkSpeed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。