Skip to content
netprogs edited this page May 30, 2012 · 3 revisions

Home | Commands | Permissions | Configuration | Perks | Back to Bukkit

Configuration Files

The configuration file for Social Network are in JSON format.

After you reload or restart your server, you will be provided with the following files:

/plugins/SocialNetwork/config.json - The main configuration file

/plugins/SocialNetwork/resources.json - This is where you define your localization values

/plugins/SocialNetwork/network.json - This is an internal file. Do not edit.

You will also see a directory called "/plugins/SocialNetwork/DataFiles". This is where the details for each player is stored. If you're having problems with a particular player, you can look into their data here (and send to me !)

Some helpful links:

GSON - Bukkit's built-in JSON parsing library.

JSONLint - Tool for validating your JSON files.


## Configuration Details

I've taken the configuration file apart and broken it into pieces for the purpose of this document. At the end I'll provide you with some typically used configuration examples for review.

Index

  1. Main Settings
  2. Group Settings
  1. Perk Settings

Main Settings

These are the main settings

{
  "genderChoiceRequired": true,
  "sameGenderMarriageAllowed": true,
  "globalAnnouncePriestMarriages": true,
  "loggingDebug": false
}
genderChoiceRequired If you want people to have to choose a gender upon joining, set this to true.
sameGenderMarriageAllowed If you want to allow same gender Marriages, set to true. This only works if the above is true also.
globalAnnouncePriestMarriages If you want global announcements to go out when a priest Marries someonw, set to true.
loggingDebug Use this to create more details logs. Turn off by default though, it'll get busy otherwise.

Back to Top


Group Settings

Each group has it's own settings. See below for details on each one.

Friend Settings

"friendSettings": {
  "maximumFriends": 30,
  "priority": "LOWEST",
  "perUseCost": 0.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
maximumFriends The maximum number of players you're allowed to have in the group.
priority The priority level this group should have.
perUseCost The price to charge a player each time they add someone to this group.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Child Settings

"childSettings": {
  "maximumChildren": 30,
  "priority": "LOWEST",
  "perUseCost": 0.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
maximumChildren The maximum number of players you're allowed to have in the group.
priority The priority level this group should have.
perUseCost The price to charge a player each time they add someone to this group.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Relationship Settings

"relationshipSettings": {
  "maximumRelationships": 30,
  "priority": "LOWEST",
  "perUseCost": 0.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
maximumRelationships The maximum number of players you're allowed to have in the group.
priority The priority level this group should have.
perUseCost The price to charge a player each time they add someone to this group.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Affair Settings

"affairSettings": {
  "maximumAffairs": 30,
  "priority": "LOWEST",
  "perUseCost": 0.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
maximumAffairs The maximum number of players you're allowed to have in the group.
priority The priority level this group should have.
perUseCost The price to charge a player each time they add someone to this group.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Engagement Settings

"engagementSettings": {
  "engagementPeriod": 300,
  "priority": "LOWEST",
  "perUseCost": 50.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
engagementPeriod The period of time (in seconds) that needs to pass before an engagement can be turned into a Marriage.
priority The priority level this group should have.
perUseCost The price to charge a player each time they add someone to this group.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Marriage Settings

"marriageSettings": {
  "honeymoonPeriod": 300,
  "priority": "LOWEST",
  "perUseCost": 0.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
honeymoonPeriod The period of time (in seconds) that needs to pass before a Marriage can be turned into a divorce.
priority The priority level this group should have.
perUseCost The price charged to each player involved in the Marriage.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Priest Settings

"priestSettings": {
  "honeymoonPeriod": 0,
  "priority": "LOWEST",
  "perUseCost": 500.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
honeymoonPeriod The period of time (in seconds) that needs to pass before a Marriage can be turned into a divorce.
priority The priority level this group should have.
perUseCost The price charged to each player involved in the Marriage.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Divorce Settings

"divorceSettings": {
  "bitternessPeriod": 300,
  "priority": "LOWEST",
  "perUseCost": 50.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
}
bitternessPeriod The period of time (in seconds) that needs to pass before a player gets over their divorce and want to be in a relationship or engagement again.
priority The priority level this group should have.
perUseCost The price charged to each player involved in the divorce.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Lawyer Settings

"lawyerSettings": {
  "bitternessPeriod": 0,
  "priority": "LOWEST",
  "perUseCost": 500.0,
  "perks": [
    "gift", "tell", "sticky", "teleport", "damage"
  ],
  "permissionsGroup": "permissionGroupName"
},
bitternessPeriod The period of time (in seconds) that needs to pass before a player gets over their divorce and want to be in a relationship or engagement again.
priority The priority level this group should have.
perUseCost The price charged to each player involved in the divorce.
perks The list of perks, by name, that members of this group are allowed access to.
permissionsGroup (Optional) If wanted, when a user is given this social group, they can also be given a permissions group. This name must match the name used in the permissions configuration file. This is an add/remove for the given group only. It will not change any existing other group assignments.

See Perk Settings for details about the perks and priority mentioned above.

Back to Top


Perk Settings

Each social group is also given what we call "perks". Each of these perks can be assigned in any particular manner to each group as you see fit. Below we're going to show you how a perk itself is configured, and then how to map it back to a social group.

Configure a Perk

"perkSettings": [
	{
		"type": "com.netprogs.minecraft.plugins.social.config.settings.perk.GiftSettings",
		"data": {
			"name": "gift",
			"coolDownPeriod": 0,
			"perUseCost": 0.0
		}
	}
]
type In the near future, we're going to be allowing people to create their own custom perks and use our system to load them. Because of that we need to tell our system where to find those classes. The type defines the classpath to the perk we want to load.
name The name of the perk as used above in the social group perks list. This value and the one used in the group settings must match. This can be changed to anything you want, just make note of it so you can use it during group configuration.
coolDownPeriod The amount of time (in seconds) that must pass before a Perk can used again. Depending on the perk, this cool down might be used slightly differently. Check the documentation for each Perk.
costPerUse The cost to charge the player each time they use this perk. (Does not apply to listener base perks)

From there, each perk will define their own settings individually. See Perks for details on each one that is currently available.

Back to Top


Mapping Perks to Groups

This section is for those who want to create a very specific set of rules for their Perks. The default rules will probably suffice for most users.

Perk commands and listeners do not know which group they are being run for since these commands and listeners are not being run within a group scope. Because of that, we need to be able to determine which group settings to apply to the execution. There is a series of rules that we follow to determine if the Perk can be executed and which group settings should be used during the execution.

Priority

Each social group in the configuration file have a field named "priority". The values highest to lowest are:

  • HIGHEST
  • HIGH
  • HIGH_NORMAL
  • NORMAL
  • LOW_NORMAL
  • LOW
  • LOWEST

A priority is used when a player belongs to multiple social groups and you want to make sure certain social groups get checked first for special settings etc.

For example, if you wanted to give people who have affairs a higher cost to teleport the people they're in an affair with, you would set the social group priority to something higher than the others and give it a perk configuration with a higher cost.

Then, when someone tries to teleport a person who they're in an affair with (regardless if they're also friends or otherwise), they will be charged the higher rate because they'll be found in the affair settings first and never get to checking the friend settings.

Perk "name"

The name of the Perk (from it's configuration above) is used to determine which social groups are allowed to use it. See below for more details.

Perk execution rules

The general idea:

  • A Perk gets executed.
  • We determine the player running it.
  • We determine the player the Perk is being used with.
  • We determine which social groups both players belong to.
  • We determine which of those social groups contain the Perk names as defined in the perkSettings above.
  • Based on the priority levels, we then return the group settings to be used during the execution (or return an error if no matches are found).

It should also be noted, that if the perk is designed to not have a second person involved, the system will return the first settings found that contains other players. If you want to be able to partially control this, you can set a priority to the group settings to have it checked first for these cases.

For those types of Perks, it is generally recommended to only have one Perk setting setup for it so you don't have to deal with this issue.

An example

"friendSettings": {
  "maximumFriends": 3,
  "priority": "HIGH_NORMAL",
  "perUseCost": 20.0,
  "perks": [
    "teleportB", "damageA"
  ]
},
"relationshipSettings": {
  "maximumRelationships": 3,
  "priority": "LOW",
  "perUseCost": 30.0,
  "perks": [
    "teleportB", "damageB"
  ]
},

Assuming:

  • Player's name is PlayerX.
  • PlayerX is friends with PersonA.
  • PlayerX also in a relationship with PersonB.

Rules executed:

PlayerX tries to teleport PersonA to them:

  1. The system determines that friendSettings will be the first to check based on the priority level.
  2. The system obtains the Perk name teleportB from the perks list above. (based on the name from the Perk config further up).
  3. The system then checks to see if PersonA belongs to any social groups of PlayerX that also have this Perk name. In this case, we find that they are friends.
  4. The match is found, so we return friendSettings as the settings to use and allow the Perk to execute.

PlayerX tries to teleport PersonB:

  1. The system determines that friendSettings will be the first to check based on the priority level.
  2. The system obtains the Perk name from the group settings perks list above. (based on the name from the Perk config further up).
  3. The system then uses the name of the Perk obtained from the group settings and checks to see if PersonB belongs to any social groups of PlayerX that also have this Perk name.
  4. If a match is found, we return the current group settings and allow the Perk to execute.
  5. If a match is not found, we then move onto the next group settings in the priority list and repeat steps 2-5.

If by the time we've gone through every group that PlayerX belongs to and we will have not found PersonB, we return an error and do not allow the Perk to be executed.

In the case above, we eventually find that relationshipSettings contains both the Perk name teleportB and the player PersonB and allow the Perk to be executed.

Final notes

If you're having problems working out the details on your settings, turn on the loggingDebug in the same configuration file and you should see quite a bit of additional information produced when trying to use the Perks.

If you're really stuck, try gathering some log information and the configuration file your using, then send it to me. I might be able to help out.

Back to Top


Example Configurations

Below are two example configurations that I think will best prepresent the options you have available to you.


Shared Perks Example

This example creates only one setting configuration per available Perk. It then assigns each perk setting to all the social groups. This creates the effect of allowing all players to have access to all the perks regardless of their social group. Also, all players end up with the same settings regardless of their group because we only have one of them defined per Perk.

This configuration that gets provided to you by default when the plug-in is first deployed.


Non-Shared Perks Example

This example creates separate settings for each social group so that each one can have their own settings provided to the user when they are in that group.

I've only implemented it for the Teleport Perk, however you should be able to replicate the effect onto any other group settings you like from there.


Friends Priority Example

This example makes teleporting friends a much cheaper and quicker Perk. When the player tries to teleport anyone in their friends group (regardless of whatever else group they're in), the player will be given these settings they will get the cheaper/faster rates.

What we change:

  • Set the priority of the friends group set to the highest level forcing it to be chosen first during the rules check.
  • Create a custom Perk setting for teleport and assign it to the friendSettings.perks list.

Friends Priority Relationships Bonus Example

This example also makes teleporting friends a much cheaper and faster Perk. This time however, we also want to allow people in a relationship with the player to be teleported using the same cheaper/faster rate.

What we change:

  • Give the relationship settings the same Perk name as the Friends settings allowing them to connect.
  • Give relationships a higher priority to ensure that it gets picked first above others.

Back to Top