started with plugin class
This commit is contained in:
@ -36,7 +36,7 @@ class Database {
|
||||
|
||||
// Load config
|
||||
$this->config = Tools::loadConfig('database.ManiaControl.xml');
|
||||
$this->iControl->checkConfig($this->config, array("host", "user"), 'database.ManiaControl.xml');
|
||||
$this->mControl->checkConfig($this->config, array("host", "user"), 'database.ManiaControl.xml');
|
||||
|
||||
// Get mysql server information
|
||||
$host = $this->config->xpath('host');
|
||||
@ -73,8 +73,8 @@ class Database {
|
||||
$this->initTables();
|
||||
|
||||
// Register for callbacks
|
||||
$this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_5_SECOND, $this, 'handle5Second');
|
||||
$this->iControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_BEGINMAP, $this, 'handleBeginMap');
|
||||
$this->mControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_5_SECOND, $this, 'handle5Second');
|
||||
$this->mControl->callbacks->registerCallbackHandler(Callbacks::CB_IC_BEGINMAP, $this, 'handleBeginMap');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -227,7 +227,7 @@ class Database {
|
||||
*/
|
||||
public function handle5Second($callback = null) {
|
||||
// Save current players in database
|
||||
$players = $this->iControl->server->getPlayers();
|
||||
$players = $this->mControl->server->getPlayers();
|
||||
if ($players) {
|
||||
$query = "";
|
||||
foreach ($players as $player) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace mControl;
|
||||
namespace ManiaControl;
|
||||
|
||||
/**
|
||||
* Class manialinkidHandler handles manialink id's
|
||||
@ -10,7 +10,30 @@ namespace mControl;
|
||||
|
||||
|
||||
class ManialinkIdHandler {
|
||||
/**
|
||||
* Private properties
|
||||
*/
|
||||
private $maniaLinkIdCount;
|
||||
|
||||
public function __construct(){
|
||||
$maniaLinkIdCount = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reservses manialinks for a plugin
|
||||
*
|
||||
* @param int $count
|
||||
* @return array with manialink Ids
|
||||
*/
|
||||
|
||||
public function reserveManiaLinkIds($count){
|
||||
$mlIds = array();
|
||||
for($i = 0; $i < $count; $i++){
|
||||
$mlIds[0] = $i + $this->maniaLinkIdCount;
|
||||
}
|
||||
$this->maniaLinkIdCount += $count;
|
||||
return $mlIds;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace mControl;
|
||||
namespace ManiaControl;
|
||||
|
||||
/**
|
||||
* Class plugin parent class for all plugins
|
||||
@ -30,14 +30,6 @@ namespace mControl;
|
||||
$this->updateUrl = '';
|
||||
}
|
||||
|
||||
/*
|
||||
public function __construct($mControl, $name, $version, $author, $updateUrl = ''){
|
||||
$this->mControl = $mControl;
|
||||
$this->name = $name;
|
||||
$this->version = $version;
|
||||
$this->author = $author;
|
||||
$this->updateUrl = $updateUrl;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Reserves manialinks on the ManialinkIdHandler
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace mControl;
|
||||
namespace ManiaControl;
|
||||
|
||||
/**
|
||||
* Class handles plugins
|
||||
|
Reference in New Issue
Block a user