11package com .unfamoussoul .test ;
22
33import com .unfamoussoul .sapi .SAPI ;
4+ import com .unfamoussoul .sapi .api .database .DatabaseConfig ;
45import com .unfamoussoul .sapi .api .serialize .Persistent ;
56import com .unfamoussoul .sapi .module .SAPIModule ;
67import com .unfamoussoul .test .command .RememberCommand ;
78import com .unfamoussoul .test .command .RemindCommand ;
89import com .unfamoussoul .test .command .TestCommand ;
910import com .unfamoussoul .test .config .Config ;
11+ import com .unfamoussoul .test .database .TestDatabaseHandler ;
1012import com .unfamoussoul .test .listener .EventListener ;
1113import com .unfamoussoul .test .web .Web ;
1214
1618public class Test extends SAPIModule {
1719
1820 private Config config ;
21+ private TestDatabaseHandler databaseHandler ;
1922
2023 @ Persistent (value = "player_phrases" )
2124 private final Map <UUID , List <String >> playerPhrases = new HashMap <>();
@@ -35,6 +38,9 @@ public void onEnable() {
3538 addCommand (new RemindCommand (this ));
3639 addListener (new EventListener (this ));
3740 addWebListener (new Web (this ), config .webPort );
41+ DatabaseConfig databaseConfig = DatabaseConfig .forSqlite (config .databaseJDBC );
42+ databaseHandler = new TestDatabaseHandler (databaseConfig );
43+ addDatabaseHandler (databaseHandler );
3844 getLogger ().warning ("test---" );
3945 }
4046
@@ -43,6 +49,10 @@ public void onDisable() {
4349 getLogger ().warning ("test+++" );
4450 }
4551
52+ public TestDatabaseHandler getDatabaseHandler () {
53+ return databaseHandler ;
54+ }
55+
4656 public void addPhrase (UUID playerId , String phrase ) {
4757 playerPhrases .computeIfAbsent (playerId , k -> new ArrayList <>()).add (phrase );
4858 }
0 commit comments