本文整理汇总了Java中org.bukkit.entity.Player.getWalkSpeed方法的典型用法代码示例。如果您正苦于以下问题:Java Player.getWalkSpeed方法的具体用法?Java Player.getWalkSpeed怎么用?Java Player.getWalkSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.getWalkSpeed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: checkXZSpeed
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void checkXZSpeed(Player player, double x, double z) {
if(player.getVehicle() == null && !player.isFlying() && !Flight.movingExempt.containsKey(player)) {
String reason = "";
double max = 0.25;
if(player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
if(player.isSprinting()) {
reason = "on soulsand while sprinting";
max = 0.2;
} else if(player.hasPotionEffect(PotionEffectType.SPEED)) {
max = 0.16;
reason = "on soulsand with speed pot";
} else {
max = 0.13;
}
} else if(player.hasPotionEffect(PotionEffectType.SPEED)) {
if(player.isSprinting()) {
reason = "with speed pot while sprinting";
max = 0.95;
} else {
reason = "with speed pot";
max = 0.7;
}
} else if(player.isSprinting()) {
max = 0.65;
reason = "while sprinting";
}
float speed = player.getWalkSpeed();
max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0;
if(x > max || z > max) {
speedViolation.put(player, speedViolation.containsKey(player) ? speedViolation.get(player) + 1 : 1);
if(speedViolation.get(player) > MagicNumbers.SPEED_MAX) {
for(Player pla : DynamicAC.instance.onlinestaff) {
pla.sendMessage(ChatColor.RED + "[DAC] " + ChatColor.GREEN + player.getName() + " failed " +
"Speed " + reason + "!");
}
DACManager.getUserManager().incrementUser(DACManager.getUserManager().getUser(player.getName()),
"Speed " + reason);
}
} else {
speedViolation.put(player, 0);
}
}
}
示例3: 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);
}