Skip to main content
Version: 0.5.1

All api changes to 0.5.0

This document lists all the API changes introduced in version 0.5.0 of the TypeWriter plugin. If you are upgrading from an older version, please read this document before upgrading.

New type: Ref

To streamline the api more, I created a new type called Ref. It provides a much nicer api for referencing entries.

class ExampleEntry(
// ...
override val triggers: List<Ref<TriggerableEntry>> = emptyList(),
val identifier: Ref<OtherEntry> = emptyRef(),
// ...
) : TriggerableEntry

Getting entry:

val otherEntry = entry.identifier.get()

Change to facts interface

Since Facts can now be applied to groups of players, the read function no longer works. A simple migration is to use the readSinglePlayer function instead.

class InventoryItemCountFact(
override val id: String = "",
override val name: String = "",
override val comment: String = "",
override val group: Ref<GroupEntry> = emptyRef(),
@Help("The item to check for.")
val item: Item = Item.Empty,
) : ReadableFactEntry {
override fun readSinglePlayer(player: Player): FactData {
val amount = player.inventory.contents.filterNotNull().filter { item.isSameAs(player, it) }.sumOf { it.amount }
return FactData(amount)
}
}

Entry Icon Changes

The icon set has changed from only allowing Font Awesome icons, to allowing any icon from Iconify. This means that entries can use any icon from Iconify. Since the icon set is so big, there no longer is a nice Icon class. Instead, you just pass the icon name to the icon parameter.

@Entry("add_potion_effect", "Add a potion effect to the player", Colors.RED, "fa6-solid:flask-vial")