hot fix for powers failure
This commit is contained in:
@@ -5122,24 +5122,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
|
|
||||||
if (this.updateLock.writeLock().tryLock()) {
|
if (this.updateLock.writeLock().tryLock()) {
|
||||||
try {
|
try {
|
||||||
//if (!this.timestamps.contains("STAMHEALTICK")) {
|
|
||||||
// this.timestamps.put("STAMHEALTICK", System.currentTimeMillis());
|
|
||||||
//}
|
|
||||||
//if (this.containsEffect(441156455)) {
|
|
||||||
// long length = System.currentTimeMillis() - this.timestamps.get("STAMHEALTICK").longValue();
|
|
||||||
// if (length > 10000 ) {
|
|
||||||
// float stamIncrease = 6.5f;
|
|
||||||
// if (this.stamina.get() + stamIncrease > this.staminaMax)
|
|
||||||
// this.stamina.compareAndSet(this.stamina.get(), this.staminaMax);
|
|
||||||
// else
|
|
||||||
// this.stamina.compareAndSet(this.stamina.get(), this.stamina.get() + stamIncrease);
|
|
||||||
// this.timestamps.put("STAMHEALTICK", System.currentTimeMillis());
|
|
||||||
// ChatManager.chatSystemInfo(this, "Healed 7 Stamina");
|
|
||||||
// }
|
|
||||||
//} else {
|
|
||||||
// this.timestamps.put("STAMHEALTICK", System.currentTimeMillis());
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (!this.isAlive() && this.isEnteredWorld()) {
|
if (!this.isAlive() && this.isEnteredWorld()) {
|
||||||
if (!this.timestamps.containsKey("DeathTime")) {
|
if (!this.timestamps.containsKey("DeathTime")) {
|
||||||
this.timestamps.put("DeathTime", System.currentTimeMillis());
|
this.timestamps.put("DeathTime", System.currentTimeMillis());
|
||||||
@@ -5147,26 +5129,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
forceRespawn(this);
|
forceRespawn(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if(!this.timestamps.containsKey("stamTick")){
|
|
||||||
// this.timestamps.put("stamTick", System.currentTimeMillis());
|
|
||||||
//}else{
|
|
||||||
// if(this.containsEffect(441156479) || this.containsEffect(441156455)) {
|
|
||||||
// if(System.currentTimeMillis() - this.timestamps.get("stamTick") > 5000){
|
|
||||||
// boolean worked = false;
|
|
||||||
// while(!worked) {
|
|
||||||
// float old = this.stamina.get();
|
|
||||||
// float mod = old + 4;
|
|
||||||
// if (mod > this.staminaMax)
|
|
||||||
// mod = this.staminaMax;
|
|
||||||
//
|
|
||||||
// worked = this.stamina.compareAndSet(old, mod);
|
|
||||||
// }
|
|
||||||
// this.timestamps.put("stamTick", System.currentTimeMillis());
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// this.timestamps.put("stamTick", System.currentTimeMillis());
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (this.isAlive() && this.isActive && this.enteredWorld) {
|
if (this.isAlive() && this.isActive && this.enteredWorld) {
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ public class UpdateThread implements Runnable {
|
|||||||
try {
|
try {
|
||||||
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()){
|
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()){
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.update(true);
|
try {
|
||||||
|
player.update(true);
|
||||||
|
}catch(Exception e){
|
||||||
|
Logger.error("UPDATE ERROR FOR PLAYER: " + player.getFirstName(),e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -43,20 +47,31 @@ public class UpdateThread implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
lastRun = System.currentTimeMillis();
|
//lastRun = System.currentTimeMillis();
|
||||||
|
//while (true) {
|
||||||
|
// if (System.currentTimeMillis() >= lastRun + instancedelay) { // Correct condition
|
||||||
|
// this.processPlayerUpdate();
|
||||||
|
// lastRun = System.currentTimeMillis(); // Update lastRun after processing
|
||||||
|
// }else {
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(100); // Pause for 100ms to reduce CPU usage
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Logger.error("Thread interrupted", e);
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Thread.yield();
|
||||||
|
//}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (System.currentTimeMillis() >= lastRun + instancedelay) { // Correct condition
|
try {
|
||||||
this.processPlayerUpdate();
|
this.processPlayerUpdate(); // Execute update logic
|
||||||
lastRun = System.currentTimeMillis(); // Update lastRun after processing
|
Thread.sleep(250); // Always sleep for 250ms
|
||||||
}else {
|
} catch (InterruptedException e) {
|
||||||
try {
|
Logger.error("Thread interrupted", e);
|
||||||
Thread.sleep(100); // Pause for 100ms to reduce CPU usage
|
Thread.currentThread().interrupt();
|
||||||
} catch (InterruptedException e) {
|
break; // Exit loop if interrupted
|
||||||
Logger.error("Thread interrupted", e);
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Thread.yield();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user