File tree Expand file tree Collapse file tree
src/main/java/dev/zenith/ppapi/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- plugin_version =1.0.0
1+ plugin_version =1.0.1
22plugin_name =PearlPlusWebAPI
33mc =1.21.4
44maven_group =dev.zenith.ppapi
Original file line number Diff line number Diff line change @@ -119,7 +119,13 @@ private Javalin createServer() {
119119 ctx .json (new ApiErrorResponse (result .error ()));
120120 return ;
121121 }
122- ctx .json (new PearlStatusResponse (result .pearls (), result .output ()));
122+ var botInfo = readZenithBotInfo ();
123+ ctx .json (new PearlStatusResponse (
124+ result .pearls (),
125+ result .output (),
126+ botInfo .minecraftServer (),
127+ botInfo .botUsername ()
128+ ));
123129 ctx .status (200 );
124130 })
125131 .post ("/pearlplus/load" , ctx -> {
@@ -222,4 +228,27 @@ private record ConfigPearlResult(
222228 List <String > output ,
223229 String error
224230 ) { }
231+
232+ private BotInfo readZenithBotInfo () {
233+ String server = null ;
234+ String username = null ;
235+ var config = Globals .CONFIG ;
236+ if (config != null ) {
237+ if (config .authentication != null ) {
238+ username = config .authentication .username ;
239+ }
240+ if (config .client != null && config .client .server != null ) {
241+ var address = config .client .server .address ;
242+ if (address != null && !address .isBlank ()) {
243+ server = address ;
244+ }
245+ }
246+ }
247+ return new BotInfo (server , username );
248+ }
249+
250+ private record BotInfo (
251+ String minecraftServer ,
252+ String botUsername
253+ ) { }
225254}
Original file line number Diff line number Diff line change 44
55public record PearlStatusResponse (
66 List <String > pearls ,
7- List <String > output
7+ List <String > output ,
8+ String minecraftServer ,
9+ String botUsername
810) { }
You can’t perform that action at this time.
0 commit comments