i guess add a listener for render emote changes, and when the listener detects a change, it refreshes the appearance
|
Hi, I've currently got it so that I check if a player is in combat:
Then I check if the player is in combat in appearance and it changes the render emote, it all works great except I have to manually refresh the render emote. What I'm asking is, is there a way that I can automatically refresh the render emote when someone goes in and out of combat?Code:public boolean inCombat() { if (player.getAttackedByDelay() + 10000 > Utils.currentTimeMillis()) { return true; } else { return false; } }
This is what it looks like atm
Thanks in advance.
Thank you, but I'm not quite sure what one of those is. I've looked it up and this is what I've come up with:
private Object remote;
private int oldRE;
Would that work, if so where could I put it so that it's used? Thanks again, sorry if it's obvious.Code:synchronized(remote) { try { remote.wait(); } catch (InterruptedException e) { player.getAppearence().generateAppearenceData(); oldRE = player.getAppearence().getRenderEmote(); } } if (player.getAppearence().getRenderEmote() != oldRE) {//I believe I put this somewhere else synchronized(remote) { remote.notify(); } }
Think simple & be careful where and how you use synchronized blocks.
Do something like this inside of your Player class:
and put method checkCombat() inside of Player.process()Code:private boolean inCombat; private void checkCombat() { boolean inCombat = getAttackDelay() + 10000 > Utils.currentTimeMillis(); if(this.inCombat == inCombat) { /** * Already set. */ return; } if(inCombat) { /** * Being attacked. */ appearance.setRenderId(combatRenderId); } else { /** * No longer being attacked. */ appearance.setRenderId(defaultRenderId); } this.inCombat = inCombat; } public boolean inCombat() { return inCombat; }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |