Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+47 -48
View File
@@ -17,62 +17,61 @@ import org.pmw.tinylog.Logger;
public class SiegeSpireWithdrawlJob extends AbstractScheduleJob {
private Building spire = null;
private Building spire = null;
public SiegeSpireWithdrawlJob(Building spire) {
super();
this.spire = spire;
}
public SiegeSpireWithdrawlJob(Building spire) {
super();
this.spire = spire;
}
@Override
protected void doJob() {
@Override
protected void doJob() {
if (spire == null)
return;
if (spire == null)
return;
// Early exit if someone disabled the spire
// Early exit if someone disabled the spire
if (!spire.isSpireIsActive())
return;
City buildingCity = spire.getCity();
if (buildingCity == null)
return;
buildingCity.transactionLock.writeLock().lock();
try{
// If the spire runs out of money, disable it.
//*** Refactor: 5000 every 30 seconds? Wtf?
if (!spire.isSpireIsActive())
return;
if (!spire.hasFunds(5000)){
spire.disableSpire(true);
return;
}
if (spire.getStrongboxValue() < 5000) {
spire.disableSpire(true);
return;
}
City buildingCity = spire.getCity();
// Deduct the activation cost from the strongbox and resubmit the job
if (buildingCity == null)
return;
if (!spire.transferGold(-5000,false))
return;
JobContainer jc = JobScheduler.getInstance().scheduleJob(new SiegeSpireWithdrawlJob(spire), 300000);
spire.getTimers().put("SpireWithdrawl", jc);
}catch(Exception e){
Logger.error(e);
}finally{
buildingCity.transactionLock.writeLock().unlock();
}
}
buildingCity.transactionLock.writeLock().lock();
try {
@Override
protected void _cancelJob() {
}
// If the spire runs out of money, disable it.
//*** Refactor: 5000 every 30 seconds? Wtf?
if (!spire.hasFunds(5000)) {
spire.disableSpire(true);
return;
}
if (spire.getStrongboxValue() < 5000) {
spire.disableSpire(true);
return;
}
// Deduct the activation cost from the strongbox and resubmit the job
if (!spire.transferGold(-5000, false))
return;
JobContainer jc = JobScheduler.getInstance().scheduleJob(new SiegeSpireWithdrawlJob(spire), 300000);
spire.getTimers().put("SpireWithdrawl", jc);
} catch (Exception e) {
Logger.error(e);
} finally {
buildingCity.transactionLock.writeLock().unlock();
}
}
@Override
protected void _cancelJob() {
}
}