[BUG] Fix servers being un-pingable. Closes #13
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user