Hello guys...
I want to put a reuse timer code into my buffer but I have no idea if it's even possible...
I want a reuse timer like python's one with a little reuse bar above the character's head...
Could you please help me with that?
[HELP] Reuse timer code in java [SOLVED]
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
- sponer
- Posts: 86
- Joined: Sat Jul 02, 2011 6:02 am
[HELP] Reuse timer code in java [SOLVED]
Last edited by sponer on Thu Oct 08, 2015 1:45 pm, edited 1 time in total.
- UnAfraid
- L2j Veteran
- Posts: 4199
- Joined: Mon Jul 23, 2007 4:25 pm
- Location: Bulgaria
- Contact:
- sponer
- Posts: 86
- Joined: Sat Jul 02, 2011 6:02 am
Re: [HELP] Reuse timer code in java
I saw the packet and I created it...UnAfraid wrote:There's SetupGauge packet that makes exactly what you want
Code: Select all
SetupGauge timer = new SetupGauge(1, 10000);
player.sendPacket(timer);
- UnAfraid
- L2j Veteran
- Posts: 4199
- Joined: Mon Jul 23, 2007 4:25 pm
- Location: Bulgaria
- Contact:
Re: [HELP] Reuse timer code in java
Store the time in your buffer like:
Code: Select all
private static final long REUSE_TIME = 30 * 1000;
private static final Map<Integer, Long> REUSE_TIMES = new ConcurrentHashMap<>();
public void applyReuse(L2PcInstance player) {
REUSE_TIMES.put(player.getObjectId(), System.currentTimeMillis() + REUSE_TIME);
player.sendPacket(new SetupGauge(1, REUSE_TIME / 1000));
}
public boolean hasReuse(L2PcInstance player) {
return REUSE_TIMES.getOrDefault(player.getObjectId(), 0L) > System.currentTimeMillis();
}
- sponer
- Posts: 86
- Joined: Sat Jul 02, 2011 6:02 am
Re: [HELP] Reuse timer code in java
Thank you very much, I appreciate your helpUnAfraid wrote:Store the time in your buffer like:Code: Select all
private static final long REUSE_TIME = 30 * 1000; private static final Map<Integer, Long> REUSE_TIMES = new ConcurrentHashMap<>(); public void applyReuse(L2PcInstance player) { REUSE_TIMES.put(player.getObjectId(), System.currentTimeMillis() + REUSE_TIME); player.sendPacket(new SetupGauge(1, REUSE_TIME / 1000)); } public boolean hasReuse(L2PcInstance player) { return REUSE_TIMES.getOrDefault(player.getObjectId(), 0L) > System.currentTimeMillis(); }