class Ban extends UrlModel implements NamedModel

A ban imposed by an admin on a player

Constants

TABLE

The name of the database table used for queries

CREATE_PERMISSION

EDIT_PERMISSION

SOFT_DELETE_PERMISSION

HARD_DELETE_PERMISSION

Methods

addIP(string $ipAddress)

Add an IP to the ban

removeIP(string $ipAddress)

Remove an IP from the ban

Ban
setIPs(string[] $ipAddresses)

Set the IP addresses of the ban

bool
allowedServerJoin()

Check whether or not a player is allowed to join a server when they've been banned

getAuthor()

Get the user who imposed the ban

getCreated()

Get the creation time of the ban

getExpiration()

Get the expiration time of the ban

string
getReason()

Get the ban's description

string
getServerMessage()

Get the ban summary that will appear when a player is denied access to a league server on join

string[]
getIpAddresses()

Get the IP address of the banned player

getUpdated()

Get the time when the ban was last updated

getVictim()

Get the player who was banned

int
getVictimID()

Get the ID of the player who was banned

bool
isExpired()

Calculate whether a ban has expired or not.

bool
willExpire()

Check whether the ban will expire automatically

Ban
expire()

Mark the ban as expired

Ban
setExpiration(TimeDate $expiration)

Set the expiration date of the ban

Ban
setServerMessage(string $message)

Set the server message of the ban

Ban
setReason(string $reason)

Set the reason of the ban

Ban
updateEditTimestamp()

Update the last edit timestamp

Ban
setAllowServerJoin(bool $allowServerJoin)

Set whether the ban's victim is allowed to enter a match server

static Ban
addBan(int $playerID, int $authorID, mixed|null $expiration, string $reason, string $srvmsg = '', string[] $ipAddresses = array(), bool $allowServerJoin = false)

Add a new ban

static QueryBuilder
getQueryBuilder()

Get a query builder for news

string
getName()

Get the name of the entity

void
delete()

Delete the object

static string[]
getActiveStatuses()

Get the possible statuses representing an active model (visible to everyone)

static 
getLazyColumns()

{@inheritdoc}

static Ban[]
getBans()

Get all the bans in the database that aren't disabled or deleted

static Ban|null
getBan(int $playerId)

Get an active ban for the player

Details

at line line 116
addIP(string $ipAddress)

Add an IP to the ban

Parameters

string $ipAddress The IP to add to a ban

at line line 129
removeIP(string $ipAddress)

Remove an IP from the ban

Parameters

string $ipAddress The IP to remove from the ban

at line line 145
Ban setIPs(string[] $ipAddresses)

Set the IP addresses of the ban

Parameters

string[] $ipAddresses The new IP addresses of the ban

Return Value

Ban

at line line 170
bool allowedServerJoin()

Check whether or not a player is allowed to join a server when they've been banned

Return Value

bool Whether or not a player is allowed to join

at line line 179
Player getAuthor()

Get the user who imposed the ban

Return Value

Player The banner

at line line 188
TimeDate getCreated()

Get the creation time of the ban

Return Value

TimeDate The creation time

at line line 197
TimeDate getExpiration()

Get the expiration time of the ban

Return Value

TimeDate

at line line 206
string getReason()

Get the ban's description

Return Value

string

at line line 215
string getServerMessage()

Get the ban summary that will appear when a player is denied access to a league server on join

Return Value

string The ban summary

at line line 228
string[] getIpAddresses()

Get the IP address of the banned player

Return Value

string[]

at line line 239
TimeDate getUpdated()

Get the time when the ban was last updated

Return Value

TimeDate

at line line 248
Player getVictim()

Get the player who was banned

Return Value

Player The banned player

at line line 257
int getVictimID()

Get the ID of the player who was banned

Return Value

int The ID of the victim of the ban

at line line 267
bool isExpired()

Calculate whether a ban has expired or not.

Return Value

bool True if the ban's expiration time has already passed

at line line 281
bool willExpire()

Check whether the ban will expire automatically

Return Value

bool

at line line 291
Ban expire()

Mark the ban as expired

Return Value

Ban

at line line 304
Ban setExpiration(TimeDate $expiration)

Set the expiration date of the ban

Parameters

TimeDate $expiration The expiration

Return Value

Ban

at line line 318
Ban setServerMessage(string $message)

Set the server message of the ban

Parameters

string $message The new server message

Return Value

Ban

at line line 328
Ban setReason(string $reason)

Set the reason of the ban

Parameters

string $reason The new ban reason

Return Value

Ban

at line line 337
Ban updateEditTimestamp()

Update the last edit timestamp

Return Value

Ban

at line line 347
Ban setAllowServerJoin(bool $allowServerJoin)

Set whether the ban's victim is allowed to enter a match server

Parameters

bool $allowServerJoin

Return Value

Ban

at line line 365
static Ban addBan(int $playerID, int $authorID, mixed|null $expiration, string $reason, string $srvmsg = '', string[] $ipAddresses = array(), bool $allowServerJoin = false)

Add a new ban

Parameters

int $playerID The ID of the victim of the ban
int $authorID The ID of the player responsible for the ban
mixed|null $expiration The expiration of the ban (set to NULL so that it never expires)
string $reason The full reason for the ban
string $srvmsg A summary of the ban to be displayed on server banlists (max 150 characters)
string[] $ipAddresses An array of IPs that have been banned
bool $allowServerJoin Whether or not the player is allowed to join match servers

Return Value

Ban An object representing the ban that was just entered or false if the ban was not created

at line line 404
static QueryBuilder getQueryBuilder()

Get a query builder for news

Return Value

QueryBuilder

at line line 417
string getName()

Get the name of the entity

Return Value

string

at line line 425
void delete()

Delete the object

Please note that this does not delete the object entirely from the database, it only hides it from users. You should overload this function if your object does not have a 'status' column which can be set to 'deleted'.

Return Value

void

at line line 434
static string[] getActiveStatuses()

Get the possible statuses representing an active model (visible to everyone)

Return Value

string[]

at line line 442
static getLazyColumns()

{@inheritdoc}

at line line 451
static Ban[] getBans()

Get all the bans in the database that aren't disabled or deleted

Return Value

Ban[] An array of ban objects

at line line 461
static Ban|null getBan(int $playerId)

Get an active ban for the player

Parameters

int $playerId The player's ID

Return Value

Ban|null null if the player isn't currently banned