Skip to content

Commit

Permalink
Added PluginSettings class to deprecate other class
Browse files Browse the repository at this point in the history
  • Loading branch information
allejo committed Aug 9, 2015
1 parent f879179 commit 6fa87a4
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 0 deletions.
106 changes: 106 additions & 0 deletions PluginSettings.cpp
@@ -0,0 +1,106 @@
//
// Created by Vladimir Jimenez on 8/4/15.
// Copyright (c) 2015 BZFlag. All rights reserved.
//

#include "PluginSettings.h"

void PluginSettings::loadConfig (char const *filePath)
{
loadConfigurationFile(filePath);
}

std::string PluginSettings::getSpawnCommandPerm (void)
{
return root.getChild("spawn_command_perm").getString();
}

std::string PluginSettings::getMatchReportURL (void)
{
return root.getChild("match_report_url").getString();
}

std::string PluginSettings::getShowHiddenPerm (void)
{
return root.getChild("show_hidden_perm").getString();
}

std::string PluginSettings::getMapChangePath (void)
{
return root.getChild("mapchange_path").getString();
}

std::string PluginSettings::getTeamNameURL (void)
{
return root.getChild("team_name_url").getString();
}

std::string PluginSettings::getLeagueGroup (void)
{
return root.getChild("league_group").getString();
}

std::string PluginSettings::getMottoFormat (void)
{
return root.getChild("motto_format").getString();
}

bool PluginSettings::areOfficialMatchesDisabled (void)
{
return root.getChild("disable_official_matches").getBool();
}

bool PluginSettings::isInterPluginCheckEnabled (void)
{
return root.getChild("interplugin_api_check").getBool();
}

bool PluginSettings::areFunMatchesDisabled (void)
{
return root.getChild("disable_fun_matches").getBool();
}

bool PluginSettings::isPcProtectionEnabled (void)
{
return root.getChild("pc_protection_enabled").getBool();
}

bool PluginSettings::ignoreTimeSanityCheck (void)
{
return root.getChild("ignore_time_checks").getBool();
}

bool PluginSettings::isInGameDebugEnabled (void)
{
return root.getChild("in_game_debug_enabled").getBool();
}

bool PluginSettings::isMatchReportEnabled (void)
{
return root.getChild("match_report_enabled").getBool();
}

bool PluginSettings::isMottoFetchEnabled (void)
{
return root.getChild("motto_fetch_enabled").getBool();
}

bool PluginSettings::isRotationalLeague (void)
{
return root.getChild("rotational_league").getBool();
}

int PluginSettings::getDefaultTimeLimit (void)
{
return root.getChild("default_time_limit").getInt();
}

int PluginSettings::getVerboseLevel (void)
{
return root.getChild("verbose_level").getInt();
}

int PluginSettings::getDebugLevel (void)
{
return root.getChild("debug_level").getInt();
}
55 changes: 55 additions & 0 deletions PluginSettings.h
@@ -0,0 +1,55 @@
//
// Created by Vladimir Jimenez on 8/4/15.
// Copyright (c) 2015 BZFlag. All rights reserved.
//


#ifndef __PluginSettings_H_
#define __PluginSettings_H_

#include "bz_JsonConfig.h"

class PluginSettings : public bz_JsonConfig
{
public:
enum GameMode {
OFFICIAL,
FM,
IDLE,
LAST_GAMEMODE
};

void loadConfig (const char* filePath);

std::vector<std::string> getGuestMessagingMessage (GameMode mode);
std::vector<std::string> getGuestSpawningMessage (GameMode mode);

std::string getSpawnCommandPerm (void);
std::string getMatchReportURL (void);
std::string getShowHiddenPerm (void);
std::string getMapChangePath (void);
std::string getTeamNameURL (void);
std::string getLeagueGroup (void);
std::string getMottoFormat (void);

bool areOfficialMatchesDisabled (void);
bool isInterPluginCheckEnabled (void);
bool isGuestMessagingEnable (GameMode mode);
bool areFunMatchesDisabled (void);
bool isGuestSpawningEnable (GameMode mode);
bool isPcProtectionEnabled (void);
bool isSpawnMessageEnabled (void);
bool ignoreTimeSanityCheck (void);
bool isInGameDebugEnabled (void);
bool isMatchReportEnabled (void);
bool isTalkMessageEnabled (void);
bool isMottoFetchEnabled (void);
bool isAllowLimitedChat (void);
bool isRotationalLeague (void);

int getDefaultTimeLimit (void);
int getVerboseLevel (void);
int getDebugLevel (void);
};

#endif

0 comments on commit 6fa87a4

Please sign in to comment.