package Ġli rand . api . dsl . command . types Ċ Ċ import Ġcom . moj ang . b rig ad ier . Message Ċ import Ġcom . moj ang . b rig ad ier . String Reader Ċ import Ġcom . moj ang . b rig ad ier . context . Command Context Ċ import Ġcom . moj ang . b rig ad ier . suggestion . Suggestions Ċ import Ġcom . moj ang . b rig ad ier . suggestion . Suggestions Builder Ċ import Ġli rand . api . dsl . command . types . exceptions . Chat Command Exception Type Ċ import Ġli rand . api . dsl . command . types . exceptions . Chat Command Syntax Exception Ċ import Ġli rand . api . extensions . server . server Ċ import Ġnet . md _ 5 . b ungee . api . chat . Trans latable Component Ċ import Ġorg . bukkit . World Ċ import Ġjava . util . concurrent . Comp letableFuture Ċ Ċ /** Ċ Ġ* ĠA Ġ[ World ] Ġtype . Ċ Ġ*/ Ċ open Ġclass ĠWorld Type ( Ċ ĉ open Ġval Ġallowed World s : Ġ() Ġ-> ĠMap < out ĠWorld , ĠMessage ?> Ġ= ĠInstance . allowed World s , Ċ ĉ open Ġval Ġnot Found Exception Type : ĠChat Command Exception Type Ġ= ĠInstance . not Found Exception Type Ċ ) Ġ: ĠQu ot able StringType < World > Ġ{ ĊĊ ĉ /** Ċĉ Ġ* ĠReturns Ġa Ġ[ World ] Ġfrom Ġthe Ġresult Ġof Ġthe Ġ[ allowed World s ] Ċĉ Ġ* Ġwhich Ġname Ġmatches Ġthe Ġstring Ġreturned Ġby Ġthe Ġgiven Ġ[ reader ]. Ċĉ Ġ* ĠA Ġname Ġthat Ġcontains Ġwh ites p aces Ġmust Ġbe Ġen closed Ġin Ġdouble Ġquot ation Ġmarks . Ċĉ Ġ* Ċĉ Ġ* Ġ@ param Ġreader Ġthe Ġreader Ċĉ Ġ* Ġ@ return Ġa Ġ[ World ] Ġwith Ġthe Ġgiven Ġname Ċĉ Ġ* Ġ@ throws ĠChat Command Syntax Exception Ġif Ġa Ġworld Ġwith Ġthe Ġgiven Ġname Ġdoes Ġnot Ġexist Ċĉ Ġ*/ Ċ ĉ override Ġfun Ġparse ( reader : ĠString Reader ): ĠWorld Ġ{ Ċĉ ĉ val Ġname Ġ= Ġreader . readString () ĊĊĉ ĉ return Ġserver . get World ( name )?. take If Ġ{ Ġit Ġin Ġallowed World s () Ġ} Ċĉĉ ĉ ?: Ġthrow Ġnot Found Exception Type . create WithContext ( reader , Ġname ) Ċ ĉ } ĊĊ ĉ /** Ċĉ Ġ* ĠReturns Ġthe Ġ[ World ] Ġnames Ġfrom Ġthe Ġresult Ġof Ġthe Ġ[ allowed World s ] Ċĉ Ġ* Ġthat Ġstart Ġwith Ġthe Ġremaining Ġinput Ġof Ġthe Ġgiven Ġ[ builder ]. Ċĉ Ġ* Ċĉ Ġ* Ġ@ param ĠS Ġthe Ġtype Ġof Ġthe Ġsource Ċĉ Ġ* Ġ@ param Ġcontext Ġthe Ġcontext Ċĉ Ġ* Ġ@ param Ġbuilder Ġthe Ġbuilder Ċĉ Ġ* Ġ@ return Ġthe Ġ[ World ] Ġnames Ġthat Ġstart Ġwith Ġthe Ġremaining Ġinput Ċĉ Ġ*/ Ċ ĉ override Ġfun Ġ< S > Ġlist Suggestions ( Ċĉ ĉ context : ĠCommand Context < S >, Ċĉ ĉ builder : ĠSuggest ions Builder Ċ ĉ ): ĠCompletableFuture < Suggestions > Ġ{ Ċĉ ĉ allowed World s (). map Keys Ġ{ Ġ( world , Ġ_) Ġ-> Ġworld . name Ġ} Ċĉĉ ĉ . filter Keys Ġ{ Ġit . startsWith ( builder . remaining , Ġtrue ) Ġ} Ċĉĉ ĉ . forEach Ġ{ Ġ( world Name , Ġtooltip ) Ġ-> Ċĉĉĉ ĉ if Ġ( tooltip Ġ!= Ġnull ) Ċĉĉĉĉ ĉ builder . suggest ( world Name , Ġtooltip ) Ċĉĉĉ ĉ else Ċĉĉĉĉ ĉ builder . suggest ( world Name ) Ċĉĉ ĉ } ĊĊĉ ĉ return Ġbuilder . build Future () Ċ ĉ } ĊĊ ĉ override Ġfun Ġget Examples (): ĠList < String > Ġ= ĠlistOf (" my _ fancy _ world ", Ġ"\" Y et Ġanother Ġworld \" ") ĊĊ ĉ comp anion Ġobject ĠInstance Ġ: ĠWorld Type ( Ċĉ ĉ allowed World s Ġ= Ġ{ Ġserver . world s . associate With Ġ{ Ġnull Ġ} Ġ}, Ċĉ ĉ not Found Exception Type Ġ= ĠChat Command Exception Type Ġ{ Ċĉĉ ĉ Trans latable Component (" argument . dimension . invalid ", Ġit [ 0 ]) Ċĉ ĉ } Ċ ĉ ) Ċ }