Customization
News feed
You can use News to get the news from your EML AdminTool website and display them in your launcher.
Warning
Bootstraps requires an EML AdminTool website to work.
import { News } from 'eml-lib'
news()
async function news() {
const news = new News('https://at.emlproject.com')
try {
const newsList = await news.getNews()
} catch (err) {
console.error(err)
}
} News constructor
| Parameter | Type | Description | Required? |
|---|---|---|---|
url | string | The URL of your EML AdminTool website. | Yes |
News.getNews() method
Get all the news from the EML AdminTool.
Returns: Promise<INews[]> - The news.
Throws: FETCH_ERROR - If the request to the EML AdminTool website fails.
News.getCategories() method
Get all the News categories from the EML AdminTool.
Returns: Promise<INewsCategory[]> - The news categories.
Throws: FETCH_ERROR - If the request to the EML AdminTool website fails.
News.getNewsByCategory() method
News.getNewsByCategory()Warning
This method is currently deprecated, and returns an empty array.
The EML AdminTool API does not support News.getNewsByCategory() anymore, but may be used in the future. Please use News.getNews().filter(...) instead.
Background customization
You can use Background to get the background from your EML AdminTool website and display it in your launcher.
Warning
Background requires an EML AdminTool website to work.
import { Background } from 'eml-lib'
background()
async function background() {
const background = new Background('https://at.emlproject.com')
try {
const currentBackground = await background.getBackground()
} catch (err) {
console.error(err)
}
} Background constructor
| Parameter | Type | Description | Required? |
|---|---|---|---|
url | string | The URL of your EML AdminTool website. | Yes |
Background.getBackground() method
Get the current Background from the EML AdminTool.
Returns: Promise<null> - No background (you should include in your launcher a default background) • Promise<IBackground> - The background information if a background is set.
Throws: FETCH_ERROR - If the request to the EML AdminTool website fails.
Server status
You can use Server Status to get the Minecraft server status and display it in your launcher.
import { ServerStatus } from 'eml-lib'
async function serverStatus() {
const serverStatus = new ServerStatus('play.eml.com', 25565)
try {
const status = await serverStatus.getStatus()
} catch (err) {
console.error(err)
}
} ServerStatus constructor
| Parameter | Type | Description | Required? |
|---|---|---|---|
ip | string | The Minecraft server IP. | Yes |
port | number | The Minecraft server port. | No (defaults to 25565) |
protocol | 'modern' \| '1.6' \| '1.4-1.5' \| 'beta1.8-1.3' | The Minecraft protocol (e.g. 'modern' for 13w41a/1.7 and above, '1.6' for from 13w16a/1.6 to 13w39b/1.6.4, and '1.4-1.5' for from 12w32a/1.4 to 1.5.2). | No (defaults to 'modern') |
pvn | number | The Minecraft protocol version (e.g. 754 for 1.16.4). This parameter is optional, but it is recommended to use it for better compatibility. You can find the protocol version of your Minecraft version here. | No (defaults to -1) |
timeout | number | The timeout in seconds. | No (defaults to 5) |
ServerStatus.getStatus() method
Get the status of the Minecraft server.
Returns: Promise<IServerStatus> - The Minecraft server status information.
Throws: NET_ERROR - If the request to the Minecraft server fails.