Package com.velocitypowered.api.util
Class Favicon
- java.lang.Object
-
- com.velocitypowered.api.util.Favicon
-
public final class Favicon extends java.lang.Object
Represents a Minecraft server favicon. A Minecraft server favicon is a 64x64 image that can be displayed to a remote client that sends a Server List Ping packet, and is automatically displayed in the Minecraft client.
-
-
Constructor Summary
Constructors Constructor Description Favicon(java.lang.String base64Url)
Directly create a favicon using its Base64 URL directly.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Favicon
create(byte[] buffer)
Creates a newFavicon
from the specifiedbuffer
.static Favicon
create(java.nio.file.Path path)
Creates a newFavicon
by reading the image from the specifiedpath
.boolean
equals(@Nullable java.lang.Object o)
java.lang.String
getBase64Url()
Returns the Base64-encoded URI for this image.int
hashCode()
java.lang.String
toString()
-
-
-
Method Detail
-
getBase64Url
public java.lang.String getBase64Url()
Returns the Base64-encoded URI for this image.- Returns:
- a URL representing this favicon
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
create
public static Favicon create(byte[] buffer) throws java.io.IOException
Creates a newFavicon
from the specifiedbuffer
.- Parameters:
buffer
- the buffer to use for the favicon- Returns:
- the created
Favicon
instance - Throws:
java.io.IOException
- if the file could not be read from the path
-
create
public static Favicon create(java.nio.file.Path path) throws java.io.IOException
Creates a newFavicon
by reading the image from the specifiedpath
.- Parameters:
path
- the path to the image to create a favicon for- Returns:
- the created
Favicon
instance - Throws:
java.io.IOException
- if the file could not be read from the path
-
-