44import core .i18n .file .ComponentBundle ;
55import core .io .IO ;
66import io .papermc .paper .plugin .lifecycle .event .types .LifecycleEvents ;
7+ import net .kyori .adventure .key .Key ;
78import net .kyori .adventure .text .minimessage .MiniMessage ;
89import net .kyori .adventure .text .minimessage .tag .resolver .Placeholder ;
910import net .kyori .adventure .text .minimessage .tag .resolver .TagResolver ;
3031import org .jspecify .annotations .NullMarked ;
3132
3233import java .io .File ;
34+ import java .nio .file .Path ;
3335import java .sql .SQLException ;
3436import java .util .List ;
3537import java .util .Locale ;
@@ -44,21 +46,20 @@ public class EconomistPlugin extends JavaPlugin {
4446 new PluginConfig ()
4547 ).validate ().save ().getRoot ();
4648
47- private final File translations = new File (getDataFolder (), "translations" );
48-
49- private final ComponentBundle bundle = new ComponentBundle (translations ,
50- audience -> audience instanceof Player player ? player .locale () : Locale .US )
51- .register ("economist" , Locale .US )
52- .register ("economist_german" , Locale .GERMANY )
53- .miniMessage (bundle -> MiniMessage .builder ().tags (TagResolver .resolver (
54- TagResolver .standard (),
55- Placeholder .component ("prefix" , bundle .component (Locale .US , "prefix" ))
56- )).build ());
57-
58- private final ComponentBundle abbreviations = new ComponentBundle (translations ,
59- audience -> audience instanceof Player player ? player .locale () : Locale .US )
60- .register ("abbreviations" , Locale .US )
61- .register ("abbreviations_german" , Locale .GERMANY );
49+ private final Key abbreviationsKey = Key .key ("economist" , "translations" );
50+ private final Key translationsKey = Key .key ("economist" , "translations" );
51+ private final Path translations = getDataPath ().resolve ("translations" );
52+
53+ private final ComponentBundle bundle = ComponentBundle .builder (translationsKey , translations )
54+ .placeholder ("prefix" , "prefix" )
55+ .resource ("economist" , Locale .US )
56+ .resource ("economist_german" , Locale .GERMANY )
57+ .build ();
58+
59+ private final ComponentBundle abbreviations = ComponentBundle .builder (abbreviationsKey , translations )
60+ .resource ("abbreviations" , Locale .US )
61+ .resource ("abbreviations_german" , Locale .GERMANY )
62+ .build ();
6263
6364 private final EconomistBankController bankController = new EconomistBankController (this );
6465 private final EconomistEconomyController economyController = new EconomistEconomyController (this );
0 commit comments