Ejemplo n.º 1
0
  public ServerPing build(String aMessage) {
    String _cmpnt[] = aMessage.split(":");

    ServerPing _pMsg = new ServerPing();
    _pMsg.setText(_cmpnt[1]);

    return _pMsg;
  }
Ejemplo n.º 2
0
  private void a(ServerPing serverping) {
    File file = this.d("server-icon.png");

    if (file.isFile()) {
      ByteBuf bytebuf = Unpooled.buffer();

      try {
        BufferedImage bufferedimage = ImageIO.read(file);

        Validate.validState(
            bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
        Validate.validState(
            bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
        ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
        ByteBuf bytebuf1 = Base64.encode(bytebuf);

        serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
      } catch (Exception exception) {
        MinecraftServer.LOGGER.error("Couldn\'t load server icon", exception);
      } finally {
        bytebuf.release();
      }
    }
  }