Anvil
Anvil.Services.PlayerNameOverrideService Class Reference

Public Member Functions

 PlayerNameOverrideService (HookService hookService)
 
void ClearPlayerNameOverride (NwPlayer target, bool clearAll=false)
 Clears an overridden player character name. More...
 
void ClearPlayerNameOverride (NwPlayer target, NwPlayer observer)
 Clears an overridden player character name for a specific observer. More...
 
Dictionary< NwPlayer, PlayerNameOverrideGetOverridesForObserver (NwPlayer observer, bool includeGlobal=false)
 Gets a list of all name overrides for the specified observer. More...
 
PlayerNameOverrideGetPlayerNameOverride (NwPlayer? target, NwPlayer? observer=null)
 Gets the current name override for the specified player. More...
 
void SetPlayerNameOverride (NwPlayer target, PlayerNameOverride nameOverride)
 Sets an override player character name and community name on the player list for all players. Is not persistent. More...
 
void SetPlayerNameOverride (NwPlayer target, PlayerNameOverride nameOverride, NwPlayer observer)
 Sets an override player character name and community name on the player list as observed by a specific player. Is not persistent. More...
 

Properties

bool OverwriteDisplayName = false [get, set]
 Gets or sets if global overrides change the underlying display name value. This applies the name change globally to scripts, and DMs.
When set to false, the override name is only visible to players - scripts and DMs see the original names unless ShowOverridesToDM is set to true. More...
 
OverrideNameType PlayerListNameType = OverrideNameType.Player [get, set]
 Gets or sets the type of name override to use from the in-game player list. More...
 
bool ShowOverridesToDM = false [get, set]
 DM observers will see global or personal overrides as well as being able to have their own name overridden for other observers. More...
 

Member Function Documentation

◆ ClearPlayerNameOverride() [1/2]

void Anvil.Services.PlayerNameOverrideService.ClearPlayerNameOverride ( NwPlayer  target,
bool  clearAll = false 
)
inline

Clears an overridden player character name.

Parameters
targetThe player whose name should be reset to default.
clearAllIf true, both global and any personal overrides will be cleared for that target player.

◆ ClearPlayerNameOverride() [2/2]

void Anvil.Services.PlayerNameOverrideService.ClearPlayerNameOverride ( NwPlayer  target,
NwPlayer  observer 
)
inline

Clears an overridden player character name for a specific observer.

Parameters
targetThe player whose overridden name to clear, use null if you're clearing all overrides for an observer.
observerThe observer whose overriden name of target is being cleared.

◆ GetOverridesForObserver()

Dictionary<NwPlayer, PlayerNameOverride> Anvil.Services.PlayerNameOverrideService.GetOverridesForObserver ( NwPlayer  observer,
bool  includeGlobal = false 
)
inline

Gets a list of all name overrides for the specified observer.

Parameters
observerThe observer to query.
includeGlobalTrue if global overrides should be included in the returned map.
Returns
A dictionary containing the name overrides for the specified observer.

◆ GetPlayerNameOverride()

PlayerNameOverride? Anvil.Services.PlayerNameOverrideService.GetPlayerNameOverride ( NwPlayer target,
NwPlayer observer = null 
)
inline

Gets the current name override for the specified player.

Parameters
targetThe player whose name to query.
observerThe specific observer.

◆ SetPlayerNameOverride() [1/2]

void Anvil.Services.PlayerNameOverrideService.SetPlayerNameOverride ( NwPlayer  target,
PlayerNameOverride  nameOverride 
)
inline

Sets an override player character name and community name on the player list for all players. Is not persistent.

Parameters
targetThe player whose name is being overridden.
nameOverrideThe new names for the player.

◆ SetPlayerNameOverride() [2/2]

void Anvil.Services.PlayerNameOverrideService.SetPlayerNameOverride ( NwPlayer  target,
PlayerNameOverride  nameOverride,
NwPlayer  observer 
)
inline

Sets an override player character name and community name on the player list as observed by a specific player. Is not persistent.

Parameters
targetThe player whose name is being overridden.
nameOverrideThe new names for the player.
observerThe observer to see the new names.

Property Documentation

◆ OverwriteDisplayName

bool Anvil.Services.PlayerNameOverrideService.OverwriteDisplayName = false
getset

Gets or sets if global overrides change the underlying display name value. This applies the name change globally to scripts, and DMs.
When set to false, the override name is only visible to players - scripts and DMs see the original names unless ShowOverridesToDM is set to true.

◆ PlayerListNameType

OverrideNameType Anvil.Services.PlayerNameOverrideService.PlayerListNameType = OverrideNameType.Player
getset

Gets or sets the type of name override to use from the in-game player list.

◆ ShowOverridesToDM

bool Anvil.Services.PlayerNameOverrideService.ShowOverridesToDM = false
getset

DM observers will see global or personal overrides as well as being able to have their own name overridden for other observers.


The documentation for this class was generated from the following file: