Woops wrong class member name

This commit is contained in:
Vortrex
2022-06-07 10:22:38 -05:00
parent daa6b637f0
commit 87bd72c9a0

View File

@@ -85,8 +85,11 @@ let globalConfig = {
houseBlipStreamOutDistance: 120, houseBlipStreamOutDistance: 120,
jobBlipStreamInDistance: -1, jobBlipStreamInDistance: -1,
jobBlipStreamOutDistance: -1, jobBlipStreamOutDistance: -1,
playerBlipStreamInDistance: -1,
playerBlipStreamOutDistance: -1,
handcuffPlayerDistance: 3, handcuffPlayerDistance: 3,
firstAidKitPlayerDistance: 3, firstAidKitPlayerDistance: 3,
droppedItemPickupRange: 2,
passwordRequiredCapitals: 0, passwordRequiredCapitals: 0,
passwordRequiredNumbers: 0, passwordRequiredNumbers: 0,
passwordRequiredSymbols: 0, passwordRequiredSymbols: 0,
@@ -107,49 +110,49 @@ function loadGlobalConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading global configuration ..."); logToConsole(LOG_DEBUG, "[VRR.Config] Loading global configuration ...");
try { try {
getGlobalConfig().database = loadDatabaseConfig(); getGlobalConfig().database = loadDatabaseConfig();
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Failed to load global configuration. Error: ${error}`); logToConsole(LOG_ERROR, `[VRR.Config] Failed to load global configuration. Error: ${error}`);
thisResource.stop(); thisResource.stop();
} }
try { try {
getGlobalConfig().economy = loadEconomyConfig(); getGlobalConfig().economy = loadEconomyConfig();
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Failed to load economy configuration. Error: ${error}`); logToConsole(LOG_ERROR, `[VRR.Config] Failed to load economy configuration. Error: ${error}`);
thisResource.stop(); thisResource.stop();
} }
try { try {
getGlobalConfig().locale = loadLocaleConfig(); getGlobalConfig().locale = loadLocaleConfig();
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Failed to load locale configuration. Error: ${error}`); logToConsole(LOG_ERROR, `[VRR.Config] Failed to load locale configuration. Error: ${error}`);
thisResource.stop(); thisResource.stop();
} }
try { try {
getGlobalConfig().accents = loadAccentConfig(); getGlobalConfig().accents = loadAccentConfig();
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Failed to load accent configuration. Error: ${error}`); logToConsole(LOG_ERROR, `[VRR.Config] Failed to load accent configuration. Error: ${error}`);
thisResource.stop(); thisResource.stop();
} }
try { try {
getGlobalConfig().discord = loadDiscordConfig(); getGlobalConfig().discord = loadDiscordConfig();
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Failed to load discord configuration. Error: ${error}`); logToConsole(LOG_ERROR, `[VRR.Config] Failed to load discord configuration. Error: ${error}`);
thisResource.stop(); thisResource.stop();
} }
try { try {
getGlobalConfig().keyBind = loadKeyBindConfig(); getGlobalConfig().keyBind = loadKeyBindConfig();
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Failed to load keybind configuration. Error: ${error}`); logToConsole(LOG_ERROR, `[VRR.Config] Failed to load keybind configuration. Error: ${error}`);
thisResource.stop(); thisResource.stop();
} }
try { try {
getGlobalConfig().email = loadEmailConfig(); getGlobalConfig().email = loadEmailConfig();
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Failed to load email configuration. Error: ${error}`); logToConsole(LOG_ERROR, `[VRR.Config] Failed to load email configuration. Error: ${error}`);
thisResource.stop(); thisResource.stop();
} }
@@ -161,11 +164,11 @@ function loadGlobalConfig() {
function loadServerConfigFromGameAndPort(gameId, port) { function loadServerConfigFromGameAndPort(gameId, port) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if (dbConnection) {
let dbQueryString = `SELECT * FROM svr_main WHERE svr_game = ${gameId} AND svr_port = ${port} LIMIT 1;`; let dbQueryString = `SELECT * FROM svr_main WHERE svr_game = ${gameId} AND svr_port = ${port} LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString); let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) { if (dbQuery) {
if(dbQuery.numRows > 0) { if (dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery); let dbAssoc = fetchQueryAssoc(dbQuery);
let tempServerConfigData = new ServerConfigData(dbAssoc); let tempServerConfigData = new ServerConfigData(dbAssoc);
freeDatabaseQuery(dbQuery); freeDatabaseQuery(dbQuery);
@@ -181,11 +184,11 @@ function loadServerConfigFromGameAndPort(gameId, port) {
function loadServerConfigFromId(tempServerId) { function loadServerConfigFromId(tempServerId) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if (dbConnection) {
let dbQueryString = `SELECT * FROM svr_main WHERE svr_id = ${tempServerId} LIMIT 1;`; let dbQueryString = `SELECT * FROM svr_main WHERE svr_id = ${tempServerId} LIMIT 1;`;
let dbQuery = queryDatabase(dbConnection, dbQueryString); let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) { if (dbQuery) {
if(dbQuery.numRows > 0) { if (dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery); let dbAssoc = fetchQueryAssoc(dbQuery);
let tempServerConfigData = new ServerConfigData(dbAssoc); let tempServerConfigData = new ServerConfigData(dbAssoc);
freeDatabaseQuery(dbQuery); freeDatabaseQuery(dbQuery);
@@ -203,12 +206,12 @@ function applyConfigToServer(tempServerConfig) {
logToConsole(LOG_INFO, "[VRR.Config]: Applying server config ..."); logToConsole(LOG_INFO, "[VRR.Config]: Applying server config ...");
logToConsole(LOG_DEBUG, "[VRR.Config]: Server config applied successfully!"); logToConsole(LOG_DEBUG, "[VRR.Config]: Server config applied successfully!");
if(isTimeSupported()) { if (isTimeSupported()) {
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`); logToConsole(LOG_DEBUG, `[VRR.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration); setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
} }
if(isWeatherSupported()) { if (isWeatherSupported()) {
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting weather to ${tempServerConfig.weather}`); logToConsole(LOG_DEBUG, `[VRR.Config]: Setting weather to ${tempServerConfig.weather}`);
game.forceWeather(tempServerConfig.weather); game.forceWeather(tempServerConfig.weather);
} }
@@ -220,9 +223,9 @@ function applyConfigToServer(tempServerConfig) {
function saveServerConfigToDatabase() { function saveServerConfigToDatabase() {
logToConsole(LOG_DEBUG, `[VRR.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`); logToConsole(LOG_DEBUG, `[VRR.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
if(getServerConfig().needsSaved) { if (getServerConfig().needsSaved) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if (dbConnection) {
let data = [ let data = [
//["svr_settings", toInteger(getServerConfig().settings)], //["svr_settings", toInteger(getServerConfig().settings)],
["svr_start_time_hour", getServerConfig().hour], ["svr_start_time_hour", getServerConfig().hour],
@@ -261,7 +264,7 @@ function saveServerConfigToDatabase() {
["svr_inflation_multiplier", getServerConfig().inflationMultiplier], ["svr_inflation_multiplier", getServerConfig().inflationMultiplier],
["svr_intro_music", getServerConfig().introMusicURL], ["svr_intro_music", getServerConfig().introMusicURL],
["svr_gui", getServerConfig().useGUI], ["svr_gui", getServerConfig().useGUI],
["svr_logo", getServerConfig().useLogo], ["svr_logo", getServerConfig().showLogo],
["svr_snow_falling", getServerConfig().fallingSnow], ["svr_snow_falling", getServerConfig().fallingSnow],
["svr_snow_ground", getServerConfig().groundSnow], ["svr_snow_ground", getServerConfig().groundSnow],
["svr_biz_blips", getServerConfig().createBusinessBlips], ["svr_biz_blips", getServerConfig().createBusinessBlips],
@@ -329,7 +332,7 @@ function getServerId() {
* *
*/ */
function setTimeCommand(command, params, client) { function setTimeCommand(command, params, client) {
if(areParamsEmpty(params)) { if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -337,12 +340,12 @@ function setTimeCommand(command, params, client) {
let hour = toInteger(getParam(params, " ", 1)); let hour = toInteger(getParam(params, " ", 1));
let minute = toInteger(getParam(params, " ", 2)) || 0; let minute = toInteger(getParam(params, " ", 2)) || 0;
if(hour > 23 || hour < 0) { if (hour > 23 || hour < 0) {
messagePlayerError(client, "The hour must be between 0 and 23!"); messagePlayerError(client, "The hour must be between 0 and 23!");
return false; return false;
} }
if(minute > 59 || minute < 0) { if (minute > 59 || minute < 0) {
messagePlayerError(client, "The minute must be between 0 and 59!"); messagePlayerError(client, "The minute must be between 0 and 59!");
return false; return false;
} }
@@ -374,7 +377,7 @@ function setTimeCommand(command, params, client) {
* *
*/ */
function setMinuteDurationCommand(command, params, client) { function setMinuteDurationCommand(command, params, client) {
if(areParamsEmpty(params)) { if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -401,14 +404,14 @@ function setMinuteDurationCommand(command, params, client) {
* *
*/ */
function setWeatherCommand(command, params, client) { function setWeatherCommand(command, params, client) {
if(areParamsEmpty(params)) { if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
let weatherId = getWeatherFromParams(getParam(params, " ", 1)); let weatherId = getWeatherFromParams(getParam(params, " ", 1));
if(!weatherId) { if (!weatherId) {
messagePlayerError(client, `That weather ID or name is invalid!`); messagePlayerError(client, `That weather ID or name is invalid!`);
return false; return false;
} }
@@ -435,7 +438,7 @@ function setWeatherCommand(command, params, client) {
* *
*/ */
function setSnowingCommand(command, params, client) { function setSnowingCommand(command, params, client) {
if(areParamsEmpty(params)) { if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -468,7 +471,7 @@ function setSnowingCommand(command, params, client) {
* *
*/ */
function setServerGUIColoursCommand(command, params, client) { function setServerGUIColoursCommand(command, params, client) {
if(areParamsEmpty(params)) { if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -481,7 +484,7 @@ function setServerGUIColoursCommand(command, params, client) {
getServerConfig().guiColour = [colourRed, colourGreen, colourBlue]; getServerConfig().guiColour = [colourRed, colourGreen, colourBlue];
let clients = getClients(); let clients = getClients();
for(let i in clients) { for (let i in clients) {
sendPlayerGUIColours(clients[i]); sendPlayerGUIColours(clients[i]);
} }
@@ -525,7 +528,7 @@ function toggleServerLogoCommand(command, params, client) {
* @return {bool} Whether or not the command was successful * @return {bool} Whether or not the command was successful
* *
*/ */
function toggleServerJobBlipsCommand(command, params, client) { function toggleServerJobBlipsCommand(command, params, client) {
getServerConfig().createJobBlips = !getServerConfig().createJobBlips; getServerConfig().createJobBlips = !getServerConfig().createJobBlips;
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -545,7 +548,7 @@ function toggleServerLogoCommand(command, params, client) {
* @return {bool} Whether or not the command was successful * @return {bool} Whether or not the command was successful
* *
*/ */
function toggleServerJobPickupsCommand(command, params, client) { function toggleServerJobPickupsCommand(command, params, client) {
getServerConfig().createJobPickups = !getServerConfig().createJobPickups; getServerConfig().createJobPickups = !getServerConfig().createJobPickups;
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -565,7 +568,7 @@ function toggleServerLogoCommand(command, params, client) {
* @return {bool} Whether or not the command was successful * @return {bool} Whether or not the command was successful
* *
*/ */
function toggleServerBusinessBlipsCommand(command, params, client) { function toggleServerBusinessBlipsCommand(command, params, client) {
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips; getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -585,7 +588,7 @@ function toggleServerLogoCommand(command, params, client) {
* @return {bool} Whether or not the command was successful * @return {bool} Whether or not the command was successful
* *
*/ */
function toggleServerBusinessPickupsCommand(command, params, client) { function toggleServerBusinessPickupsCommand(command, params, client) {
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups; getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -605,7 +608,7 @@ function toggleServerLogoCommand(command, params, client) {
* @return {bool} Whether or not the command was successful * @return {bool} Whether or not the command was successful
* *
*/ */
function toggleServerHouseBlipsCommand(command, params, client) { function toggleServerHouseBlipsCommand(command, params, client) {
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips; getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -625,7 +628,7 @@ function toggleServerLogoCommand(command, params, client) {
* @return {bool} Whether or not the command was successful * @return {bool} Whether or not the command was successful
* *
*/ */
function toggleServerHousePickupsCommand(command, params, client) { function toggleServerHousePickupsCommand(command, params, client) {
getServerConfig().createHousePickups = !getServerConfig().createHousePickups; getServerConfig().createHousePickups = !getServerConfig().createHousePickups;
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -690,7 +693,7 @@ function toggleServerUseRealWorldTimeCommand(command, params, client) {
* *
*/ */
function setServerRealWorldTimeZoneCommand(command, params, client) { function setServerRealWorldTimeZoneCommand(command, params, client) {
if(areParamsEmpty(params)) { if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -756,7 +759,7 @@ function reloadEmailConfigurationCommand(command, params, client) {
* *
*/ */
function reloadDatabaseConfigurationCommand(command, params, client) { function reloadDatabaseConfigurationCommand(command, params, client) {
if(getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) { if (getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) {
logToConsole(LOG_WARN, `[VRR.Database] Closing persistent database connection`); logToConsole(LOG_WARN, `[VRR.Database] Closing persistent database connection`);
persistentDatabaseConnection.close(); persistentDatabaseConnection.close();
persistentDatabaseConnection = null; persistentDatabaseConnection = null;
@@ -765,7 +768,7 @@ function reloadDatabaseConfigurationCommand(command, params, client) {
getGlobalConfig().database = loadDatabaseConfig(); getGlobalConfig().database = loadDatabaseConfig();
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reloaded the database config`); messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reloaded the database config`);
databaseEnabled = true; databaseEnabled = true;
if(getDatabaseConfig().usePersistentConnection) { if (getDatabaseConfig().usePersistentConnection) {
connectToDatabase(); connectToDatabase();
} }
return true; return true;
@@ -782,8 +785,8 @@ function reloadDatabaseConfigurationCommand(command, params, client) {
* @return {bool} Whether or not the command was successful * @return {bool} Whether or not the command was successful
* *
*/ */
function setServerNameTagDistanceCommand(command, params, client) { function setServerNameTagDistanceCommand(command, params, client) {
if(areParamsEmpty(params)) { if (areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command)); messagePlayerSyntax(client, getCommandSyntaxText(command));
return false; return false;
} }
@@ -807,7 +810,7 @@ function getServerIntroMusicURL() {
function loadLocaleConfig() { function loadLocaleConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading locale configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading locale configuration");
let localeConfig = JSON.parse(loadTextFile(`config/locale.json`)); let localeConfig = JSON.parse(loadTextFile(`config/locale.json`));
if(localeConfig != null) { if (localeConfig != null) {
return localeConfig; return localeConfig;
} }
} }
@@ -817,7 +820,7 @@ function loadLocaleConfig() {
function loadEconomyConfig() { function loadEconomyConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading economy configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading economy configuration");
let economyConfig = JSON.parse(loadTextFile(`config/economy.json`)); let economyConfig = JSON.parse(loadTextFile(`config/economy.json`));
if(economyConfig != null) { if (economyConfig != null) {
return economyConfig; return economyConfig;
} }
} }
@@ -827,7 +830,7 @@ function loadEconomyConfig() {
function loadAccentConfig() { function loadAccentConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading accents configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading accents configuration");
let accentConfig = JSON.parse(loadTextFile(`config/accents.json`)); let accentConfig = JSON.parse(loadTextFile(`config/accents.json`));
if(accentConfig != null) { if (accentConfig != null) {
return accentConfig; return accentConfig;
} }
} }
@@ -837,7 +840,7 @@ function loadAccentConfig() {
function loadDiscordConfig() { function loadDiscordConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading discord configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading discord configuration");
let discordConfig = JSON.parse(loadTextFile(`config/discord.json`)); let discordConfig = JSON.parse(loadTextFile(`config/discord.json`));
if(discordConfig != null) { if (discordConfig != null) {
return discordConfig; return discordConfig;
} }
return false; return false;
@@ -848,7 +851,7 @@ function loadDiscordConfig() {
function loadDatabaseConfig() { function loadDatabaseConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading database configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading database configuration");
let databaseConfig = JSON.parse(loadTextFile("config/database.json")); let databaseConfig = JSON.parse(loadTextFile("config/database.json"));
if(databaseConfig != null) { if (databaseConfig != null) {
return databaseConfig; return databaseConfig;
} }
return false; return false;
@@ -859,7 +862,7 @@ function loadDatabaseConfig() {
function loadKeyBindConfig() { function loadKeyBindConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading keybind configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading keybind configuration");
let keyBindConfig = JSON.parse(loadTextFile("config/keybind.json")); let keyBindConfig = JSON.parse(loadTextFile("config/keybind.json"));
if(keyBindConfig != null) { if (keyBindConfig != null) {
return keyBindConfig; return keyBindConfig;
} }
return false; return false;
@@ -870,7 +873,7 @@ function loadKeyBindConfig() {
function loadEmailConfig() { function loadEmailConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading email configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading email configuration");
let emailConfig = JSON.parse(loadTextFile("config/email.json")); let emailConfig = JSON.parse(loadTextFile("config/email.json"));
if(emailConfig != null) { if (emailConfig != null) {
return emailConfig; return emailConfig;
} }
return false; return false;
@@ -954,7 +957,7 @@ function loadServerConfig() {
logToConsole(LOG_DEBUG, "[VRR.Config] Loading server configuration"); logToConsole(LOG_DEBUG, "[VRR.Config] Loading server configuration");
try { try {
serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort()); serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
} catch(error) { } catch (error) {
logToConsole(LOG_ERROR, `[VRR.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`); logToConsole(LOG_ERROR, `[VRR.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort}`);
thisResource.stop(); thisResource.stop();
} }