World of Hello
Static Public Member Functions | List of all members
server Class Reference

used for anything related to the server. More...

#include <server.h>

Static Public Member Functions

static bool isConnected ()
 checks if the user is online or offline. More...
 
static server sendToClients (string command, string commandStr, bool removable=true, string key="", string keyStr="")
 send a command to clients. More...
 
static server setKey (conditional< string, int > user, string key, string keyVal)
 set a user variable key for receiving certain data. More...
 
static server addKey (conditional< string, int > user, string key, string keyVal)
 adds a user variable key for sending data to clients. More...
 
static server removeKey (conditional< string, int > user, string key, string keyVal="")
 removes a key or keyVal from the client. More...
 
static conditional< multiReturn< element *, string >, multiReturn< mesh *, string >, multiReturn< ServerObject *, string >, nil > getObjectFromCommand (string command)
 gets an object based on the server command. More...
 
static server getObjects (string location)
 get objects saved on the server. More...
 
static server sendScript (string scriptName, string scriptCont=game:getScript(scriptName), function func=null,...)
 sends the script to the server. More...
 
static server sendFile (string filePath, function func=null,...)
 sends a file to the server. More...
 
static server sendFile (string filePath, string serverFilePath, function func=null,...)
 sends a file to the server. More...
 
static server sendFile (string serverFilePath, string fileContent, bool anyVal, function func=null,...)
 sends a file to the server. More...
 
static server appendFile (string serverFilePath, string content, function func=null,...)
 appends content to the end of a server file. More...
 
static server getFile (string serverFilePath, function func=null,...)
 get a file from the server. More...
 
static server downloadFile (string serverFilePath, function func=null,...)
 downloads a file from the server and lets the user pick a save location. More...
 
static server renameFile (string serverFilePath, sring newServerFilePath, function func=null,...)
 renames a server file to a new name. More...
 
static server deleteFile (string serverFilePath, function func=null,...)
 deletes a file from the server. More...
 
static server getFilePaths (string serverFolderPath, string find="", bool recursive=false, int maxResults=100, int page=0, function func,...)
 gets a list of files in a server's world directory. More...
 
static server getScriptPaths (string serverFilePath, function func,...)
 gets a list of scripts from the server that the user is also running. More...
 
static server getAccountPermissions (string accountName, function func,...)
 get and account's permissions. More...
 
static server getAccountsWithPermissions (string permission, string permissionStr, function func,...)
 gets a list of accounts who have the provided permissions. More...
 
static server getAccountsWithPermissions (string permission, function func,...)
 gets a list of accounts who have the provided permissions. More...
 
static server findAccounts (string name, int max, int page, function func,...)
 gets a list of accounts that may match a given name. More...
 
static server addPermission (string account, string permission, string permissionStr, bool enabled=true, function func=null,...)
 Adds a permission to the client. More...
 
static server removePermission (string account, string permission, string permissionStr="", bool enabled=true, function func=null,...)
 Removes a permission from the client. More...
 
static server getAccountIsStaff (string account, function func,...)
 gets whether the client is a staff member or not. More...
 
static server setAccountIsStaff (string account, bool isStaff=true, function func=null,...)
 sets whether the client is a staff member or not, More...
 
static server getWorldProperties (function func,...)
 get the world's properties. More...
 
static server addWorldProperty (string property, string propertyStr, bool enabled=true, function func=null,...)
 adds a world property to the world. More...
 
static server removeWorldProperty (string property, string propertyStr="", bool enabled=true, function func=null,...)
 removes a world property from the world. More...
 
static server getOnlineList (function func,...)
 gets a list of all connected user accounts. More...
 
static server getAccountsByName (string name, int maxResults=100, int page=0, function func,...)
 gets a list of accounts by name. More...
 
static server getServerList (function func,...)
 gets a list of all worlds. More...
 
static int getSendMessageCount (string command)
 get the amount of messages being sent for a command. More...
 
static server getVar (string textFilePath, string variable, function func,...)
 gets a stored value from the server. More...
 
static server setVar (string textFilePath, string variable, string value, function func=null,...)
 sets a stored value to the server. More...
 
static server ping (string message, function func,...)
 pings the server to grab a response. More...
 
static server getSQL (string dbFile, string SQL, function func,...)
 sends an SQL command to the server to receive the results. More...
 
static server sendGit (string command, string location="", function func=null,...)
 sends a git command to be ran on the server. More...
 
static server getClientsWithKeys (string key, string valVal, function func,...)
 gets a list of clients who have the given keys. More...
 
static server getClientsWithKeys (string key, function func,...)
 gets a list of clients who have the given keys. More...
 
static server getNPCServers (function func,...)
 gets a list of NPC servers and their status More...
 
static server createNPCServer (string name, function func=null,...)
 creates a new NPCServer. More...
 
static server removeNPCServer (string name, function func=null,...)
 removes an NPCServer. More...
 
static server startNPCServer (string name, bool onServer=true, function func=null,...)
 starts an NPCServer. More...
 
static server stopNPCServer (string name, function func=null,...)
 stops an NPCServer. More...
 
static server setNPCServerBootOnInit (string name, bool bootOnInit=true, function func=null,...)
 sets whether or not the NPCServer boots when the world is initialized. More...
 
static server setNPCServerFaultTolerant (string name, bool faultTolerant=true, function func=null,...)
 sets whether or not the NPCServer is fault-tolerant. More...
 

Detailed Description

used for anything related to the server.

   Most of these functions send a command to the server to get a result back.
   Since these commands go through the server, the results must be caught using
   "function onCommand(command, commandStr)" instead.
   If the user is offline, the commands are still caught through the "onCommand" function,
   but are obtained locally, if possible, instead.

Member Function Documentation

◆ addKey()

static server server::addKey ( conditional< string, int >  user,
string  key,
string  keyVal 
)
static

adds a user variable key for sending data to clients.

   Adds a server key to the client. If the user param is an int value, adds the key on the client with the ID. If it's a string, adds the key on the client with the account name.\n
   If the key doesn't exist, it will be created. If the key does exist, the keyVal is added as an array item.\n
   WARNING: keys are temporary, they are removed when the client disconnects from the server. Required permission: KeyPermissions.
Parameters
Theuser ID or the account name.
Thekey to add to this user.
Thevalue of the key to be added to this user.
Returns
Returns itself.

◆ addPermission()

static server server::addPermission ( string  account,
string  permission,
string  permissionStr,
bool  enabled = true,
function  func = null,
  ... 
)
static

Adds a permission to the client.

   Adds a permission, whether that permission is enabled or disabled, to the client.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: The account adding the permission must have the "Account" permission and be a staff member, otherwise an error is thrown.
Parameters
Theaccount to add the permission to.
Thetype of permission to add.
Thepermission string to add.
(optional)Whether the client has the permission enabled or disabled.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ addWorldProperty()

static server server::addWorldProperty ( string  property,
string  propertyStr,
bool  enabled = true,
function  func = null,
  ... 
)
static

adds a world property to the world.

   Adds a property, whether that property is enabled or disabled, to the world.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: The account adding the permission must have the "World" permission and be a staff member, otherwise an error is thrown.
Parameters
Theproperty to add to the world.
Theproperty string to add to the world.
(optional)Whether or not the property is enabled.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ appendFile()

static server server::appendFile ( string  serverFilePath,
string  content,
function  func = null,
  ... 
)
static

appends content to the end of a server file.

   Adds the given content to the end of the given server file.
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Thepath of the file stored in the server.
Thecontent to be added to the end of the file.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ createNPCServer()

static server server::createNPCServer ( string  name,
function  func = null,
  ... 
)
static

creates a new NPCServer.

  Creates a new NPCServer, which can be used to run specific tasks normal users don't have access to.\n
      The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Thename of the new NPCServer.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ deleteFile()

static server server::deleteFile ( string  serverFilePath,
function  func = null,
  ... 
)
static

deletes a file from the server.

   Removes the file from the server.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: the deleted file cannot be restored. If you want some way to have backups, you'll have to handle that yourself.
   One way to create restoration processes would be to create a "dedicated server" with a command clients send to the created server, and then the dedicated server deletes the file and created a backup.\n
   WARNING: the file may only be removed if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason. Required permission: FilePermissions.
Parameters
Thepath of the file stored in the server.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ downloadFile()

static server server::downloadFile ( string  serverFilePath,
function  func = null,
  ... 
)
static

downloads a file from the server and lets the user pick a save location.

   Downloads a file from the server, then prompts the user for a save location.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: there is no required permission to download files by default.\n
   You must disable (a) file(s)/folder(s) in the World/Account Properties under permission FileDownload to keep files secure.
Parameters
Thepath of the file stored in the server.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ findAccounts()

static server server::findAccounts ( string  name,
int  max,
int  page,
function  func,
  ... 
)
static

gets a list of accounts that may match a given name.

  Gets accounts that may match the name given, returns the first given max names.\n
  If there are more names than the given max, you can find the next list of names by passing in the next page value.\n
  The function, func, given is invoked with the optional values given as well as an additional param: string[] names.
Parameters
Thename of the account to find.
Theamount of names to return at one time, cannot exceed 100.
Thepagination, starting at 0.
Thefunction to be invoked when the accounts are found.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getAccountIsStaff()

static server server::getAccountIsStaff ( string  account,
function  func,
  ... 
)
static

gets whether the client is a staff member or not.

   Gets whether or not the account is a staff member.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed bool isStaff, where isStaff is true if the account is a staff member, otherwise false.
   WARNING: The account checking whether or not another account is a staff member must be a staff member, otherwise an error is thrown.\n
   WARNING: The account to check whether or not it's a staff member must exist, otherwise false is returned.\n
Parameters
Thename of the account.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getAccountPermissions()

static server server::getAccountPermissions ( string  accountName,
function  func,
  ... 
)
static

get and account's permissions.

   Gets a given account's permissions for the connected world.\n
  The given function, func, is then triggered as an Event.Server.onSQLReceived event and passed any additional arguments given.
  It is also passed map<string,string[]> permissions, where permissions is a dictionary whose first value is the permission name, and second value is a list of all values for the permission.
Parameters
Thename of the account to get the permissions of.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getAccountsByName()

static server server::getAccountsByName ( string  name,
int  maxResults = 100,
int  page = 0,
function  func,
  ... 
)
static

gets a list of accounts by name.

  Gets a list of accounts that match a given name.\n
  This is typically used to implement searching accounts.\n
  We cap the amount of results at 100 to help prevent taking up too much of the client network, but you can grab the next set of results using the page param.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string[] accounts, where accounts is a list of account names, and int pages, where pages is the number of results divided by the given maxResults.
Parameters
Thename of the account to search for.
(optional)The amount of results to return. Results cap at a maximum of 100.
(optional)The page number of the results to return.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getAccountsWithPermissions() [1/2]

static server server::getAccountsWithPermissions ( string  permission,
function  func,
  ... 
)
static

gets a list of accounts who have the provided permissions.

   Gets a list of accounts who have the permission and, if given, has the permission for a certain string.\n
   Permissions are currently: Script, File, AppendFile, World, and Account.
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string[] accounts, where accounts is a list of account names.
   WARNING: this function does not return accounts who have permissions (for example, File permissions) from the World's properties.
   Only through permissions by account.
Parameters
Thepermission (Script, File, etc.) to get a list of accounts who contain it.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getAccountsWithPermissions() [2/2]

static server server::getAccountsWithPermissions ( string  permission,
string  permissionStr,
function  func,
  ... 
)
static

gets a list of accounts who have the provided permissions.

   Gets a list of accounts who have the permission and, if given, has the permission for a certain string.\n
   Permissions are currently: Script, File, AppendFile, World, and Account.
  The given function, func, is then triggered and passed any additional arguments given.
  It is also passed string[] accounts, where accounts is a list of account names.
   WARNING: this function does not return accounts who have permissions (for example, File permissions) from the World's properties.
   Only through permissions by account.
Parameters
Thepermission (Script, File, etc.) to get a list of accounts who contain it.
Astring to check if the user has permission to that item.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getClientsWithKeys() [1/2]

static server server::getClientsWithKeys ( string  key,
function  func,
  ... 
)
static

gets a list of clients who have the given keys.

   Sends a server request to get clients who have the given keys with associated keyVals.\n
   If no keyVal is given, gets all clients who have the given key.\n
   Keys are set using self:setKey().\n
  The given function, func, is then triggered and passed any additional arguments given.
  It is also passed map<string,string[]> results, where results is a dictionary whose second value is a list that maps to strings "Account" and "ID".
Parameters
Thekey for getting clients who contain it.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getClientsWithKeys() [2/2]

static server server::getClientsWithKeys ( string  key,
string  valVal,
function  func,
  ... 
)
static

gets a list of clients who have the given keys.

   Sends a server request to get clients who have the given keys with associated keyVals.\n
   If no keyVal is given, gets all clients who have the given key.\n
   Keys are set using self:setKey().\n
  The given function, func, is then triggered as an Event.Server.onSQLReceived event and passed any additional arguments given.
  It is also passed map<int,string> clients, where clients is a dictionary whose first value is the client's dynamic ID, and second value is the client's account name.
Parameters
Thekey for getting clients who contain it.
Theassociate key value for getting clients who contain it.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getFile()

static server server::getFile ( string  serverFilePath,
function  func = null,
  ... 
)
static

get a file from the server.

   Downloads a file from the server.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: there is no required permission to download files by default.\n
   You must disable (a) file(s)/folder(s) in the World/Account Properties under permission FileDownload to keep files secure.
Parameters
Thepath of the file stored in the server.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getFilePaths()

static server server::getFilePaths ( string  serverFolderPath,
string  find = "",
bool  recursive = false,
int  maxResults = 100,
int  page = 0,
function  func,
  ... 
)
static

gets a list of files in a server's world directory.

   Gets a list of all the files and folders in the given server directory.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string[] filePaths, where filePaths is a list of file paths.\n
  By passing in a find parameter, will only return files that match the find (recursively in all folders, if recursive is passed as true).
   WARNING: the file paths may only be obtained if the user has sufficient server rights. If the user does not have the correct rights for any file,
   a server command "MessageBox" will be thrown with the reason. Otherwise, the user will only get file paths they have permissions to. Required permission: FilePermissions.
Parameters
Thepath of a folder to get all files in.
(optional)A file to find.
(optional)Whether the file to find should be recursively searched or not.
(optional)The amount of results to return. Results cap at a maximum of 100.
(optional)The page number of the results to return.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getNPCServers()

static server server::getNPCServers ( function  func,
  ... 
)
static

gets a list of NPC servers and their status

  Sends a server request as SQL to get NPC Servers.\n
  If an identifier is given the SQL event is raised with the identifier, otherwise nil.\n
   The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string[] NPCServers, where NPCServers is a list of all NPCServer names.
   WARNING: the NPC Servers may only be obtained if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason. Required permissions: NPCServer + Admin.
Parameters
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getObjectFromCommand()

static conditional<multiReturn<element*, string>, multiReturn<mesh*,string>, multiReturn<ServerObject*,string>, nil> server::getObjectFromCommand ( string  command)
static

gets an object based on the server command.

   Gets an object based on the given server command.\n
   If the command is not an object, or is an invalid object, returns nil.\n
   This function may also be used on strings, but is intended for server commands in "function onCommand()".
Parameters
Theserver command.
Returns
(1) An element, if the command is a valid element. A mesh, if the command is a valid mesh. A ServerObject, if the command is a valid server object. Otherwise, nil.
(2) If (1) is not nil, returns "element", "mesh", or "ServerObject" based on the object type.

◆ getObjects()

static server server::getObjects ( string  location)
static

get objects saved on the server.

   Gets objects saved on the server.
   You may use this function to grab a single saved object, or all saved objects in a directory.
   Objects start in the "Objects/" server directory. Each object then gets stored on the server, and sent to the client like a normal object.
Parameters
Thelocation of the object on the server, or the location of the directory with multiple objects.
Returns
Returns itself.

◆ getOnlineList()

static server server::getOnlineList ( function  func,
  ... 
)
static

gets a list of all connected user accounts.

   Gets a list of all connected user accounts.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string[] accounts, where accounts is a list of account names.
Parameters
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getScriptPaths()

static server server::getScriptPaths ( string  serverFilePath,
function  func,
  ... 
)
static

gets a list of scripts from the server that the user is also running.

   Gets a list of all files from the server, filtered to only files with a .lua extension.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string[] accounts, where accounts is a list of account names.
   WARNING: the script paths may only be obtained if the user has sufficient server rights. If the user does not have the correct rights for any scripts,
   a server command "MessageBox" will be thrown with the reason. Otherwise, the user will only get script paths they have permissions to. Required permission: ScriptPermissions.
Parameters
Thepath of a folder to get all scripts in.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getSendMessageCount()

static int server::getSendMessageCount ( string  command)
static

get the amount of messages being sent for a command.

Todo:
server:getSendMessageCount() should be updated.
   When a large command is being sent to the server, it is sent in chunks.
   This function gets the amount of chunks that need to be sent before the command is processed.\n
   Good for checking upload/download speeds.\n
   WARNING: if multiple messages are matched with the given command, returns the count of all of them together.\n
   You may use asterisks ('*') to match different commands.
Parameters
Thecommand to get the send message count for.
Returns
The amount of chunks needed to be sent for the command.

◆ getServerList()

static server server::getServerList ( function  func,
  ... 
)
static

gets a list of all worlds.

   Gets a list of all servers (worlds) who have the world property "WorldListed = true"\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string[] servers, where servers is a list of world (server) names.
Parameters
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getSQL()

static server server::getSQL ( string  dbFile,
string  SQL,
function  func,
  ... 
)
static

sends an SQL command to the server to receive the results.

   Performs SQL on a given server database file.\n
   The given function, func, is then triggered as an Event.Server.onSQLReceived event and passed any additional arguments given.
  It is also passed map<string,string[]> results, where results is a dictionary whose first value is the column name, and second value is a list of all values for the column.
Parameters
Thedatabase file stored on the server (typically ends in ".db").
TheSQL string to be performed.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getVar()

static server server::getVar ( string  textFilePath,
string  variable,
function  func,
  ... 
)
static

gets a stored value from the server.

   Gets a value previously set by server:setVar() from the server.
   May also be used to get a variable out of the user's account if the textFilePath starts with "accounts/".\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string val, where val the value of the given variable.
Parameters
Thepath to the .txt file with the variable. Should not have a trailing .txt.
Thevariable to get from a file.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ getWorldProperties()

static server server::getWorldProperties ( function  func,
  ... 
)
static

get the world's properties.

   Gets the world's properties.\n
  The given function, func, is then triggered as an Event.Server.onSQLReceived event and passed any additional arguments given.
  It is also passed map<string,string[]> properties, where properties is a dictionary whose first value is the property name, and second value is a list of all values for the property.
   WARNING: the world properties may only be obtained if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason. Required permissions: World.
Parameters
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ isConnected()

static bool server::isConnected ( )
static

checks if the user is online or offline.

Returns
Returns true if the user is connected to the server, otherwise false.

◆ ping()

static server server::ping ( string  message,
function  func,
  ... 
)
static

pings the server to grab a response.

   Sends a message to the server. The server then sends the same message
   back to the client, which can be caught with onCommand(cmd, str) (view the Events tab for more information on onCommand).\n
   This is useful for situations where you need to see if other information is still awaiting being sent to the client.\n
   For example, if you try to get all files in a path from the server, you can't know when all files have been downloaded or if
   they are still being downloaded. Instead, you can ping the server for a response. When the response is received, you know all files
   have been downloaded.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
  It is also passed string message, where message is the given message.
Parameters
Themessage for the server to send to yourself.
Thefunction to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ removeKey()

static server server::removeKey ( conditional< string, int >  user,
string  key,
string  keyVal = "" 
)
static

removes a key or keyVal from the client.

   If the user param is an int value, removes the key from the client with the ID. If it's a string, removes the key from the client with the account name.\n
  If keyVal is not an empty string and the client contains the key with the keyVal,
   the keyVal is removed. If it is the only keyVal in the key, the key is removed.\n
   If keyVal is an empty string and the client contains the key,
   the entire key and it's contents are removed.\n
   WARNING: keys are temporary, they are removed when the client disconnects from the server. Required permission: KeyPermissions.
Parameters
Theuser ID or the account name.
Thekey, or key with the keyVal, to be removed from the client.
(optional)The keyVal of the key to be removed from the client.
Returns
Returns itself.

◆ removeNPCServer()

static server server::removeNPCServer ( string  name,
function  func = null,
  ... 
)
static

removes an NPCServer.

  Deletes an existing NPCServer by name, case sensitive. If the NPCServer doesn't exist, nothing is removed.
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Thename of the NPCServer to be deleted.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ removePermission()

static server server::removePermission ( string  account,
string  permission,
string  permissionStr = "",
bool  enabled = true,
function  func = null,
  ... 
)
static

Removes a permission from the client.

   Removes a permission, whether that permission is enabled or disabled, from the client.\n
   If no permissionStr is given, all permissions of type permission are removed.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: The account adding the permission must have the "Account" permission and be a staff member, otherwise an error is thrown.
Parameters
Theaccount to remove the permission from.
Thetype of permission to remove.
(optional)The permission string to remove, otherwise all permissions of type permission.
(optional)Whether the client has the permission enabled or disabled, otherwise all permissions of type permission that are of the given enabled.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ removeWorldProperty()

static server server::removeWorldProperty ( string  property,
string  propertyStr = "",
bool  enabled = true,
function  func = null,
  ... 
)
static

removes a world property from the world.

   Removes a property, whether that property is enabled or disabled, from the world.\n
   If no propertyStr is given, all properties of type property are removed.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: The account removing the permission must have the "World" permission and be a staff member, otherwise an error is thrown.
Parameters
Thetype of property to remove.
(optional)The propertyStr to remove if given, otherwise all properties of type property.
(optional)Whether the world has the property enabled or disabled, otherwise all properties of type property that are of the given enabled.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ renameFile()

static server server::renameFile ( string  serverFilePath,
sring  newServerFilePath,
function  func = null,
  ... 
)
static

renames a server file to a new name.

   Renames the server file to the new name. If the new file name is renamed to a different directory,
   the file will be moved accordingly and create new folders as necessary.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: the file may only be renamed if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason. Required permission: FilePermissions.
Parameters
Thename of the file to rename.
Thenew name of the file.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ sendFile() [1/3]

static server server::sendFile ( string  filePath,
function  func = null,
  ... 
)
static

sends a file to the server.

   Sends a file with it's content to the server.\nUpdates the existing file or creates a new file with the content.
   All clients using this file will receive the new file. Any clients who log in and then use the file or who do not have the file will receive this new file when possible.
   This means that it updates the file for everyone.\nThe file is stored in the server in the world's directory under the file's name, not the file path.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: the file may only be updated if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason.
Parameters
Thepath of the file to send to the server.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ sendFile() [2/3]

static server server::sendFile ( string  filePath,
string  serverFilePath,
function  func = null,
  ... 
)
static

sends a file to the server.

   Sends a file with it's content to the server under a new name and/or directory.\nUpdates the existing file or creates a new file with the content.
   All clients using this file will receive the new file. Any clients who log in and then use the file or who do not have the file will receive this new file when possible.
   This means that it updates the file for everyone.\nThe file is stored in the server in the world's directory with the serverFilePath directory. All folders will be created corresponding to serverFilePath.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: the file may only be updated if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason.
Parameters
Thepath of the file to send to the server.
Thenew name of the file to be stored in the server. All folders will be created as necessary.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ sendFile() [3/3]

static server server::sendFile ( string  serverFilePath,
string  fileContent,
bool  anyVal,
function  func = null,
  ... 
)
static

sends a file to the server.

   Sends a file with the given file content to the server to be created or updated without the client needing the file to be in their world folder.\nUpdates the existing file or creates a new file with the content.
   All clients using this file will receive the new file. Any clients who log in and then use the file or who do not have the file will receive this new file when possible.
   This means that it updates the file for everyone.\nThe file is stored in the server in the world's directory with the serverFilePath directory. All folders will be created corresponding to serverFilePath.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: the file may only be updated if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason.
Parameters
Thepath of the file to send to the server.
Thenew name of the file to be stored in the server. All folders will be created as necessary.
Anyvalue. Used to distinguish between "sendFile(string filePath, string serverFilePath)" and this function.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ sendGit()

static server server::sendGit ( string  command,
string  location = "",
function  func = null,
  ... 
)
static

sends a git command to be ran on the server.

   Executes a git command to be ran on the server at the base World location.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: must have the permission ScriptPermissions to be able to use any commands.
Parameters
Thegit command to execute.
(optional)The server folder to perform the git command, otherwise the base location.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ sendScript()

static server server::sendScript ( string  scriptName,
string  scriptCont = game:getScript(scriptName),
function  func = null,
  ... 
)
static

sends the script to the server.

   Sends a script with it's content, or new content, to the server for other clients to receive if they are using the script.
   If the client is offline or they do not have the script, they will receive this new script when possible.
   This means that it updates the server script for everyone.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: the script may only be updated if the user has sufficient server rights.
Parameters
Thename of the script to be updated in the server.
(optional)The content of the script to be updated in the server.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ sendToClients()

static server server::sendToClients ( string  command,
string  commandStr,
bool  removable = true,
string  key = "",
string  keyStr = "" 
)
static

send a command to clients.

   Sends a command to clients who fit the criteria through key variables.
   If a command is removable, then the command is not required to be sent to the clients, and the data may be dropped for speed.
   Likewise, if it is removable and a command with the same command name is in queue to be sent to the server, the first command is updated
   to the new command for speed. If a command is not removable, it will for sure make it to the server, regardless of multiple commands with the same command name.\n
  You may also use the key and keyStr to match clients who have keys (see self:setKey()).
Parameters
Thecommand that clients will receive.
Thecommand action that clients will receive with the command.
(optional)Whether or not the command should for-sure make it to the client, or if it can be dropped for speed purposes.
(optional)The key that all clients must have for the command to be sent to them.
(optional)The keyStr that all clients must have for the command to be sent to them. If keyStr is empty, the clients must only require the key.

◆ setAccountIsStaff()

static server server::setAccountIsStaff ( string  account,
bool  isStaff = true,
function  func = null,
  ... 
)
static

sets whether the client is a staff member or not,

   Sets whether or not the account is a staff member.\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: The account setting whether or not another account is a staff member must be a staff member and have "Account" permissions,
   otherwise an error is thrown.
Parameters
Thename of the account.
(optional)Whether or not the account is a staff member.

◆ setKey()

static server server::setKey ( conditional< string, int >  user,
string  key,
string  keyVal 
)
static

set a user variable key for receiving certain data.

   Sets a server key to the client. If the user param is an int value, sets the key on the client with the ID. If it's a string, sets the key on the client with the account name.
   If the key contains multiple keyVals, then the key will be updated to contain only the given keyVal.\n
   WARNING: keys are temporary, they are removed when the client disconnects from the server. Required permission: KeyPermissions.\n
Parameters
Theuser ID or the account name.
Thekey to be set to this user.
Thevalue of the key to be set to this user.
Returns
Returns itself.

◆ setNPCServerBootOnInit()

static server server::setNPCServerBootOnInit ( string  name,
bool  bootOnInit = true,
function  func = null,
  ... 
)
static

sets whether or not the NPCServer boots when the world is initialized.

  Worlds are initialized the first time a client connects to the world. Sets whether or not
  the NPCServer should boot up when a world is initialized, false by default.
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Thename of the NPC server.
(optional)Whether or not the NPCServer boots on initialization.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ setNPCServerFaultTolerant()

static server server::setNPCServerFaultTolerant ( string  name,
bool  faultTolerant = true,
function  func = null,
  ... 
)
static

sets whether or not the NPCServer is fault-tolerant.

  Fault-tolerance means that if an NPCServer is to crash or disconnect, then the NPCServer
  is restarted. If an NPCServer is started locally, the NPCServer is restarted on the server.
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Thename of the NPC server.
(optional)Whether or not the NPCServer is fault-tolerant.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ setVar()

static server server::setVar ( string  textFilePath,
string  variable,
string  value,
function  func = null,
  ... 
)
static

sets a stored value to the server.

   Sets a value to be stored on the server.
   May also be used to set a variable on a user's account if the textFilePath starts with "accounts/".\n
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
   WARNING: the variable may only be set if the user has sufficient server rights. If the user does not have the correct rights,
   a server command "MessageBox" will be thrown with the reason. Required permissions: AccountPermissions for an account, otherwise FilePermissions.
Parameters
Thepath to the .txt file with the variable. Should not have a trailing .txt.
Thevariable to set the value of in the file.
Thevalue to set the variable on the server to.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ startNPCServer()

static server server::startNPCServer ( string  name,
bool  onServer = true,
function  func = null,
  ... 
)
static

starts an NPCServer.

  Starts an NPCServer task, which acts like a user. By default, the NPCServer starts by running script
  Scripts/NPCServer_(NPCServerName)/main.lua, where (NPCServerName) is the given name (without parenthesis).
  Does nothing if the NPCServer name isn't found.
      The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Thename of the NPC server to start.
(optional)Whether the NPCServer starts locally or on the server. True by default.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.

◆ stopNPCServer()

static server server::stopNPCServer ( string  name,
function  func = null,
  ... 
)
static

stops an NPCServer.

  Stops an NPCServer task from running, closing it completely. Does nothing if the NPCServer name isn't found.
  The given function, func, is then triggered as an Event.Server.onCommand event and passed any additional arguments given.
Parameters
Thename of the NPC server to stop.
(optional)The function to trigger with the server response.
(optional)Any number of values to pass to the function, func, when invoked.