You may recall, as discussed in the previous chapter, that only certain data types can be stored in a YAML file. These include primitive types, such as int
and boolean
, strings, lists, and types that implement ConfigurationSerializable
, such as ItemStack
.
For this reason, we can only save these specific types of data.
You may find yourself wanting to save other types of data such as a Player
object, or in the case of the teleportation plugin, a Location
object. These may not be stored directly, but they can usually be broken down in order to save the important values that are needed to load it later. As an example, you cannot save a Player
object, but you can save the players'
UUID (Universal Unique Identifier), which can be converted into a string. Each Player
has one UUID. Hence, it is the only information that we need to be able to refer to that specific player later.