[BUG] Fix servers being un-pingable. Closes #13

This commit is contained in:
2024-09-09 23:10:04 +02:00
parent c2d7e0a8a8
commit 5d98d14bc6
4 changed files with 24 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ public class ServerStatusMixin {
@Inject(method = "getFavicon", at = @At("RETURN"), cancellable = true)
private void injectIconEvent(CallbackInfoReturnable<String> cir) {
ServerStatusEvent.FaviconRequestEvent event = new ServerStatusEvent.FaviconRequestEvent(cir.getReturnValue().isEmpty() ? Optional.empty() : Optional.of(new WrappedServerStatus.WrappedFavicon(cir.getReturnValue())));
ServerStatusEvent.FaviconRequestEvent event = new ServerStatusEvent.FaviconRequestEvent(isEmpty(cir.getReturnValue()) ? Optional.empty() : Optional.of(new WrappedServerStatus.WrappedFavicon(cir.getReturnValue())));
CraterEventBus.INSTANCE.postEvent(event);
if (event.getNewIcon().isPresent()) {
@@ -24,4 +24,8 @@ public class ServerStatusMixin {
}
}
private boolean isEmpty(String input) {
return input == null || input.isEmpty();
}
}