package Ġit . anc ient real ms . listener Ċ Ċ import Ġcom . pal mer games . bukkit . town y .` object `. Town Ċ import Ġcom . pal mer games . bukkit . town y . event . N ation Up keep Calculation Event Ċ import Ġcom . pal mer games . bukkit . town y . event . Pre New Day Event Ċ import Ġcom . pal mer games . bukkit . town y . event . Town Up keep Calculation Event Ċ import Ġcom . pal mer games . bukkit . town y . event . town . Town Ru ined Event Ċ import Ġcom . pal mer games . bukkit . town y . event . town . toggle . Town Toggle P VP Event Ċ import Ġit . anc ient real ms . Fort ress Ċ import Ġit . anc ient real ms . utils . Utils Ċ import Ġorg . bukkit . event . EventHandler Ċ import Ġorg . bukkit . event . Event Priority Ċ import Ġorg . bukkit . event . Listener Ċ Ċ class ĠT own y Listener Ġ: ĠListener Ġ{ ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . HIG HE ST ) ĊĠĠĠ Ġfun Ġon New Day (@ Suppress (" UNUSED _ PARAMETER ") Ġevent : ĠPre New Day Event ) Ġ{ ĊĠĠĠĠĠĠĠ ĠFort ress . INSTANCE . fort resses Manager . getF ort resses (). filter Ġ{ Ġfort ress Ġ-> Ġfort ress . owner Ġ!= Ġnull Ġ}. forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit . owner ?. collect ( it . daily Money Bonus . toDouble ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . HIG HE ST ) ĊĠĠĠ Ġfun Ġon Town Up keep ( event : ĠT own Up keep Calculation Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtown Ġ= Ġevent . town ĊĠĠĠĠĠĠĠ Ġvar Ġtotal Discount Ġ= Ġ 0 f ĊĠĠĠĠĠĠĠ ĠFort ress . INSTANCE . fort resses Manager . getF ort resses () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġfort ress Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfort ress . owner Ġ!= Ġnull Ġ&& Ġ( fort ress . owner Ġ== Ġtown Ġ|| Ġ( Utils . Companion . getN ation ( fort ress . owner !! ) Ġ== ĠUtils . Companion . getN ation ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtown ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) Ġ&& Ġ! fort ress . only Capital Gets Bonus )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. forEach Ġ{ Ġfort ress Ġ-> Ġtotal Discount Ġ+= Ġfort ress . town Up keep Discount Ġ} ĊĠĠĠĠĠĠĠ Ġevent . up keep Ġ-= Ġevent . up keep Ġ* Ġtotal Discount Ġ/ Ġ 1 0 0 ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ĊĠĠĠ Ġfun Ġon N ation Up keep ( event : ĠN ation Up keep Calculation Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġvar Ġtotal Discount Ġ= Ġ 0 f ĊĠĠĠĠĠĠĠ ĠFort ress . INSTANCE . fort resses Manager . getF ort resses () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġfort ress Ġ-> Ġfort ress . owner Ġ!= Ġnull Ġ&& Ġfort ress . owner !!. has N ation () Ġ&& Ġfort ress . owner !!. n ation . get UUID () Ġ== Ġevent . n ation . get UUID () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. forEach Ġ{ Ġfort ress Ġ-> Ġtotal Discount Ġ+= Ġfort ress . n ation Up keep Discount Ġ} ĊĠĠĠĠĠĠĠ Ġevent . up keep Ġ-= Ġevent . up keep Ġ* Ġtotal Discount Ġ/ Ġ 1 0 0 ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ĊĠĠĠ Ġfun Ġon Town Dis band ( event : ĠT own Ru ined Event ){ ĊĠĠĠĠĠĠĠ Ġremove Owned Fort ress ( event . town ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ĊĠĠĠ Ġfun Ġon Town Toggle P VP ( event : ĠT own Toggle P VP Event ){ ĊĠĠĠĠĠĠĠ Ġremove Owned Fort ress ( event . town ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġremove Owned Fort ress ( town : ĠT own ){ ĊĠĠĠĠĠĠĠ ĠFort ress . INSTANCE . fort resses Manager . getF ort resses (). forEach { ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif ( it . owner Ġ== Ġtown ){ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . owner Ġ= Ġnull ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠFort ress . INSTANCE . fort resses Config . config . set ( it . name , Ġit ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }