本文整理汇总了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));
}
示例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();
}
示例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);
}
示例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>");
}
}
示例5: resetWalkSpeed
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetWalkSpeed(Player player) {
player.setWalkSpeed(0.2f);
}
示例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);
}
}
}
示例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);
}