本文整理汇总了Java中cn.nukkit.Player.isOnGround方法的典型用法代码示例。如果您正苦于以下问题:Java Player.isOnGround方法的具体用法?Java Player.isOnGround怎么用?Java Player.isOnGround使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.Player
的用法示例。
在下文中一共展示了Player.isOnGround方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBreakTime
import cn.nukkit.Player; //导入方法依赖的package包/类
public double getBreakTime(Item item, Player player) {
Objects.requireNonNull(item, "getBreakTime: Item can not be null");
Objects.requireNonNull(player, "getBreakTime: Player can not be null");
double blockHardness = getHardness();
boolean correctTool = correctTool0(getToolType(), item);
boolean canHarvestWithHand = canHarvestWithHand();
int blockId = getId();
int itemToolType = toolType0(item);
int itemTier = item.getTier();
int efficiencyLoreLevel = Optional.ofNullable(item.getEnchantment(Enchantment.ID_EFFICIENCY))
.map(Enchantment::getLevel).orElse(0);
int hasteEffectLevel = Optional.ofNullable(player.getEffect(Effect.HASTE))
.map(Effect::getAmplifier).orElse(0);
boolean insideOfWaterWithoutAquaAffinity = player.isInsideOfWater() &&
Optional.ofNullable(player.getInventory().getHelmet().getEnchantment(Enchantment.ID_WATER_WORKER))
.map(Enchantment::getLevel).map(l -> l >= 1).orElse(false);
boolean outOfWaterButNotOnGround = (!player.isInsideOfWater()) && (!player.isOnGround());
return breakTime0(blockHardness, correctTool, canHarvestWithHand, blockId, itemToolType, itemTier,
efficiencyLoreLevel, hasteEffectLevel, insideOfWaterWithoutAquaAffinity, outOfWaterButNotOnGround);
}
示例2: run
import cn.nukkit.Player; //导入方法依赖的package包/类
public void run() {
while (true) {
try {
for (Player player : Server.getInstance().getOnlinePlayers().values()) {
if(!player.isOnGround()){
double y = player.y;
boolean flag = false;
thread.sleep(5*1000);
if(player.y == y){
flag = true;
}
if(player.y >= y) {
y = player.y;
if (player.move(0, -3, 0)) {
if (player.move(0, -3, 0)) {
if (player.y + 6 == y) {
flag = true;
}
}
}
}
if(flag){
player.setMotion(new Vector3(0,0,0));
player.teleport(player);
if(Flycount.containsKey(player.getName())){
if(Flycount.get(player.getName()) > 5){
player.kick(TextFormat.AQUA+"Cheat Type: "+TextFormat.RED+"Fly");
}
Flycount.put(player.getName(),Flycount.get(player.getName())+1);
}else{
Flycount.put(player.getName(),1);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}