public function __construct(XEcon $plugin, array $args) { parent::__construct($plugin); $this->path = $plugin->getDataFolder() . $args["entities path"]; $this->ipList = new Config($plugin->getDataFolder() . $args["list path"], Config::ENUM); $this->pretty = $args["pretty print"]; }
public function __construct(XEcon $plugin, array $args) { parent::__construct($plugin); $this->db = new \SQLite3($plugin->getDataFolder() . $args["database path"]); $this->db->exec("CREATE TABLE IF NOT EXISTS ents (\n\t\t\t\tent_type TEXT,\n\t\t\t\tent_name TEXT,\n\t\t\t\tregister_time INTEGER,\n\t\t\t\tlast_modify INTEGER\n\t\t\t\t);"); $this->db->exec("CREATE TABLE IF NOT EXISTS ent_accounts (\n\t\t\t\tent_type TEXT,\n\t\t\t\tent_name TEXT,\n\t\t\t\tname TEXT,\n\t\t\t\tamount REAL,\n\t\t\t\tmax_containable INTEGER,\n\t\t\t\tmin_amount INT\n\t\t\t\t);"); $this->db->exec("CREATE TABLE IF NOT EXISTS ent_loans (\n\t\t\t\tent_type TEXT,\n\t\t\t\tent_name TEXT,\n\t\t\t\tname TEXT,\n\t\t\t\tamount REAL,\n\t\t\t\tdue INTEGER,\n\t\t\t\tincrease_per_hour REAL,\n\t\t\t\tcreation INTEGER,\n\t\t\t\toriginal_amount REAL,\n\t\t\t\tlast_interest_update INTEGER,\n\t\t\t\tfrom_type TEXT,\n\t\t\t\tfrom_name TEXT,\n\t\t\t\tfrom_account TEXT\n\t\t\t\t);"); $this->db->exec("CREATE TABLE IF NOT EXISTS ips (ip REAL PRIMARY KEY);"); }
public function onDisable() { foreach ($this->getServer()->getOnlinePlayers() as $player) { $this->onQuit(new PlayerQuitEvent($player, "")); } if ($this->dataProvider instanceof DataProvider) { $this->dataProvider->close(); } if ($this->universalMysqli instanceof \mysqli) { $this->universalMysqli->close(); // disable dependencies too } }
public function __construct(XEcon $plugin, \mysqli $db, array $args) { parent::__construct($plugin); $this->db = $db; $prefix = $args["table name prefix"]; $this->mtn = $prefix . "ent_index"; $this->atn = $prefix . "ent_accounts"; $this->ltn = $prefix . "ent_loans"; $this->itn = $prefix . "registered_ips"; $this->universal = $args["use universal"]; $db->query("CREATE TABLE IF NOT EXISTS {$this->mtn} (\n\t\t\t\tent_type VARCHAR(255),\n\t\t\t\tent_name VARCHAR(255),\n\t\t\t\tregister_time BIGINT UNSIGNED,\n\t\t\t\tlast_modify BIGINT UNSIGNED\n\t\t\t\t);"); $db->query("CREATE TABLE IF NOT EXISTS {$this->atn} (\n\t\t\t\tent_type VARCHAR(255),\n\t\t\t\tent_name VARCHAR(255),\n\t\t\t\tname VARCHAR(255),\n\t\t\t\tamount DOUBLE SIGNED,\n\t\t\t\tmax_containable BIGINT UNSIGNED,\n\t\t\t\tmin_amount INT SIGNED\n\t\t\t\t);"); $db->query("CREATE TABLE IF NOT EXISTS {$this->ltn} (\n\t\t\t\tent_type VARCHAR(255),\n\t\t\t\tent_name VARCHAR(255),\n\t\t\t\tname VARCHAR(255),\n\t\t\t\tamount DOUBLE SIGNED,\n\t\t\t\tdue BIGINT UNSIGNED,\n\t\t\t\tincrease_per_hour DOUBLE SIGNED,\n\t\t\t\tcreation BIGINT UNSIGNED,\n\t\t\t\toriginal_amount DOUBLE SIGNED,\n\t\t\t\tlast_interest_update BIGINT UNSIGNED,\n\t\t\t\tfrom_type VARCHAR(255),\n\t\t\t\tfrom_name VARCHAR(255),\n\t\t\t\tfrom_account VARCHAR(255)\n\t\t\t\t);"); $db->query("CREATE TABLE IF NOT EXISTS {$this->itn} (\n\t\t\t\tip VARCHAR(15) PRIMARY KEY\n\t\t\t\t);"); }