Documentation

MinecraftGroupSyncInjector
in package
implements GroupSyncInjector

Minecraft group sync injector implementation.

Tags
author

Aberdeener

version
2.0.0-pr13
license

MIT

Table of Contents

Interfaces

GroupSyncInjector
Provides a baseline for custom group sync injectors.

Methods

addGroup()  : bool
Add this group to the user on your service.
getColumnName()  : string
Get the name of the column to store this injector's group ID in, in the database.
getColumnType()  : string
Get the MySQL type to create the column with.
getModule()  : string
Get the name of the module this injector belongs to.
getName()  : string
Get a "friendly name" of this injector.
getNotEnabledMessage()  : string
Get the message to display in place of the group dropdown on the Group Sync page.
getSelectionOptions()  : array<string|int, mixed>
Get a list of groups available for this injector.
getValidationMessages()  : array<string|int, mixed>
Get specific error messages to display for each validation rule their form submission does not meet.
getValidationRules()  : array<string|int, mixed>
Get an array of rules to validate Group Sync creation/update requests with for this group.
removeGroup()  : bool
Remove this group from the user.
shouldEnable()  : bool
Determine if this injector should be enabled or not.

Methods

addGroup()

Add this group to the user on your service.

public addGroup(User $user, mixed $group_id) : bool

Can do anything in here (go for a walk, call your API, write a book, etc), as long as the user gets the group applied on your service!

Parameters
$user : User

Instance of affected NamelessMC user.

$group_id : mixed

Native group ID to use for lookup on your service.

Return values
bool —

Whether the group was successfully added or not

getColumnName()

Get the name of the column to store this injector's group ID in, in the database.

public getColumnName() : string
Return values
string —

Column name

getColumnType()

Get the MySQL type to create the column with.

public getColumnType() : string

Example: bigint, varchar(64)...

Return values
string —

Column type

getModule()

Get the name of the module this injector belongs to.

public getModule() : string
Return values
string —

Module name

getName()

Get a "friendly name" of this injector.

public getName() : string

Used on Group Sync page as the label for the dropdown.

Return values
string —

Friendly name

getNotEnabledMessage()

Get the message to display in place of the group dropdown on the Group Sync page.

public getNotEnabledMessage(Language $language) : string
Parameters
$language : Language

The logged in user's language to use for translations.

Return values
string —

Not enabled message

getSelectionOptions()

Get a list of groups available for this injector.

public getSelectionOptions() : array<string|int, mixed>

Returned array must be in the shape of:.

     [

         'id' => ID of the group used by your service to apply the group by.

         'name' => Name of group to display in the dropdown on the Group Sync page.

     ]
Return values
array<string|int, mixed>

getValidationMessages()

Get specific error messages to display for each validation rule their form submission does not meet.

public getValidationMessages(Language $language) : array<string|int, mixed>

Can return an empty array to use automatically generated messages.

Parameters
$language : Language

The logged-in user's language to use for translations.

Return values
array<string|int, mixed> —

Validation error messages

getValidationRules()

Get an array of rules to validate Group Sync creation/update requests with for this group.

public getValidationRules() : array<string|int, mixed>

Should not be an issue unless people edit the input values in Inspect Element before submitting, simply a safety measure.

Should be using the constants from the Validate class.

Return values
array<string|int, mixed> —

Validation rules

removeGroup()

Remove this group from the user.

public removeGroup(User $user, mixed $group_id) : bool
Parameters
$user : User

Instance of affected NamelessMC user.

$group_id : mixed

Native group ID to use for lookup on your service.

Return values
bool —

Whether the group was successfully removed or not

shouldEnable()

Determine if this injector should be enabled or not.

public shouldEnable() : bool

The GroupSyncManager will check if this injector's module is enabled or not.

Return values
bool —

Whether to enable this injector or not.


        
On this page

Search results