/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 2 1 ĠD umb Dog D iner Ġ< d umb dog d iner . com >. ĠAll Ġrights Ġreserved . Ċ Ġ* ĠLicensed Ġunder Ġthe ĠMIT Ġlicense , Ġsee ĠLICENSE Ġfor Ġmore Ġinformation . Ċ Ġ*/ Ċ package Ġcom . d umb dog d iner . sticky commands . listeners Ċ Ċ import Ġcom . d umb dog d iner . sticky commands . Sticky Commands Ċ import Ġkotlin . math . floor Ċ import Ġorg . bukkit . Material Ċ import Ġorg . bukkit . entity . Living Entity Ċ import Ġorg . bukkit . entity . Player Ċ import Ġorg . bukkit . event . EventHandler Ċ import Ġorg . bukkit . event . Event Priority Ċ import Ġorg . bukkit . event . Listener Ċ import Ġorg . bukkit . event . player . Async Player Chat Event Ċ import Ġorg . bukkit . event . player . Player Event Ċ import Ġorg . bukkit . event . player . Player Interact Event Ċ import Ġorg . bukkit . event . player . Player Move Event Ċ import Ġorg . bukkit . event . player . Player Resp awn Event Ċ import Ġorg . bukkit . event . player . Player Toggle Flight Event Ċ import Ġorg . bukkit . event . player . Player Toggle S ne ak Event Ċ import Ġorg . bukkit . event . player . Player Toggle Sprint Event Ċ Ċ class ĠA fk EventListener Ġ: ĠListener Ġ{ ĊĊĠĠĠ Ġ@ EventHandler ĊĠĠĠ Ġfun Ġon Move ( event : ĠPlayer Move Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġplayer Ġ= Ġevent . player ĊĠĠĠĠĠĠĠ Ġval Ġfrom Ġ= Ġevent . from ĊĠĠĠĠĠĠĠ Ġval Ġto Ġ= Ġevent . to ĊĠĠĠĠĠĠĠ Ġval Ġhas Moved Ġ= Ġ( floor ( to . x ) Ġ!= Ġfloor ( from . x ) Ġ|| Ġfloor ( to . y ) Ġ!= Ġfloor ( from . y ) Ġ|| Ġfloor ( to . z ) Ġ!= Ġfloor ( from . z )) ĊĊĠĠĠĠĠĠĠ Ġif Ġ( has Moved Ġ&& Ġ( player . world . getBlock At ( to ). type Ġ!= ĠMaterial . WATER ) Ġ&& ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ(! player . is Sw im ming Ġ|| Ġ! player . is Inside Vehicle Ġ|| Ġ! player . is Gl iding Ġ|| Ġ! player . isIn Bubble Column ) Ġ&& ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfrom . block . type Ġ!= ĠMaterial . WATER Ġ&& ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ(! near by Contains Player ( player ))) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠReset Ġtheir ĠA FK Ġstatus ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcheck A fk ( event ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . MONITOR ) ĊĠĠĠ Ġfun Ġon Toggle Flight ( event : ĠPlayer Toggle Flight Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcheck A fk ( event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . MONITOR ) ĊĠĠĠ Ġfun Ġon Toggle S ne ak ( event : ĠPlayer Toggle S ne ak Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcheck A fk ( event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . MONITOR ) ĊĠĠĠ Ġfun Ġon Toggle Sprint ( event : ĠPlayer Toggle Sprint Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcheck A fk ( event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . MONITOR ) ĊĠĠĠ Ġfun Ġon Chat ( event : ĠAsync Player Chat Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcheck A fk ( event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . MONITOR ) ĊĠĠĠ Ġfun Ġon Interact ( event : ĠPlayer Interact Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcheck A fk ( event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ EventHandler ( priority Ġ= ĠEvent Priority . MONITOR ) ĊĠĠĠ Ġfun Ġon Resp awn ( event : ĠPlayer Resp awn Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcheck A fk ( event ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcheck A fk ( event : ĠPlayer Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstate Ġ= ĠSt icky Commands . plugin . player StateManager . getPlayer State ( event . player ) ĊĠĠĠĠĠĠĠ Ġstate . reset A fk Time () ĊĠĠĠĠĠĠĠ Ġif Ġ( state . is A fk ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstate . set A fk ( false , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġnearby Contains Player ( player : ĠPlayer ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġfor Ġ( entity Ġin Ġplayer . world . get Near by Entities ( player . location , Ġ 1 . 0 , Ġ 1 . 0 , Ġ 1 . 0 )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠWe Ġneed Ġto Ġcheck Ġif Ġsomething Ġlike Ġa Ġshe ep Ġor Ġvill ager Ġmoved Ġthe Ġplayer ! ĠSo Ġwe Ġcan Ġjust Ġuse ĠL iving Entity ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( entity Ġis ĠL iving Entity Ġ&& Ġentity Ġ!= Ġplayer ) Ġreturn Ġtrue ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġfalse ĊĠĠĠ Ġ} Ċ } Ċ