package Ġcom . r pk it . prof essions . bukkit . listener Ċ Ċ import Ġcom . r pk it . characters . bukkit . event . character . RP K Bu kkit Character Switch Event Ċ import Ġcom . r pk it . core . service . Services Ċ import Ġcom . r pk it . prof essions . bukkit . prof ession . RP K Prof ession Service Ċ import Ġorg . bukkit . event . EventHandler Ċ import Ġorg . bukkit . event . Listener Ċ import Ġjava . util . concurrent . Comp letableFuture Ċ Ċ class ĠRP K Character Switch Listener Ġ: ĠListener Ġ{ ĊĊĠĠĠ Ġ@ EventHandler ĊĠĠĠ Ġfun Ġon Character Switch ( event : ĠRP K Bu kkit Character Switch Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġold Character Ġ= Ġevent . from Character ĊĠĠĠĠĠĠĠ Ġval Ġnew Character Ġ= Ġevent . character ĊĠĠĠĠĠĠĠ Ġval Ġprof ession Service Ġ= ĠServices [ RP K Prof ession Service :: class . java ] Ġ?: Ġreturn ĊĠĠĠĠĠĠĠ Ġif Ġ( old Character Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġprof essions Ġ= Ġprof ession Service . get Prof essions ( old Character ). join () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprof essions . forEach Ġ{ Ġprof ession Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprof ession Service . unload Prof ession Experience ( old Character , Ġprof ession ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprof ession Service . unload Prof essions ( old Character ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( new Character Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprof ession Service . load Prof essions ( new Character ). then Accept Ġ{ Ġprof essions Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠCompletableFuture . all Of (* prof essions . map Ġ{ Ġprof ession Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprof ession Service . load Prof ession Experience ( new Character , Ġprof ession ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ}. to Typed Array ()). join () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}. join () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }