Skip to main content

Profiles

Several character profiles per player, each with its own inventory, ender chest, XP and TypeWriter facts.

Privatev0.2.0RPG & progression
RequiresTypeWriter0.9.0-beta-177 (BTC build)Basic (TypeWriter extension)GUI (TypeWriter extension)MySQL (TypeWriter extension)optionalParty (TypeWriter extension)optional

Built for the BornToCraft network. This extension is documented for reference and is not distributed.

Overview​

Profiles gives each player several independent characters on the same account. Switching profile swaps the player's inventory, ender chest, experience, health and food, and also their TypeWriter facts, so quest progress, unlocks and counters are separate for each character. Other BTC extensions, such as BTC Sky, attach their own data to the active profile.

Profiles are created and chosen from a menu you design in the web panel. A server can force players to choose a profile before they can move, build, fight or chat. The data is stored in a database when the MySQL bridge is enabled, which makes profiles available on every server of a network, and in files otherwise.

The system is tied to the game mode of the server (mysql.game-mode.current): a player has a separate list of profiles in each game mode.

Features​

  • Separate characters — inventory, armor, off-hand, ender chest, level, experience, health, food and saturation per profile.
  • Separate story state — TypeWriter facts are saved on switch and restored for the profile.
  • Profile menu — a GUI with one slot per profile, templates for active, inactive, free and locked slots.
  • Forced selection — until a profile is active, the player cannot move, interact, break, place, drop, fight or chat.
  • Solo and coop — a profile is created as solo or coop (BTC Sky shared island), and a game mode without coop skips the question.
  • Limits — a default maximum and higher limits per permission.
  • Switch protection — a cooldown between switches and an event other extensions can cancel.
  • Entries — actions to open the menu, create, switch, rename, delete and save, facts about the profile state, and events.
  • Cross-server — profiles and their data are shared through the MySQL bridge.
  • Placeholders — name, id, count, limits and per-profile details for menus and HUDs.

Installation​

  1. Install the GUI extension, which draws the menu. The Basic extension is declared as a dependency.
  2. Recommended: install the MySQL extension and enable it (mysql.enabled: true). Without it, profiles are stored in files and are not shared between servers.
  3. Put the Profiles JAR in plugins/Typewriter/extensions/ and restart the server.
  4. Edit the profiles section of plugins/Typewriter/mysql/config.yml, see Configuration. Profiles reads its settings from the MySQL extension's configuration file even when you do not use a database.
  5. Create the menu entries described in Getting started.

Getting started​

Set up a profile selection that new players must complete:

  1. In the TypeWriter web panel, open a page and add a Profile Menu Config entry. /profile opens the first one found, and does nothing when none exists.
  2. Set inventoryTitle, inventoryRows and guiType. Build the layout in layoutPool and set mainLayoutId. See the GUI guides.
  3. Place items with buttonPrefix profile_button: and buttonType PROFILE_SLOT where profiles must appear. Each marker shows one profile, read left to right then top to bottom. Slots below the player's limit that hold no profile show createProfileTemplate, slots beyond the limit show maxProfilesTemplate.
  4. Set defaultMaxProfiles and, if needed, permissionLimits.
  5. Create the two GUI pages used for creation, as Open GUI entries with the ids profile_create_chooser (a Solo or Coop choice) and, for game modes without coop, profile_create_solo. A button on these pages runs profile create solo or profile create coop, and for solo-only modes profile create alone.
  6. In plugins/Typewriter/mysql/config.yml, check profiles.force-profile-selection (default true) and profiles.coop-supported.
  7. Publish, join the server, and pick or create a profile.

Use Switch Profile Action or Open Profile Menu Action from NPCs and items. React to switches made by the switch action or by typed commands with the Profile Switched Event.

Gate content on the profile

Use the Profile Count Fact and Is Profile Active Fact facts in criteria. For example, show a "create a profile" button only while Can Create Profile Fact is 1.

How it works​

On a switch, the extension checks the cooldown, then fires a cancellable pre-switch event so a game mode can refuse (for example during a war or a minigame). It then captures the player's current state, writes it to the repository, clears the player's TypeWriter facts and inventory, and restores the target profile's data. The state of the active profile is also saved when the player quits.

What is saved depends on the configuration: inventory and ender chest (save-inventory, save-ender-chest) and Minecraft statistics (save-statistics, off by default because of its size). Level, experience, health, food and TypeWriter facts are always saved.

Because facts are swapped, anything stored in a fact belongs to the profile. Data of other extensions follows their own profile-mode in the MySQL configuration: per-profile data is kept separately for each profile, shared data is common to all profiles.

Configuration​

Profiles has no configuration file of its own. Its settings are in the profiles section of plugins/Typewriter/mysql/config.yml, created by the MySQL extension.

KeyDefault in the shipped fileMeaning
profiles.enabledtrueTurns the profile system on.
profiles.max-profiles2Maximum profiles per player when no Profile Menu Config entry exists. The entry's defaultMaxProfiles replaces it.
profiles.default-profile-namePrincipalName of the automatic profile.
profiles.save-statisticstrueSave Minecraft statistics per profile. Uses a lot of storage.
profiles.save-inventorytrueSwap the inventory per profile.
profiles.save-ender-chesttrueSwap the ender chest per profile.
profiles.require-permissionfalseRequire typewriter.profiles.create to create a profile.
profiles.auto-create-defaulttrueCreate a default profile on first join. Only works when coop-supported is false.
profiles.force-profile-selectiontrueBlock the player until a profile is active.
profiles.switch-cooldown-seconds60Minimum delay between two switches of a player. 0 disables it.
profiles.coop-supportedtrueWhether this game mode has coop profiles. When false, the Solo or Coop question is skipped and every profile is solo.
profiles.creation-menu-entry-idemptyId of the GUI page opened to create a profile. Empty means profile_create_chooser when coop is supported and profile_create_solo otherwise.

The values above are those of the shipped file. The built-in fallbacks differ when a key is missing (max-profiles 5, save-statistics true, auto-create-default false), so keep the keys in your file.

Storage. With mysql.enabled: true and profiles.enabled: true, profiles are stored in the table typewriter_profiles. Otherwise they are stored as assets in profiles/<game mode>/<player uuid>.json. Profiles saved in the old Profile Storage Artifact artifact are copied to the new storage automatically at start.

The Profile Menu Config entry describes the menu. A click on a profile switches to it, Shift + left click deletes it (after a confirmation screen unless deleteConfirmation is off), and a click on a free slot opens the creation page. Creating a profile asks its name in an anvil. {profile_name}, {profile_id}, {created_date}, {last_used}, {level}, {exp}, {health}, {food}, {profile_count} and {max_profiles} can be used in titles, names and lore.

Button items with buttonPrefix profile_button: support PROFILE_SLOT (one profile), and the markers INFO and CLOSE, which run profile info and gui:close.

Slots can run profile open, profile select <id>, profile create solo|coop and profile delete <id>, as the clicking player.

Language

Default texts of the menu, messages and the cooldown message are in French. Change them in the menu entry.

Commands​

All commands need profiles.use. Aliases: /profil, /profiles.

CommandDescription
/profileOpen the profile menu.
/profile menuOpen the profile menu.
/profile select <id>Switch to a profile.
/profile create solo or coopCreate and activate a profile; the name is asked in an anvil. Without a mode, only for game modes without coop.
/profile delete <id> [confirm]Delete a profile that is not active. Opens the confirmation screen first when deleteConfirmation is on, unless confirm is given.
/profile admin list <player>List the profiles of an online player (requires profiles.admin).
/profile admin create <player> <name>Create a solo profile for a player.
/profile admin delete <player> <id>Delete a profile of a player.
/profile admin switch <player> <id>Switch a player to a profile.
/profile admin rename <player> <id> <name>Rename a profile.
/profile headless list, select <id>, create <name>Manage your own profiles without a menu (requires profiles.headless).
Command interception in game

A menu listener handles /profile typed by a player before the command tree: it supports select, create, delete and opening the menu, and ignores the others. /profile admin ... and /profile headless ... therefore work reliably from the console, or through the /profil and /profiles aliases.

Permissions​

PermissionDefaultGrants
profiles.useEveryoneThe /profile commands.
profiles.adminOperators/profile admin.
profiles.headlessNobody/profile headless, for clients without a screen such as test bots.
profiles.switch.bypasscooldownNobodySwitch with no cooldown.
typewriter.profiles.createNobodyCreate profiles when profiles.require-permission is true.
Permissions of permissionLimitsYou chooseRaise the profile limit. The highest limit wins.

Placeholders​

MiniPlaceholders tags for MiniMessage text. A reference is a position in the list (digits, from 0) or a profile id.

PlaceholderReturns
<profile_active_id>, <profile_active_name>Id and name of the active profile.
<profile_active>1 when a profile is active. With a reference, <profile_active:0> tells whether that profile is the active one.
<profile_count>Number of profiles.
<profile_max>Maximum number of profiles for the player.
<profile_can_create>1 when the player can create another profile.
<profile_remaining>Number of profiles still available.
<profile_friend_count>Number of friends, 0 without the Friend extension.
<profile_enabled>1 when the system is on.
<profile_name:ref>, <profile_id:ref>Name and id of a profile.
<profile_created:ref>, <profile_last_used:ref>Dates as dd/MM/yyyy HH:mm.
<profile_created_timestamp:ref>, <profile_last_used_timestamp:ref>Epoch milliseconds.
<profile_level:ref>, <profile_exp:ref>Level, and experience progress as a percentage.
<profile_health:ref>, <profile_food:ref>Saved health and food level.

Entries​

20 entries, generated from the extension source.

Actions6
Events5
Facts7
Artifacts1
Manifests1

Troubleshooting​

/profile does nothing. There is no Profile Menu Config entry. Create and publish one.

New players are frozen and cannot chat. profiles.force-profile-selection is true and no profile is active. The player is sent to the creation page after joining; make sure the GUI entry profile_create_chooser (or profile_create_solo, or your creation-menu-entry-id) exists. Set the option to false to disable the lock.

"Choisissez d'abord Solo ou Coop dans le menu des profils." The player tried a command while forced. Only /profile ... and the creation page command are allowed until a profile is active.

"Vous devez attendre N s avant de changer à nouveau de profil." The switch cooldown is running. Lower profiles.switch-cooldown-seconds or grant profiles.switch.bypasscooldown.

No default profile is created at first join. auto-create-default only works when coop-supported is false. With coop, a player must choose Solo or Coop, and the log says "No implicit profile was created; disable the setting."

Profiles differ between servers. The MySQL extension must be enabled (mysql.enabled: true) on every server with the same database and game mode. Without it, profiles are in local files. If MySQL is enabled but the data source is missing, the log says "MySQL enabled for profiles but DataSource not found. Falling back to JSON."

Players lose items after a switch. Check save-inventory and save-ender-chest. When they are false, the inventory is not swapped and is not cleared either, so items are shared between profiles.

A switch is refused with a message. Another extension cancelled it through the pre-switch event, for example during a fight or a minigame. The message comes from that extension.

  • MySQL — storage, game modes and the settings read by Profiles.
  • GUI — layouts and views of the profile menu.
  • BTC Sky — coop islands and island data attached to a profile.
  • Party and Friend — social features that follow the active profile.