if (oldOwner != null) {
long amount = getTreasury();
if (amount > 0) {
Warehouse warehouse = oldOwner.getWarehouse();
if (warehouse != null) {
warehouse.addItem(ItemTemplate.ITEM_ID_ADENA, amount);
addToTreasuryNoTax(-amount, false, false);
Log.add(getName() + "|" + -amount + "|Castle:changeOwner", "treasury");
}
}