Fixed setting Base64 favicon for 1.19.4 or later (#2533)
Fix redundant base64 encoding of favicon
This commit is contained in:
parent
564349c914
commit
80aa420099
|
@ -134,8 +134,7 @@ public class WrappedServerPing implements ClonableWrapper {
|
||||||
* @return The favicon, or NULL if no favicon will be displayed.
|
* @return The favicon, or NULL if no favicon will be displayed.
|
||||||
*/
|
*/
|
||||||
public CompressedImage getFavicon() {
|
public CompressedImage getFavicon() {
|
||||||
String favicon = impl.getFavicon();
|
return impl.getFavicon();
|
||||||
return (favicon != null) ? CompressedImage.fromEncodedText(favicon) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +142,7 @@ public class WrappedServerPing implements ClonableWrapper {
|
||||||
* @param image - the new compressed image or NULL if no favicon should be displayed.
|
* @param image - the new compressed image or NULL if no favicon should be displayed.
|
||||||
*/
|
*/
|
||||||
public void setFavicon(CompressedImage image) {
|
public void setFavicon(CompressedImage image) {
|
||||||
impl.setFavicon((image != null) ? image.toEncodedText() : null);
|
impl.setFavicon(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -155,8 +155,10 @@ public final class LegacyServerPing extends AbstractWrapper implements ServerPin
|
||||||
* @return The favicon, or NULL if no favicon will be displayed.
|
* @return The favicon, or NULL if no favicon will be displayed.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getFavicon() {
|
public WrappedServerPing.CompressedImage getFavicon() {
|
||||||
return (String) FAVICON.get(handle);
|
|
||||||
|
String favicon = (String) FAVICON.get(handle);
|
||||||
|
return (favicon != null) ? WrappedServerPing.CompressedImage.fromEncodedText(favicon) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,8 +166,8 @@ public final class LegacyServerPing extends AbstractWrapper implements ServerPin
|
||||||
* @param image - the new compressed image or NULL if no favicon should be displayed.
|
* @param image - the new compressed image or NULL if no favicon should be displayed.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setFavicon(String image) {
|
public void setFavicon(WrappedServerPing.CompressedImage image) {
|
||||||
FAVICON.set(handle, image);
|
FAVICON.set(handle, (image != null) ? image.toEncodedText() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.comphenix.protocol.wrappers.ping;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
|
import com.comphenix.protocol.wrappers.WrappedServerPing;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
public interface ServerPingImpl extends Cloneable {
|
public interface ServerPingImpl extends Cloneable {
|
||||||
|
@ -17,8 +18,8 @@ public interface ServerPingImpl extends Cloneable {
|
||||||
void setVersionName(String versionName);
|
void setVersionName(String versionName);
|
||||||
int getVersionProtocol();
|
int getVersionProtocol();
|
||||||
void setVersionProtocol(int protocolVersion);
|
void setVersionProtocol(int protocolVersion);
|
||||||
String getFavicon();
|
WrappedServerPing.CompressedImage getFavicon();
|
||||||
void setFavicon(String favicon);
|
void setFavicon(WrappedServerPing.CompressedImage favicon);
|
||||||
boolean isEnforceSecureChat();
|
boolean isEnforceSecureChat();
|
||||||
void setEnforceSecureChat(boolean safeChat);
|
void setEnforceSecureChat(boolean safeChat);
|
||||||
|
|
||||||
|
|
|
@ -273,13 +273,13 @@ public final class ServerPingRecord implements ServerPingImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFavicon() {
|
public WrappedServerPing.CompressedImage getFavicon() {
|
||||||
return new String(favicon.iconBytes, StandardCharsets.UTF_8);
|
return new WrappedServerPing.CompressedImage("data:image/png;base64", favicon.iconBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFavicon(String favicon) {
|
public void setFavicon(WrappedServerPing.CompressedImage favicon) {
|
||||||
this.favicon.iconBytes = favicon.getBytes(StandardCharsets.UTF_8);
|
this.favicon.iconBytes = favicon.getDataCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue