Skip to main content

PlayerCommandModule

A static class in TavernLib, TavernLib.ModulePorts.

TavernLib's player console module, a port of the game's player commands plus its own: kick, ban, list, teleport, stats, messages and the inventory and progression submodules.

Fields​

1 private and internal field
MemberWhat it is
private static Logger loggerNLog logger for the module.

Methods​

MemberWhat it is
static void Teleport(PlayerList players, SpawnAreaIdentifier target = 1)The player teleport overload that sends players to a spawn area (their respawn point by default). A player with no body makes it throw.
28 private and internal methods
MemberWhat it is
private static string Ban(string username, string reason = "Banned")player ban: server only, blacklists a name and its user id in users.json and kicks anyone playing under that name.
private static string BanList()player banlist: server only, shows the blacklisted names, user ids and IPs.
private static void ChangeUsers(Func<UserConfig, bool> change)Applies a change to users.json and turns a read or write failure into a command error.
private static void CheckStat(PlayerList players, PlayerUnlock unlock, bool isUnlocked = true)Three commands share this name: player set-unlock sets a permanent unlock, player unlock-check checks one, and player check-stat returns a stat's value.
private static bool CheckStat(Player player, PlayerUnlock unlock)Three commands share this name: player set-unlock sets a permanent unlock, player unlock-check checks one, and player check-stat returns a stat's value.
private static PlayerCommandModule.StatValue CheckStat(Player player, Stat stat)Three commands share this name: player set-unlock sets a permanent unlock, player unlock-check checks one, and player check-stat returns a stat's value.
private static int Count()player count: server only, returns the number of online players.
private static void CripplePlayer(PlayerList players)player cripple: server only, cripples players.
private static float GetDamageMultiplier_Command()player getdamagemulti: server only, returns PlayerDamageTakenMultiplier from the server settings.
private static Vector3 GetHome(Player player)player get-home: returns a player's respawn point.
private static UserInfo GetIdentifier(string username)player id: server only, finds a user id from a username in users.json.
private static UserInfo GetUsername(int userId)player username: server only, finds a username from a user id in users.json.
private static void GodMode(PlayerList players, bool isOn)player god-mode: sets whether players ignore damage.
private static void KickPlayer(PlayerList players, string reason = "No reason provided")player kick: server only, disconnects the players with a reason.
private static void KillPlayer(PlayerList players)player kill: server only, kills players, ignoring god mode and the damage multiplier.
private static IEnumerable<UserInfo> List()player list: server only, lists all online players.
private static IEnumerable<UserInfoDetailed> ListDetailed()player list-detailed and player detailed: server only, give detailed info on all players or on one player.
private static UserInfoDetailed ListDetailed(IPlayer player)player list-detailed and player detailed: server only, give detailed info on all players or on one player.
private static UserConfig.ListConfig Lists(UserConfig.ListConfig list)Fills in any missing name, id or IP lists on a blacklist or whitelist section and returns it.
private static IEnumerable<PlayerCommandModule.StatDefinitionInfo> ListStats(Player player)player list-stats: lists a player's stats, or the default stat definitions when the player has no body.
private static void Message(PlayerList players, string message, float duration = 10)player message: server only, sends a message to players for a number of seconds.
private static void ModifyStat(PlayerList players, StatDefinition statDefinition, float valueModifier, float duration, bool isMultiplier = false)player modify-stat: applies a timed modifier to a stat on players.
private static void SetDamageMultiplier_Command(float multiplier)player setdamagemulti: server only, sets PlayerDamageTakenMultiplier in the server settings.
private static void SetHome(PlayerList players, Vector3 home = null)player set-home: sets players' respawn point.
private static void SetStat(PlayerList players, StatDefinition statDefinition, float value, PlayerCommandModule.StatApplicationType applicationType = 0)player set-stat: sets a stat's base, minimum or maximum on players.
private static string Teleport(PlayerList players, Player targetPlayer)The player teleport overload that sends players to a spawn area (their respawn point by default). A player with no body makes it throw.
private static string Unban(string username)player unban: server only, takes a name and its user id off the blacklist.
private static void UnlockCancel(Player player)player unlock-cancel: cancels a player's current unlock; a testing command.