diff --git a/BasicInfoAPI/src/main/conn/MinecraftServer.java b/BasicInfoAPI/src/main/conn/MinecraftServer.java index 1e6cf30..a761272 100644 --- a/BasicInfoAPI/src/main/conn/MinecraftServer.java +++ b/BasicInfoAPI/src/main/conn/MinecraftServer.java @@ -281,7 +281,8 @@ public String getFaviconBase64() { @Override public BufferedImage getFaviconImage(){ try{ - return base64ToBufferedImage(getFaviconBase64().split(",")[1]); + if (getFaviconBase64()!=null) + return base64ToBufferedImage(getFaviconBase64().split(",")[1]); }catch (Exception e){ e.printStackTrace(); } diff --git a/BasicInfoAPI/src/test/conn/MinecraftServerTest.java b/BasicInfoAPI/src/test/conn/MinecraftServerTest.java index 9498eb3..2aca7c4 100644 --- a/BasicInfoAPI/src/test/conn/MinecraftServerTest.java +++ b/BasicInfoAPI/src/test/conn/MinecraftServerTest.java @@ -9,7 +9,7 @@ public class MinecraftServerTest { public static void main(String[] args)throws Exception { - MinecraftServer minecraftServer=new MinecraftServer("play.ee-fans.com",25565); + MinecraftServer minecraftServer=new MinecraftServer("localhost",25567); System.out.println("available:"+minecraftServer.isAvailable()); System.out.println("version:name:"+minecraftServer.getVersionName()+" protocol:"+minecraftServer.getVersionProtocol()); System.out.println("defaultDescription:color:"+minecraftServer.getDefaultDescriptionColor()+" text:"+minecraftServer.getDefaultDescriptionText()); @@ -24,10 +24,12 @@ public static void main(String[] args)throws Exception { } System.out.println("favicon:"+minecraftServer.getFaviconBase64()); - FaviconDisplay display=new FaviconDisplay(minecraftServer.getFaviconImage()); - display.setBounds(200,200,200,200); - display.setVisible(true); - display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + if (minecraftServer.getFaviconImage()!=null) { + FaviconDisplay display = new FaviconDisplay(minecraftServer.getFaviconImage()); + display.setBounds(200, 200, 200, 200); + display.setVisible(true); + display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } } static class FaviconDisplay extends JFrame{