Description
This API provides you various functionalities from the plugin CustomFont
Features
- Create new custom fonts
- Translate text
- Listen to and intercept events
- When a player sends a message
- When a custom font is being set/reset/unset
- Manage user data (set/reset/unset)
- Remove player data (bulk removal)
- Retrieve configuration values
- Read and write cache values
Installation
Download latest release from here
Download the latest commons lib from here
Gradle Kotlin
compileOnly(fileTree("PATH_TO_API"))
compileOnly(fileTree("PATH_TO_LIB"))
Maven
<dependency>
<groupId>me.aeon</groupId>
<artifactId>customfont-plugin-api</artifactId>
<version>1.0.1</version>
<scope>system</scope>
<systemPath>PATH_TO_JAR</systemPath>
</dependency>
<dependency>
<groupId>me.aeon</groupId>
<artifactId>aeons-commons-lib</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>PATH_TO_JAR</systemPath>
</dependency>
Here's how you can translate "hello" to "ʜᴇʟʟᴏ" with the "mini" font
val customFontAPI = CustomFontAPI.INSTANCE
val fontManager = customFontAPI.fontManager
val miniFont = fontManager.fromId("mini")
val translated = TextTranslator.translate("hello", miniFont)
Here's how you can create a new CustomFont
val font = CustomFont.Builder()
.id("mini")
.permission("customfont.font.mini")
.characters(CharacterType.LOWERCASE, "ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘꞯʀꜱᴛᴜᴠᴡxʏᴢ")
.characters(CharacterType.UPPERCASE, "ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘꞯʀꜱᴛᴜᴠᴡxʏᴢ")
.build()
You can intercept events by listening to them and modifying as needed. Here's an example where a player cannot reset their font because they lack permissions
class CustomFontResetListener : Listener {
void onCustomFontReset(e: CustomFontResetEvent) {
if (!e.player.hasPermission("customfont.reset")) {
e.isCancelled = true
}
}
}