本文整理汇总了Java中org.bukkit.entity.Player.setFallDistance方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setFallDistance方法的具体用法?Java Player.setFallDistance怎么用?Java Player.setFallDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.setFallDistance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void run()
{
if(Bukkit.getPlayer(uuid) == null)
Bukkit.getScheduler().cancelTask(id);
else
if(Bukkit.getPlayer(uuid).isDead())
Bukkit.getScheduler().cancelTask(id);
else
if(!Bukkit.getPlayer(uuid).isSneaking())
{
Bukkit.getScheduler().cancelTask(id);
} else
{
Player p = Bukkit.getPlayer(uuid);
Vector vector = new Vector(0, 1, 0);
vector.multiply(-0.10000000000000001D);
p.setVelocity(vector);
p.setFallDistance(0.0F);
if(!p.isSneaking())
Bukkit.getScheduler().cancelTask(id);
}
}
示例2: 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));
}
示例3: 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();
}
示例4: onVisitorReceiveDamage
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Prevents visitors from getting damage if invinciblevisitors option is set to TRUE
* @param e
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onVisitorReceiveDamage(EntityDamageEvent e){
if(!Settings.invincibleVisitor) return;
if(!(e.getEntity() instanceof Player)) return;
Player p = (Player) e.getEntity();
if (!Util.inWorld(p) || plugin.getIslands().locationIsOnIsland(p, p.getLocation())) return;
if (Settings.invincibleVisitorOptions.contains(e.getCause())) e.setCancelled(true);
else if(e.getCause().equals(DamageCause.VOID)) {
if(plugin.getPlayers().hasIsland(p.getUniqueId())) {
Location safePlace = plugin.getIslands().getSafeHomeLocation(p.getUniqueId(), 1);
if (safePlace != null) {
p.teleport(safePlace);
// Set their fall distance to zero otherwise they crash onto their island and die
p.setFallDistance(0);
e.setCancelled(true);
return;
}
}
// No island, or no safe spot on island
if (plugin.getIslands().getSpawn() != null) {
p.teleport(plugin.getIslands().getSpawnPoint());
// Set their fall distance to zero otherwise they crash onto their island and die
p.setFallDistance(0);
e.setCancelled(true);
return;
}
// No island spawn, try regular spawn
if (!p.performCommand("spawn")) {
// If this command doesn't work, let them die otherwise they may get trapped in the void forever
return;
}
// Set their fall distance to zero otherwise they crash onto their island and die
p.setFallDistance(0);
e.setCancelled(true);
}
}
示例5: run
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void run()
{
if(Bukkit.getPlayer(uuid) == null)
Bukkit.getScheduler().cancelTask(id);
else
if(Bukkit.getPlayer(uuid).isDead())
Bukkit.getScheduler().cancelTask(id);
else
if(!Bukkit.getPlayer(uuid).isSneaking())
{
Bukkit.getScheduler().cancelTask(id);
} else
{
Player p = Bukkit.getPlayer(uuid);
float cost = 0.075F;
float charge = ItemEnergy.getStoredEnergy(p.getInventory().getBoots());
double accuracy = Double.valueOf((new DecimalFormat("##.##")).format(speed - 0.69999999999999996D).replace(",", ".")).doubleValue();
if(charge >= cost)
{
p.getInventory().setBoots(ItemEnergy.chargeItem(p.getInventory().getBoots(), -cost));
me.mrCookieSlime.CSCoreLibPlugin.general.Player.PlayerInventory.update(p);
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 0.25F, 1.0F);
p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1, 1);
p.setFallDistance(0.0F);
double gravity = 0.040000000000000001D;
double offset = SlimefunStartup.chance(100, 50) ? accuracy : -accuracy;
Vector vector = new Vector(p.getEyeLocation().getDirection().getX() * speed + offset, gravity, p.getEyeLocation().getDirection().getZ() * speed - offset);
p.setVelocity(vector);
} else
{
Bukkit.getScheduler().cancelTask(id);
}
}
}
示例6: run
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void run()
{
if(Bukkit.getPlayer(uuid) == null)
Bukkit.getScheduler().cancelTask(id);
else
if(Bukkit.getPlayer(uuid).isDead())
Bukkit.getScheduler().cancelTask(id);
else
if(!Bukkit.getPlayer(uuid).isSneaking())
{
Bukkit.getScheduler().cancelTask(id);
} else
{
Player p = Bukkit.getPlayer(uuid);
float cost = 0.08F;
float charge = ItemEnergy.getStoredEnergy(p.getInventory().getChestplate());
if(charge >= cost)
{
p.getInventory().setChestplate(ItemEnergy.chargeItem(p.getInventory().getChestplate(), -cost));
me.mrCookieSlime.CSCoreLibPlugin.general.Player.PlayerInventory.update(p);
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.25F, 1.0F);
p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1, 1);
p.setFallDistance(0.0F);
Vector vector = new Vector(0, 1, 0);
vector.multiply(thrust);
vector.add(p.getEyeLocation().getDirection().multiply(0.2F));
p.setVelocity(vector);
} else
{
Bukkit.getScheduler().cancelTask(id);
}
}
}