Skip to content

Instantly share code, notes, and snippets.

@Matthww
Created June 11, 2015 14:33
Show Gist options
  • Select an option

  • Save Matthww/a8a582a53791b2e0c046 to your computer and use it in GitHub Desktop.

Select an option

Save Matthww/a8a582a53791b2e0c046 to your computer and use it in GitHub Desktop.
class FactionMain extends PluginBase implements Listener {
public $db;
public $prefs;
public $bannednames;
public function onEnable() {
@mkdir($this->getDataFolder());
$this->getServer()->getPluginManager()->registerEvents(new FactionListener($this), $this);
$this->fCommand = new FactionCommands($this);
$this->prefs = new Config($this->getDataFolder() . "Prefs.yml", CONFIG::YAML, array(
"MaxFactionNameLength" => 20,
"MaxPlayersPerFaction" => 10,
"OnlyLeadersAndOfficersCanInvite" => true,
"OfficersCanClaim" => true,
"PlotSize" => 25,
$this->bannednames = new Config($this->getDataFolder() . "bannedNames.yml", CONFIG::YAML, array(
"Admin:admin:Administrator:administrator:Mod:mod:Moderator:moderator:Builder:builder:Owner:Staff",
));
$this->db = new \SQLite3($this->getDataFolder() . "FactionsPro.db");
$this->db->exec("CREATE TABLE IF NOT EXISTS master (player TEXT PRIMARY KEY COLLATE NOCASE, faction TEXT, rank TEXT);");
$this->db->exec("CREATE TABLE IF NOT EXISTS confirm (player TEXT PRIMARY KEY COLLATE NOCASE, faction TEXT, invitedby TEXT, timestamp INT);");
$this->db->exec("CREATE TABLE IF NOT EXISTS motdrcv (player TEXT PRIMARY KEY, timestamp INT);");
$this->db->exec("CREATE TABLE IF NOT EXISTS motd (faction TEXT PRIMARY KEY, message TEXT);");
$this->db->exec("CREATE TABLE IF NOT EXISTS plots(faction TEXT PRIMARY KEY, x1 INT, z1 INT, x2 INT, z2 INT);");
$this->db->exec("CREATE TABLE IF NOT EXISTS home(faction TEXT PRIMARY KEY, x INT, y INT, z INT);");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment