root/trunk/AE-go_GameServer/src/com/aionemu/gameserver/skillengine/model/Effect.java
| 1511 | 1521 | ||
|---|---|---|---|
86 | private boolean launchSubEffect = true; | 86 | private boolean launchSubEffect = true; |
87 | private Effect subEffect = null; | 87 | private Effect subEffect = null; |
88 | 88 | ||
89 | private boolean isStopped; | ||
90 | |||
89 | public Effect(Creature effector, Creature effected, SkillTemplate skillTemplate, int skillLevel, int duration) | 91 | public Effect(Creature effector, Creature effected, SkillTemplate skillTemplate, int skillLevel, int duration) |
90 | { | 92 | { |
91 | this.effector = effector; | 93 | this.effector = effector; |
... | ... | ||
494 | { | 496 | { |
495 | @Override | 497 | @Override |
496 | public void run() | 498 | public void run() |
497 | { | 499 | { |
498 | endEffect(); | 500 | endEffect(); |
499 | } | 501 | } |
500 | }), duration); | 502 | }), duration); |
... | ... | ||
518 | 520 | ||
519 | /** | 521 | /** |
520 | * End effect and all effect actions | 522 | * End effect and all effect actions |
523 | * This method is synchronized and prevented to be called several times | ||
524 | * which could cause unexpected behavior | ||
521 | */ | 525 | */ |
522 | public void endEffect() | 526 | public synchronized void endEffect() |
523 | { | 527 | { |
528 | if(isStopped) | ||
529 | return; | ||
530 | |||
524 | for(EffectTemplate template : getEffectTemplates()) | 531 | for(EffectTemplate template : getEffectTemplates()) |
525 | { | 532 | { |
526 | template.endEffect(this); | 533 | template.endEffect(this); |
... | ... | ||
530 | { | 537 | { |
531 | deactivateToggleSkill(); | 538 | deactivateToggleSkill(); |
532 | } | 539 | } |
533 | | ||
534 | effected.getEffectController().clearEffect(this); | ||
535 | stopTasks(); | 540 | stopTasks(); |
541 | effected.getEffectController().clearEffect(this); | ||
542 | this.isStopped = true; | ||
536 | } | 543 | } |
537 | 544 | ||
538 | /** | 545 | /** |
... | ... | ||
542 | { | 549 | { |
543 | if(task != null) | 550 | if(task != null) |
544 | { | 551 | { |
545 | task.cancel(false); | 552 | task.cancel(true); |
546 | task = null; | 553 | task = null; |
547 | } | 554 | } |
548 | 555 | ||
549 | if(checkTask != null) | 556 | if(checkTask != null) |
550 | { | 557 | { |
551 | checkTask.cancel(false); | 558 | checkTask.cancel(true); |
552 | checkTask = null; | 559 | checkTask = null; |
553 | } | 560 | } |
554 | 561 | ||
555 | if(periodicTask != null) | 562 | if(periodicTask != null) |
556 | { | 563 | { |
557 | periodicTask.cancel(false); | 564 | periodicTask.cancel(true); |
558 | periodicTask = null; | 565 | periodicTask = null; |
559 | } | 566 | } |
560 | 567 | ||
561 | if(mpUseTask != null) | 568 | if(mpUseTask != null) |
562 | { | 569 | { |
563 | mpUseTask.cancel(false); | 570 | mpUseTask.cancel(true); |
564 | mpUseTask = null; | 571 | mpUseTask = null; |
565 | } | 572 | } |
566 | } | 573 | } |
... | ... | ||
582 | addedToController = true; | 589 | addedToController = true; |
583 | } | 590 | } |
584 | } | 591 | } |
585 | } | 592 | } |
Download diff