package Ġlv . mt m 1 2 3 . qu ack bridge Ċ Ċ import Ġlv . mt m 1 2 3 . qu ack bridge . config . Config Ċ import Ġlv . mt m 1 2 3 . qu ack bridge . discord . Discord Webhook Handler Ċ import Ġlv . mt m 1 2 3 . qu ack bridge . discord . Message Request Ċ import Ġnet . dv 8 tion . j da . api . Embed Builder Ċ import Ġnet . dv 8 tion . j da . api . J DA Ċ import Ġorg . spongepowered . api . entity . living . player . Player Ċ import Ġorg . spongepowered . api . event . Listener Ċ import Ġorg . spongepowered . api . event . Order Ċ import Ġorg . spongepowered . api . event . advance ment . Advance ment Event Ċ import Ġorg . spongepowered . api . event . entity . Dest ruct Entity Event Ċ import Ġorg . spongepowered . api . event . filter . cause . First Ċ import Ġorg . spongepowered . api . event . message . Message Channel Event Ċ import Ġorg . spongepowered . api . event . network . Client Connection Event Ċ Ċ class ĠListener ( private Ġval Ġj da : ĠJ DA , Ġprivate Ġval Ġwebhook Handler : ĠDiscord Webhook Handler , Ġprivate Ġval Ġconfig : ĠConfig ) Ġ{ ĊĊĠĠĠ Ġ@ Listener ( order Ġ= ĠOrder . POST ) ĊĠĠĠ Ġfun Ġon Chat ( event : ĠMessage Channel Event . Chat , Ġ@ First Ġplayer : ĠPlayer ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmsg Ġ= ĠMessage Request ("${ config . avatar Api Url }/${ player . unique Id }", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġevent . raw Message . to Plain (), Ġplayer . name ) ĊĠĠĠĠĠĠĠ Ġwebhook Handler . postMessage ( msg ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Listener ( order Ġ= ĠOrder . POST ) ĊĠĠĠ Ġfun Ġon Advance ment ( event : ĠAdv ance ment Event . Grant , Ġ@ First Ġplayer : ĠPlayer ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( event . advance ment . name . startsWith (" recipes ")) Ġreturn ĊĠĠĠĠĠĠĠ Ġval Ġembed Ġ= ĠEmbed Builder (). set Author ("${ player . name } Ġgot Ġa Ġnew Ġadvance ment :") ĊĠĠĠĠĠĠĠ Ġembed . setTitle ( event . advance ment . name ) ĊĠĠĠĠĠĠĠ Ġevent . advance ment . display Info . get (). let Ġ{ Ġdi Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġembed . setDescription ( di . description . to Plain ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġj da . getText Channel ById ( config . chat Channel )?. sendMessage ( embed . build ()) ?. queue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Listener ( order Ġ= ĠOrder . POST ) ĊĠĠĠ Ġfun Ġon Death ( event : ĠDest ruct Entity Event . Death ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( event . target Entity Ġ! is ĠPlayer ) Ġreturn ĊĊĠĠĠĠĠĠĠ Ġval Ġp Ġ= Ġevent . target Entity Ġas ĠPlayer ĊĠĠĠĠĠĠĠ Ġval Ġmsg Ġ= Ġevent . message . to Plain () ĊĠĠĠĠĠĠĠ Ġif Ġ( msg . isEmpty ()) Ġreturn ĊĊĠĠĠĠĠĠĠ Ġj da . getText Channel ById ( config . chat Channel )?. sendMessage (" **: sk ull _ cross bones : Ġ$ msg ** ") ?. queue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Listener ( order Ġ= ĠOrder . POST ) ĊĠĠĠ Ġfun Ġon Join ( event : ĠClient Connection Event . Join , Ġ@ First Ġplayer : ĠPlayer ) Ġ{ ĊĠĠĠĠĠĠĠ Ġj da . getText Channel ById ( config . chat Channel )?. sendMessage (" ** Ġ${ player . name } Ġjoined Ġthe Ġserver Ġ** ") ?. queue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Listener ĊĠĠĠ Ġfun Ġon Quit ( event : ĠClient Connection Event . Disconnect , Ġ@ First Ġplayer : ĠPlayer ) Ġ{ ĊĠĠĠĠĠĠĠ Ġj da . getText Channel ById ( config . chat Channel )?. sendMessage (" ** Ġ${ player . name } Ġleft Ġthe Ġserver Ġ** ") ?. queue () ĊĠĠĠ Ġ} Ċ } Ċ