Browse Source

city.isDestroyed

bane-update2
MagicBot 3 months ago
parent
commit
668b61b734
  1. 6
      src/engine/objects/City.java

6
src/engine/objects/City.java

@ -41,6 +41,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
public class City extends AbstractWorldObject { public class City extends AbstractWorldObject {
@ -80,6 +81,7 @@ public class City extends AbstractWorldObject {
private String hash; private String hash;
public Warehouse warehouse; public Warehouse warehouse;
public Realm realm; public Realm realm;
public AtomicBoolean isDestroyed = new AtomicBoolean(false);
/** /**
* ResultSet Constructor * ResultSet Constructor
@ -1102,10 +1104,14 @@ public class City extends AbstractWorldObject {
public final void destroy() { public final void destroy() {
if (this.isDestroyed.compareAndSet(false, true)) {
Thread destroyCityThread = new Thread(new DestroyCityThread(this)); Thread destroyCityThread = new Thread(new DestroyCityThread(this));
destroyCityThread.setName("destroyCity:" + this.getParent().zoneName); destroyCityThread.setName("destroyCity:" + this.getParent().zoneName);
destroyCityThread.start(); destroyCityThread.start();
} else
Logger.error("Attempt to destroy destroyed city");
} }
public final void transfer(AbstractCharacter newOwner) { public final void transfer(AbstractCharacter newOwner) {

Loading…
Cancel
Save