package Ġnet . star legacy . util Ċ Ċ import Ġorg . bukkit . entity . Player Ċ import Ġjava . lang . System . currentTimeMillis Ċ import Ġjava . lang . System . nano Time Ċ import Ġjava . util . UUID Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ class ĠPer Player Cooldown ( co old own : ĠLong , Ġtime Unit : ĠTimeUnit Ġ= ĠTimeUnit . MILLISECONDS ) Ġ{ Ċ ĉ private Ġval Ġmap Ġ= Ġmutable Map Of < UUID , ĠLong >() ĊĊ ĉ private Ġval Ġcool down Nan os Ġ= Ġtime Unit . to Nan os ( co old own ) ĊĊ ĉ fun Ġtry Exec ( player : ĠPlayer , Ġblock : Ġ() Ġ-> ĠUnit ) Ġ= Ġtry Exec ( player , Ġthis . co old own Nan os , ĠTimeUnit . NAN O SECONDS , Ġblock ) ĊĊ ĉ fun Ġtry Exec ( player : ĠPlayer , Ġcool down : ĠLong , Ġtime Unit : ĠTimeUnit , Ġblock : Ġ() Ġ-> ĠUnit ) Ġ{ Ċĉ ĉ if Ġ( nano Time () Ġ- Ġmap . getOrElse ( player . unique Id ) Ġ{ Ġ 0 Ġ} Ġ>= Ġtime Unit . to Nan os ( co old own )) Ġ{ Ċĉĉ ĉ map [ player . unique Id ] Ġ= Ġnano Time () Ċĉĉ ĉ block () Ċĉ ĉ } Ċ ĉ } Ċ } Ċ