diff --git a/src/main/java/cn/nukkit/Player.java b/src/main/java/cn/nukkit/Player.java index bbe92ac1948..3e7be15d641 100644 --- a/src/main/java/cn/nukkit/Player.java +++ b/src/main/java/cn/nukkit/Player.java @@ -1524,7 +1524,7 @@ protected void processMovement(int tickDiff) { if (!to.equals(ev.getTo())) { //If plugins modify the destination this.teleport(ev.getTo(), null); } else { - this.addMovement(this.x, this.y + this.getEyeHeight(), this.z, this.yaw, this.pitch, this.yaw); + this.addMovement(this.x, this.y, this.z, this.yaw, this.pitch, this.yaw); } //Biome biome = Biome.biomes[level.getBiomeId(this.getFloorX(), this.getFloorZ())]; //sendTip(biome.getName() + " (" + biome.doesOverhang() + " " + biome.getBaseHeight() + "-" + biome.getHeightVariation() + ")"); @@ -1587,6 +1587,11 @@ protected void processMovement(int tickDiff) { this.newPosition = null; } + @Override + public void addMovement(double x, double y, double z, double yaw, double pitch, double headYaw) { + this.sendPosition(new Vector3(x, y, z), yaw, pitch, MovePlayerPacket.MODE_NORMAL, this.getViewers().values().toArray(new Player[0])); + } + @Override public boolean setMotion(Vector3 motion) { if (super.setMotion(motion)) { diff --git a/src/main/java/cn/nukkit/Server.java b/src/main/java/cn/nukkit/Server.java index bd17a25b3d4..1a8097e35f3 100644 --- a/src/main/java/cn/nukkit/Server.java +++ b/src/main/java/cn/nukkit/Server.java @@ -359,7 +359,6 @@ public Level remove(Object key) { put("rcon.password", Base64.getEncoder().encodeToString(UUID.randomUUID().toString().replace("-", "").getBytes()).substring(3, 13)); put("auto-save", true); put("force-resources", false); - put("bug-report", true); put("xbox-auth", true); } }); @@ -434,7 +433,14 @@ public Level remove(Object key) { } } - if (this.getConfig().getBoolean("bug-report", true)) { + boolean bugReport; + if (this.getConfig().exists("settings.bug-report")) { + bugReport = this.getConfig().getBoolean("settings.bug-report"); + this.getProperties().remove("bug-report"); + } else { + bugReport = this.getPropertyBoolean("bug-report", true); //backwards compat + } + if (bugReport) { ExceptionHandler.registerExceptionHandler(); } diff --git a/src/main/java/cn/nukkit/entity/Entity.java b/src/main/java/cn/nukkit/entity/Entity.java index c9dc4387150..d2df1882100 100644 --- a/src/main/java/cn/nukkit/entity/Entity.java +++ b/src/main/java/cn/nukkit/entity/Entity.java @@ -1576,6 +1576,10 @@ public AxisAlignedBB getBoundingBox() { } public void fall(float fallDistance) { + if (this.hasEffect(Effect.SLOW_FALLING)) { + return; + } + float damage = (float) Math.floor(fallDistance - 3 - (this.hasEffect(Effect.JUMP) ? this.getEffect(Effect.JUMP).getAmplifier() + 1 : 0)); if (damage > 0) { this.attack(new EntityDamageEvent(this, DamageCause.FALL, damage)); diff --git a/src/main/java/cn/nukkit/level/Level.java b/src/main/java/cn/nukkit/level/Level.java index c7a47b1a7e9..6ca935978b5 100644 --- a/src/main/java/cn/nukkit/level/Level.java +++ b/src/main/java/cn/nukkit/level/Level.java @@ -3216,8 +3216,9 @@ public boolean setRaining(boolean raining) { if (raining) { pk.evid = LevelEventPacket.EVENT_START_RAIN; - pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000; - setRainTime(ThreadLocalRandom.current().nextInt(12000) + 12000); + int time = ThreadLocalRandom.current().nextInt(12000) + 12000; + pk.data = time; + setRainTime(time); } else { pk.evid = LevelEventPacket.EVENT_STOP_RAIN; setRainTime(ThreadLocalRandom.current().nextInt(168000) + 12000); @@ -3258,8 +3259,9 @@ public boolean setThundering(boolean thundering) { // These numbers are from Minecraft if (thundering) { pk.evid = LevelEventPacket.EVENT_START_THUNDER; - pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000; - setThunderTime(ThreadLocalRandom.current().nextInt(12000) + 3600); + int time = ThreadLocalRandom.current().nextInt(12000) + 3600; + pk.data = time; + setThunderTime(time); } else { pk.evid = LevelEventPacket.EVENT_STOP_THUNDER; setThunderTime(ThreadLocalRandom.current().nextInt(168000) + 12000); @@ -3287,7 +3289,7 @@ public void sendWeather(Player[] players) { if (this.isRaining()) { pk.evid = LevelEventPacket.EVENT_START_RAIN; - pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000; + pk.data = this.rainTime; } else { pk.evid = LevelEventPacket.EVENT_STOP_RAIN; } @@ -3296,7 +3298,7 @@ public void sendWeather(Player[] players) { if (this.isThundering()) { pk.evid = LevelEventPacket.EVENT_START_THUNDER; - pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000; + pk.data = this.thunderTime; } else { pk.evid = LevelEventPacket.EVENT_STOP_THUNDER; }