public void setHealth(int health) { synchronized (objectMutex) { if (getPosture() == 13) { if (health > maxHealth) health = maxHealth; stopIncapTask(); setIncapTask(null); this.health = health; notifyObservers(messageBuilder.buildUpdateHAMListDelta(), true); setPosture((byte) 0); setTurnRadius(1); setSpeedMultiplierBase(1); return; } } IoBuffer delta; synchronized (objectMutex) { if (this.health == health) return; if (health > maxHealth) { setHealth(maxHealth); return; } setHamListCounter(getHamListCounter() + 1); delta = messageBuilder.buildHealthDelta(health); this.health = health; } notifyObservers(delta, true); }
public void updateHAMList() { synchronized (objectMutex) { setHamListCounter(getHamListCounter() + 1); notifyObservers(messageBuilder.buildUpdateHAMListDelta(), true); } }