diff --git a/src/main/java/cn/nukkit/entity/Effect.java b/src/main/java/cn/nukkit/entity/Effect.java index e7a1b4d8b6..d04242e044 100644 --- a/src/main/java/cn/nukkit/entity/Effect.java +++ b/src/main/java/cn/nukkit/entity/Effect.java @@ -187,7 +187,7 @@ public boolean canTick() { return true; case Effect.SPEED: case Effect.SLOWNESS: - return true; + return (this.duration % 20) == 0; } return false; } @@ -247,6 +247,14 @@ public void add(Entity entity, boolean modify) { } ((Player) entity).dataPacket(pk); + + if (this.id == Effect.SPEED) { + ((Player) entity).setMovementSpeed(0.1f + (this.amplifier + 1) * 0.01f); + } + + if (this.id == Effect.SLOWNESS) { + ((Player) entity).setMovementSpeed(0.1f - (this.amplifier + 1) * 0.01f); + } } if (this.id == Effect.INVISIBILITY) { @@ -263,6 +271,10 @@ public void remove(Entity entity) { pk.eventId = MobEffectPacket.EVENT_REMOVE; ((Player) entity).dataPacket(pk); + + if (this.id == Effect.SPEED || this.id == Effect.SLOWNESS) { + ((Player) entity).setMovementSpeed(0.1f); + } } if (this.id == Effect.INVISIBILITY) {