Skip to content
Micheal edited this page Oct 10, 2022 · 3 revisions

Introduction

Identity is a useful Minecraft plug-in for creating Identity with last name, first name, gender, and age. We will learn a few fundamentals in order to begin customizing our experience as much as possible.

How do the colors work?

To begin, let's look at how to use colours. They are entirely based on MiniMessage, so I recommend reading the MiniMessage wiki on how to use them. There is also included a link below that will allow you to test the different colour formats without having to reload the plug-in (here).

Inventory customization

Identity's inventories are all structured in a fully configurable and easy-to-understand manner.

Format

{SLOT}:
  action: {ACTION}
  material: {MATERIAL}
  custom-model-data: {CUSTOM_MODEL_DATA}
  texture: {HEAD_TEXTURE}
  name: {DISPLAYNAME}
  lore:
    - "lore line..."
    - "lore line..."
    - ...

The actions that occur when you click serve to interact with the setup, are predefined and can be utilized in inventories relating to them:

  1. ADD_AGE (+1 to the value of age)
  2. REMOVE_AGE (-1 to the value of age)
  3. CONFIRM_AGE (Confirms the selected age)
  4. ENTER_NAME (Starts the name setup process)
  5. FEMALE (Selects female gender)
  6. MALE (Selects male gender)
  7. NONBINARY (Selects nonbinary gender)
  8. NONE

If the material is CUSTOM_HEAD, then a texture value for a custom head is required. To get these, go to https://minecraft-heads.com/custom-heads and, once there, click on the head that you desire, scroll down to the "Minecraft URL" field and enter that value into the config.

Example

0:
  action: ADD_AGE
  material: "CUSTOM_HEAD"
  custom-model-data: 10030
  texture: "b056bc1244fcff99344f12aba42ac23fee6ef6e3351d27d273c1572531f"
  name: "<green><bold>Click to add <gray>(+1)"
  lore:
    - "<gray>Click to add a year"

How do Post-Commands and Gender-Commands work?

Post-commands and Gender-Commands are commands that are executed at the end of the setup process; gender commands are initiated based on the gender that was selected.

Post-Commands format

post-process:
  commands:
    {YOUR_COMMAND_NAME}:
      executor: {EXECUTOR} #PLAYER, CONSOLE
      command: "{YOUR_COMMAND}" #You can use the placeholders **{X} {Y} {Z}** for the player's coordinates and **{PLAYER}** for the player's name. 

(Settings.yml - Example)

post-process:
  commands:
    heal-command:
      executor: CONSOLE
      command: "/heal {PLAYER}"

Gender-Commands format

post-process:
  gender-commands:
    {GENDER_NAME}: #Gender name can be male, female & non-binary.
      executor: {EXECUTOR} #PLAYER, CONSOLE
      command: "{YOUR_COMMAND}" #You can use the placeholders **{X} {Y} {Z}** for the player's coordinates and **{PLAYER}** for the player's name. 

(Settings.yml - Example)

post-process:
  gender-commands:
    non-binary:
      executor: CONSOLE
      command: "/heal {PLAYER}" 

Per-Age-Item

A frequently asked question is how I set a specific item in the GUI for each age during setup. So here's an example, along with the format:

Format (Into settings.yml)

inventories:
  age:
    data:
      per-age-item:
        {AGE}:
          custom-model-data: {CUSTOM_MODEL_DATA}
          material: {MATERIAL}
          name: {DISPLAYNAME}
          lore:
            - "lore line..."
            - "lore line..."
            - ...

Example (From settings.yml)

inventories:
  age:
    data:
      per-age-item:
        25:
          custom-model-data: 10038
          material: PAPER
          name: "<green>Click to confirm (%actualage%)"
          lore:
            - "<gray>This is your age, click to confirm."

#API The ability to use an API is one of the most useful features of this plug-in. Add Identity.jar to your project as a library and you're ready to go.

Methods

     /**
     * If the player's data exists, return a new Person object with the player's name, gender, and age.
     *
     * @param uuid The UUID of the player you want to get the identity of.
     * @return A Person object.
     */

    public Person getUserIdentity(UUID uuid);

     /**
     * If the player's data exists, return a new Person object with the player's name, gender, and age.
     *
     * @param playerName The name of the player you want to get the identity of.
     * @return A Person object.
     */
  
    public Person getUserIdentity(String playerName); **(Deprecated)**

Example Usage

    @Override
    public void onEnable() {
           Identity identity = (Identity) Bukkit.getPluginManager().getPlugin("Identity");
           Person person = identity.getAPI().getUserIdentity("Drago903");
           System.out.println(
                    "Name: " + person.getName()
                    + " Gender: " + person.getGender()
                    + " Age: " + person.getAge());
        }
    }