why use a timer mang. add a check in QuestActionHandler if jail time is > 0 and then check how much time has passed. :)
This is a discussion on [Add-On]Timed Jail within the Releases forums, part of the Java Based (Odin) category; Surprised no one has done this yet, it's actually pretty easy. I'm only releasing this because I'm bored . Might ...
Surprised no one has done this yet, it's actually pretty easy. I'm only releasing this because I'm bored. Might release something that's actually useful if I stay bored(implying to myself this isn't useful to me, but it is for you guys).
MapleCharacter:
MapleClient.disconnect:Code:private long jailTime = 0; public long getJailTime() { return jailTime; } public void setJailTime(long time) { this.jailTime = time; } jailTime = ?, jailTime, ?, ps.setLong(xx, jailTime); public void hammerTime(int mins) { setJailTime(System.currentTimeMillis() / 1000 * mins); client.getSession().write(MaplePacketCreator.getClock(mins * 60)); TimerManager.getInstance().schedule(new Runnable() { @Override public void run() { setJailTime(0); // idk if this is even needed, but w/e } }, 1000 * 60 * mins); }
ChangeMapHandler:Code:if (c.getPlayer().getJailTime() > 0) { // i think this is needed, so time stops? player.setJailTime(System.currentTimeMillis() / 1000 - player.getJailTime()); }
PlayerLoggedinHandler:Code:if (c.getPlayer().getJailTime() > 0) { // just in case, exploit c.getPlayer().warpToMap(jailmapid); c.getPlayer().hammerTime(c.getPlayer().getJailTime()); }
ChangeChannelHandler:Code:if (c.getPlayer().getJailTime() > 0) { // just in case, exploit c.getPlayer().warpToMap(jailmapid); c.getPlayer().hammerTime(c.getPlayer().getJailTime()); }
Command:Code:if (c.getPlayer().getJailTime() > 0) { // just in case, exploit c.getPlayer().warpToMap(jailmapid); c.getPlayer().hammerTime(c.getPlayer().getJailTime()); }
Code:} else if (splitted[0].equals("jail")) { MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]); if (victim != null) { if (splitted.length > 3 && splitted[2].equals("timed")) { victim.warpToMap(jailmapid); victim.hammerTime(splitted[3]); player.dropMessage(victim.getName() + " was jailed for " + splitted[3] + " minutes!"); victim.dropMessage("You've been jailed for " + splitted[3] + " minutes."); } else { victim.warpToMap(jailmapid); player.dropMessage(victim.getName() + " was jailed!"); } } else { player.dropMessage(splitted[1] + " not found!"); }
Last edited by StripedCow; 18-02-12 at 03:36 PM.
Bringing the hype to a section near you.
why use a timer mang. add a check in QuestActionHandler if jail time is > 0 and then check how much time has passed. :)
I remember when I tried to make this years ago and failed since I was trying to save a long to the database and didn't know how, lol. Brings back memories.
Good release Bloo. (:
Last edited by Veda; 16-02-12 at 04:57 AM.
You won't find faith or hope down a telescope
You won't find heart and soul in the stars
You can break everything down to chemicals
But you can't explain a love like ours
Is it necessary to add a long to every Maplecharacter?
Why don't you create a separate class and gather the players who got jailed?
Ok, well, first of all, what you said about "why store a long" is just stupid; do you understand the difference between objects and primitives? Probably not, why cache the players when you could just stamp their object's state with a time value by which to track them. Why the hell would you write a class just to store jailed people, its impractical performance wise, logic wise, visually and its a pain to do.
Why build a sea sailing ship to cross the lake when you can build a canoe for less money that does the same job BETTER...
Posted via Mobile Device
This is c00l but ricky is baddie![]()
In case your server crash player is stuck, so you need database for Jail things.
My question was :
"Is it necessary to add a long to every Maplecharacter?"
not
"why store a long"
There's a huge difference and you know that.
My idea was to create a seperate single instanced class named Jail (or w.e) and actually put a long and the character's ID in it. I'm pretty sure that it will not impact the performance at all, you're just talking out of your ass. This class could contain methods that help you maintaining people in jail and would only save and load the timestamp when a player is actually jailed instead of doing it everytime you login, change map, CC etc. Oh about how the code looks is just a matter of personal taste, I'd like to have my stuff sorted instead of trashing every fucking thing inside maplecharacter.
Oh and I'd rather have a sea sailing ship that has the ability to extend itself when people need it, instead of creating a canoe for every individual person even when it's not going to be used at all.
You sir are the one talking out of your ass, because this is total bullshit, do you even know how stupid you sound now? What methods? What management? Wtf are you talking about, it has to do with each characters state. And how blue chose to update the jailtime is irrelevant (even though I told him to change it) it doesn't matter. You have no logic mertjuh, I think you should just go home.
And, lol really? Trashing everything in maple character? Lolololololololol.
Posted via Mobile Device
Edit: @expedia, I see, makes sense but still unnecessary kind of lame :s .
Posted via Mobile Device
For the check @ ChangeMapHandler:
Why not just disable all map changing instead of warping them back in jail if they somehow manage to change maps?
For the check @ ChangeChannelHandler:
Again, I think disabling the ability to change channels is better than allowing them to CC, and then warping them to the map again.
Oh and maybe add "c.getPlayer().warpToMap(jailmapid);" to the hammerTime method itself since you call it every time hammerTime is called, you might as well make it happen at at once.
I think you forgot to warp them since all you did was give them jail time and alert them about it. They'd need to CC, change maps or relog to actually get sent to jail. I think.Code:} else if (splitted[0].equals("jail")) { MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]); if (victim != null) { if (splitted.length > 3 && splitted[2].equals("timed")) { victim.hammerTime(splitted[3]); player.dropMessage(victim.getName() + " was jailed for " + splitted[3] + " minutes!"); victim.dropMessage("You've been jailed for " + splitted[3] + " minutes."); } else { victim.warpToMap(jailmapid); player.dropMessage(victim.getName() + " was jailed!"); } } else { player.dropMessage(splitted[1] + " not found!"); }
Sorry for typing so much. GMS is down.
Nice release though, some servers really need this. I've seen servers manually have to unjail people after X minutes which is really bad.![]()
1) Balloon Frenzy! v1.9 available on Google Play
For those who want a nice, casual game to play.
2) BasilDroid v1.0 available on Google Play
For the fastest way to access BasilMarket on the go!
3) Danger Zone v1.0 available on Google Play
The epic game of survival!