Player characteristics

This (server-side) mod's would **store and retrieve additional players (and sometimes server) characteristics**.

Its purpose would be to **serve as a communication system between other mods, plugins and scripts** needing these information.

It could be used:

* through **server commands** (for example: /set Player Faction=Angmar)
* by other mods through a **Java API** (for example: Characteristics.set(player, key, values) or Characteristics.get(player, key))
* directly through its **storage files** (but with less possibilities in that case)

It would be intended for "stable" characteristics (ie. name, race, gender, faction) rather than "live" ones (such as mana, thirst level, etc.).

### Storage

In order to achieve the last part, everything should be stored in plain (uncompressed) files, that should be read before each use, and written & closed at each modification. Alternatively, I would prefer to keep this in memory with a load when a player logins and a save when he logouts, and then use some sync/reload commands that could be called by scripts, before using or editing values.

The storage files would be located under config/characteristics/players/ in files referenced with the player UUID (UUID.txt).

The characteristics would be in the form Key=Value1 [Value2 ... ValueN].

It would be possible to provide possible values through additional files located under config/characteristics/ (Key.txt).

The mod would be distributed with some "template" characteristics, but their use wouldn't be mandatory, and any new one could be added.

### Other commands

To keep it simple, we wouldn't provide commands to manipulate the possible values lists or any other "background" information. System owners would be able to define them through any text editor.

But it would be possible to **delete a characteristic** from a player file by setting it to an empty value (for example: /set Player Faction=), and to **delete all characteristics** for a player by using a "/reset Player" command.

### Player commands?

Player commands should probably be defined through submods (= mods linked to this one).

However, player commands for "template" characteristics could be directly defined by this mod. For example: "/setName Player Name" or "/setGender Player Gender" (with some server characteristic stating the minimum time interval between changes).

### Triggers & nested commands

To add some interest to this mod, when setting a value to a key, if a file named "Key=Value" exists, each of its lines would be treated as a Minecraft command to execute in operator mode. Lines beginning with a "@" character would be treated as nested Minecraft commands files to execute.

In the previous examples, it would be interesting for things like "/setFaction Player Faction" (again with some server characteristic stating the minimum time interval between changes).

## Examples

### Template characteristics

* Name - not the Minecraft player name but more something like Bukkit Essentials' nickname - (string)
* Race (list: Man, Dunedain, Numenorean, Elf, Dwarf, Uruk, Orc, Goblin, Troll, Half-Troll, Ent, Huorn, Hobbit, Beorning, etc.)
* RaceLastChange (date)
* Gender (list: Male, Female, Neutral, Other)
* GenderLastChange (date)
* Faction (some list)
* FactionParent - for example "Gondor" while Faction would state "Dol Amroth" (some list)
* FactionLastChange (date)
* FactionLeader (boolean)
* Title (some list with Faction+Gender dependent values)

Obviously, a Chat submod taking this characteristics into account would be quickly needed...

### Other possible characteristics

* Lord (string)
* Vassals (strings)
	+ For a nobility systems such as the one used in the "It's a hARDA world" server
* BirthPlace - aka Spawn place - (dim:x:y:z)
* LastHome - aka last bed - (dim:x:y:z)
	+ Only if this is useful for something...

### Nested commands examples

You click on a server sign associated with the following commands:

* /set Faction=Dorwinion
* /set Race=Elf

In the file "Faction=Dorwinion" we could find:

```
@ResetPlayer
/pex user <name> group set Dorwinion
/alignment set DORWINION 10
/alignment set WOOD_ELF 1
/alignment set ANGMAR -1
/alignment set DOL_GULDUR -1
/alignment set GUNDABAD -1
/alignment set HALF_TROLL -1
/alignment set MORDOR -1
/alignment set URUK_HAI -1
@EquipmentForDorwinionElf
/geotp <name> harda2-factions:Dorwinion AboveGround
/spawnpoint

```

(Unusual commands are from PermissionsEx plugin (/pex), RndTp mod (/geotp))

In the file "ResetPlayer" we could find:

```
/xp set <name> 0
/xp set <name> 0 levels
/alignment set ALL 0
/lotrAchievement remove all
/lotrWaypoints lock all
/set Race=
/set RaceLastChange=<date>
/set FactionParent=
/set FactionLastChange=<date>
/set FactionLeader=
/set Title=

```

In the file "EquipmentForDorwinionElf" we could find:

```
/give <name> lotr:item.swordDorwinionElf 1
/give <name> lotr:item.helmetDorwinionElf 1
/give <name> lotr:item.bodyDorwinionElf 1
/give <name> lotr:item.legsDorwinionElf 1
/give <name> lotr:item.bootsDorwinionElf 1
/give <name> lotr:item.redbook 1
/give <name> lotr:item.pouch 1
/give <name> bread 32

```

In the file "Race=Elf" we could find:

```
/e <name> clear -1
/e <name> speed 1 -1
/e <name> jump 1 -1

```

(Unusual commands are from Permanent Effects plugin (/e))

Some texts like <name> or <date> would be replaced in the commands.