[Help] Thread management + DM Event
Posted: Thu Jul 15, 2010 10:06 am
L2J Revision n/a
L2JDP Revision n/a
Hi,
First of all I'd like to aplogize if this topic doesn't fit the section (don't want to spam useless posts in order to become able to write in Custom section. If it's possible please move this topic into the right section, thank you
I'm writing my own DM (Last man standing type) event based on already existing TvT files. The main part is working fine, except when one participant is left, the event is running until the time is over (and it should end after there's only one player left).
after every call of OnKill method killed participant is being removed (that part works fine) from the event.
Ofc REWARDING state is set only when there's one guy left (that works fine too)
I also have made a method, which checks if there's only on guy left:
Now I'm checking for these conditions inside the DmManager class (equivalent of TvTManager)
I must have forgot something, probably need to stop the thread somehow. Could you give me some hints how make it work?
Thx in advance
Tom
L2JDP Revision n/a
Hi,
First of all I'd like to aplogize if this topic doesn't fit the section (don't want to spam useless posts in order to become able to write in Custom section. If it's possible please move this topic into the right section, thank you
I'm writing my own DM (Last man standing type) event based on already existing TvT files. The main part is working fine, except when one participant is left, the event is running until the time is over (and it should end after there's only one player left).
after every call of OnKill method killed participant is being removed (that part works fine) from the event.
Ofc REWARDING state is set only when there's one guy left (that works fine too)
Code: Select all
if(_players[0].getParticipatedPlayerCount() == 1){ setState(EventState.REWARDING); rewardDmWinner(_players[0]);}
Code: Select all
public static boolean CheckDmPlayerCountEqualToOne(){ if(_players[0].getParticipatedPlayers().size() == 1) return true; return false;}
Code: Select all
public void run(){ int delay = (int) Math.round((_startTime - System.currentTimeMillis()) / 1000.0); if (delay > 0) { this.announce(delay); } int nextMsg = 0; if (delay > 3600) { nextMsg = delay - 3600; } else if (delay > 1800) //..... else { // start if (DmEvent.isInactive()) { DmManager.this.startReg(); } else if (DmEvent.isParticipating()) { DmManager.this.startEvent(); } else { DmManager.this.endEvent(); } } if (delay > 0) { //here it is [color=#00BF40]if(DmEvent.isStarted() && DmEvent.CheckDmPlayerCountEqualToOne()) { DmManager.this.endEvent(); }[/color] nextRun = ThreadPoolManager.getInstance().scheduleGeneral(this, nextMsg * 1000); }}
Thx in advance
Tom