Skip to content

Placeholder API Wrapper

MattMX edited this page Jul 7, 2024 · 2 revisions

Note

This feature requires the installation of PlaceholderAPI.

Custom placeholders

You can create custom placeholders with absolute ease by using arguments from the declarative command DSL to depict the structure of your placeholders.

val a by doubleArgument()
val op by multiChoiceArgument<(Double, Double) -> Double>(
    "+" to { a, b -> a + b }, 
    "-" to { a, b -> a - b }, 
    "/" to { a, b -> a / b }, 
    "*" to { a, b -> a * b }, 
)
val b by doubleArgument()

placeholderExpansion {
    placeholder("math" / a / op / b) {
        op()(a(), b())
    }
} author "Me"

This example can then be used like %ktgui_math_1_+_2% resulting in 3.

Important

This feature is new and will not natively support all argument types. It is your responsiblity to allow for PlaceholderAPI support in custom argument types.

Included placeholders

KtGUI comes with some build-in ones to help keep branding on your server consistent /plugins/KtGUI/config.yml

branding:
  name: "sᴇʀᴠᴇʀ ɴᴀᴍᴇ"
  title: '&#B34262'
  highlight: '&#AE76A6'
  off-white: '&#A3C3D9'
  dull: '&#CCD6EB'
  primary: '&#E9ECF5'

Tip

Add any entries you want here as long as they are a string!

You can use these placeholders in-game with %ktgui_branding_<entry>% like %ktgui_branding_name%.

Out of the box we also have utilities for using the sᴍᴀʟʟ ᴄᴀᴘs ғᴏɴᴛ by using the font placeholder:

  • %ktgui_font_smalltext_hello world% = ʜᴇʟʟᴏ ᴡᴏʀʟᴅ
  • %ktgui_font_balls_balls% = ⓑⓐⓛⓛⓢ
Clone this wiki locally