Skip to content

Instantly share code, notes, and snippets.

@SOF3
Last active February 25, 2017 13:45
Show Gist options
  • Save SOF3/9fdd9a1cda94a4337afd425b6f98cdfc to your computer and use it in GitHub Desktop.
Save SOF3/9fdd9a1cda94a4337afd425b6f98cdfc to your computer and use it in GitHub Desktop.

OrgManager

This document explains the mechanism in OrgManager.

This plugin aims to provide an API that generalizes the organization mechanism in organization-based plugins, such as plugins for factions, plugins for teams, plugins for chat channels, etc.

Various organization types

There can be many types of organizations, as defined by plugins. While all types of organizations have the same basic mechanism, the following are same within each type but could be different between different types:

  • Type ID: Each type is identified by a type ID constant. This should be prefixed by the identifier of the plugin that declares it, e.g. orgmanager.simpleteam. The type ID must match the regex /^[a-z0-9\-](\.[a-z0-9\-])+$/.
  • Type command: Each type will have a different command. The commands basically have the same syntax, but may have different aliases or shorthands.
  • Member type: Each type has its own implementation of OrgMember, so OrgMembers can be something other than players. For example, you can make a type of organization called "alliances", where as each alliance member is actually a team of players (so players form a team, and teams for an alliance)
    • Executing commands as OrgMember: In OrgManager, the term "OrgMember" only refers to something that can become a member of a certain type of organization, whether he/she/it is already in an organization. Therefore, all command senders issue the standard organization command as an OrgMember. The organization implementation should resolve a command sender as an OrgMember.
  • Multiple organizations: Each organization type could define whether an OrgMember can belong to multiple organizations or not.
  • Access IDs: The types of access (explained below) that each organization can configure.

Mechanism within an organization

Access management

Each organization has a special OrgMember called "God", usually the founder. He/She/It ("He") does not belong to any Ranks (as known by users). He has access to everything related to the organization.

Each organization has a set of ranks. Each rank consists of a access-set and a rank level. The access-set is a set of access IDs that members in the rank have access to. The rank level defines how significant the rank is. The rank level will be used by kick, demotion and promotion commands to decide whether the OrgMember has access to do so.

The default set of ranks shall be defined by the plugin (or by the configuration through the plugin) that defines the organization type. It should include a "Default rank" (the rank of a newly-joined member) and a "Guest rank" (the rank of a non-member, used for access checking).

Diplomacy

If the organization type does not allow joining multiple organizations, it might be useful to establish diplomatic relationship between organizations.

First, both organizations must define a rank used for diplomacy. Then, each organization's diplomat (an OrgMember with the access to manage diplomacy) will issue a command to establish diplomacy with another organization with the rank as the conditional offer. After that, both parties accept the conditional offer from each other and the diplomatic relationship is established. OrgMembers with the access to use diplomacy will enjoy the access offered by the rank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment