New atomic boolean to lock down destruction
This commit is contained in:
@@ -505,6 +505,11 @@ public class Building extends AbstractWorldObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isDeranking.compareAndSet(false, true) == false) {
|
||||||
|
Logger.error("Attempt to derank tol twice");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bane = city.getBane();
|
bane = city.getBane();
|
||||||
|
|
||||||
// We need to collect the spires and shrines on the citygrid in case
|
// We need to collect the spires and shrines on the citygrid in case
|
||||||
@@ -600,8 +605,6 @@ public class Building extends AbstractWorldObject {
|
|||||||
|
|
||||||
newOwner = Guild.GetGL(bane.getOwner().getGuild());
|
newOwner = Guild.GetGL(bane.getOwner().getGuild());
|
||||||
|
|
||||||
this.isDeranking.compareAndSet(false, true);
|
|
||||||
|
|
||||||
if ((bane.getOwner().getGuild().getGuildState() == GuildState.Sovereign) ||
|
if ((bane.getOwner().getGuild().getGuildState() == GuildState.Sovereign) ||
|
||||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Protectorate) ||
|
(bane.getOwner().getGuild().getGuildState() == GuildState.Protectorate) ||
|
||||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Province) ||
|
(bane.getOwner().getGuild().getGuildState() == GuildState.Province) ||
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
@@ -1102,9 +1104,14 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
public final void destroy() {
|
public final void destroy() {
|
||||||
|
|
||||||
|
if (this.isDestroyed.compareAndSet(false, true) == false) {
|
||||||
|
Logger.error("Attempt to destroy tol twice");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Thread destroyCityThread = new Thread(new DestroyCityThread(this));
|
Thread destroyCityThread = new Thread(new DestroyCityThread(this));
|
||||||
|
|
||||||
destroyCityThread.setName("destroyCity:" + this.getName());
|
destroyCityThread.setName("destroyCity: " + this.getName());
|
||||||
destroyCityThread.start();
|
destroyCityThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user