Skip to content

Commit

Permalink
Merge pull request Nukkit#419 from Pub4Game/patch-5
Browse files Browse the repository at this point in the history
fix effect
  • Loading branch information
Angelic47 committed Jan 28, 2016
2 parents acd499c + 763c7a2 commit 3c097be
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/cn/nukkit/entity/Effect.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public boolean canTick() {
return true;
case Effect.SPEED:
case Effect.SLOWNESS:
return true;
return (this.duration % 20) == 0;
}
return false;
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 3c097be

Please sign in to comment.