From 657cc0cf9e07fa3a459594ac7a17a0ccdef34e47 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 5 Jun 2022 20:55:57 -0500 Subject: [PATCH] Cannot Abandon Tree if You Own a Bane : Cannot Abandon Tree if you are a nation --- .../handlers/AbandonAssetMsgHandler.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/engine/net/client/handlers/AbandonAssetMsgHandler.java b/src/engine/net/client/handlers/AbandonAssetMsgHandler.java index 111a2319..588ffcd4 100644 --- a/src/engine/net/client/handlers/AbandonAssetMsgHandler.java +++ b/src/engine/net/client/handlers/AbandonAssetMsgHandler.java @@ -12,6 +12,8 @@ import engine.net.client.msg.ErrorPopupMsg; import engine.objects.*; import org.pmw.tinylog.Logger; +import java.util.concurrent.ConcurrentHashMap; + /* * @Author: * @Summary: Processes application protocol message which processes @@ -92,7 +94,23 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler { // Trees require special handling beyond an individual building if ((building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)) + { + // CHECK IF GUILD HAS A BANE DROPPED + City city = ZoneManager.getCityAtLocation(building.getLoc()); + if(city.getGuild().isNation() == true) + { + //nations cant abandon their tree + ErrorPopupMsg.sendErrorMsg(player, "Nations Cannot Abandon Their Capital!"); + return true; + } + if(Bane.getBaneByAttackerGuild(city.getGuild()) != null) + { + ErrorPopupMsg.sendErrorMsg(player, "You Cannot Abandon Your Tree With An Active Siege!"); + return true; + } + AbandonAllCityObjects(player, building); + } else AbandonSingleAsset(player, building);