Compare commits
No commits in common. "6a4ca89adbfc7579237e1b9ba4f0178df14d81e7" and "214a22e5e8ff03a9533633db6adbd06edd45d993" have entirely different histories.
6a4ca89adb
...
214a22e5e8
@ -3,7 +3,6 @@
|
|||||||
namespace Beu;
|
namespace Beu;
|
||||||
|
|
||||||
use ManiaControl\Commands\CommandListener;
|
use ManiaControl\Commands\CommandListener;
|
||||||
use ManiaControl\Logger;
|
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
@ -20,7 +19,7 @@ class GuestlistManager implements CommandListener, Plugin {
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const PLUGIN_ID = 154;
|
const PLUGIN_ID = 154;
|
||||||
const PLUGIN_VERSION = 1.2;
|
const PLUGIN_VERSION = 1.1;
|
||||||
const PLUGIN_NAME = 'Guestlist Manager';
|
const PLUGIN_NAME = 'Guestlist Manager';
|
||||||
const PLUGIN_AUTHOR = 'Beu';
|
const PLUGIN_AUTHOR = 'Beu';
|
||||||
|
|
||||||
@ -86,10 +85,7 @@ class GuestlistManager implements CommandListener, Plugin {
|
|||||||
$this->maniaControl->getCommandManager()->registerCommandListener('loadgl', $this, 'doloadgl', true, 'Load the guestlist');
|
$this->maniaControl->getCommandManager()->registerCommandListener('loadgl', $this, 'doloadgl', true, 'Load the guestlist');
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener('cleangl', $this, 'docleangl', true, 'Clean the guestlist');
|
$this->maniaControl->getCommandManager()->registerCommandListener('cleangl', $this, 'docleangl', true, 'Clean the guestlist');
|
||||||
|
|
||||||
$guestlist = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_GUESTLIST_FILE);
|
return true;
|
||||||
if ($guestlist === "" || is_file($this->maniaControl->getServer()->getDirectory()->getUserDataFolder() . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . $guestlist)) {
|
|
||||||
$this->maniaControl->getClient()->loadGuestList($guestlist);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,33 +204,10 @@ class GuestlistManager implements CommandListener, Plugin {
|
|||||||
* @param \ManiaControl\Players\Player $player
|
* @param \ManiaControl\Players\Player $player
|
||||||
*/
|
*/
|
||||||
public function dosavegl(Array $chat, Player $player) {
|
public function dosavegl(Array $chat, Player $player) {
|
||||||
try {
|
// impossible to save on a other file, idk why
|
||||||
$guestlist = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_GUESTLIST_FILE);
|
$guestlist = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_GUESTLIST_FILE);
|
||||||
|
|
||||||
if ($guestlist !== "") {
|
|
||||||
$filepath = $this->maniaControl->getServer()->getDirectory()->getUserDataFolder() . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . $guestlist;
|
|
||||||
|
|
||||||
if (!is_file($filepath)) {
|
|
||||||
file_put_contents($filepath, '<?xml version="1.0" encoding="utf-8" ?><guestlist></guestlist>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Workaround when the file was never loaded by the server
|
|
||||||
$currentguestlist = $this->maniaControl->getClient()->getGuestList();
|
|
||||||
$this->maniaControl->getClient()->loadGuestList($guestlist);
|
|
||||||
|
|
||||||
$this->maniaControl->getClient()->cleanGuestList();
|
|
||||||
foreach ($currentguestlist as $player) {
|
|
||||||
$this->maniaControl->getClient()->addGuest($player->login);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->maniaControl->getClient()->saveGuestList($guestlist);
|
$this->maniaControl->getClient()->saveGuestList($guestlist);
|
||||||
|
|
||||||
$this->maniaControl->getChat()->sendSuccess( "Guestlist saved!" , $player);
|
$this->maniaControl->getChat()->sendSuccess( "Guestlist saved!" , $player);
|
||||||
} catch (\Exception $e) {
|
|
||||||
Logger::logError("Impossible to save guestlist: " . $e->getMessage());
|
|
||||||
$this->maniaControl->getChat()->sendError("Impossible to save guestlist: " . $e->getMessage(), $player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ use ManiaControl\Callbacks\TimerListener; // for pause
|
|||||||
class MatchManagerCore implements CallbackListener, CommandListener, TimerListener, CommunicationListener, Plugin {
|
class MatchManagerCore implements CallbackListener, CommandListener, TimerListener, CommunicationListener, Plugin {
|
||||||
|
|
||||||
const PLUGIN_ID = 152;
|
const PLUGIN_ID = 152;
|
||||||
const PLUGIN_VERSION = 4.3;
|
const PLUGIN_VERSION = 4.2;
|
||||||
const PLUGIN_NAME = 'MatchManager Core';
|
const PLUGIN_NAME = 'MatchManager Core';
|
||||||
const PLUGIN_AUTHOR = 'Beu';
|
const PLUGIN_AUTHOR = 'Beu';
|
||||||
|
|
||||||
@ -510,10 +510,13 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
|
|||||||
|
|
||||||
// Update table data
|
// Update table data
|
||||||
$mysqliconfig = $this->maniaControl->getDatabase()->getConfig();
|
$mysqliconfig = $this->maniaControl->getDatabase()->getConfig();
|
||||||
|
$query = 'IF NOT EXISTS( SELECT NULL
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE `table_name` = "' . self::DB_ROUNDSDATA . '"
|
||||||
|
AND `table_schema` = "' . $mysqliconfig->name . '"
|
||||||
|
AND `column_name` = "mappoints") THEN
|
||||||
|
|
||||||
$query = 'SELECT NULL FROM INFORMATION_SCHEMA.COLUMNS WHERE `table_schema` = "' . $mysqliconfig->name . '" AND `table_name` = "' . self::DB_ROUNDSDATA . '" AND `column_name` = "mappoints";';
|
ALTER TABLE `' . self::DB_ROUNDSDATA . '`
|
||||||
if ($mysqli->query($query)->num_rows === 0) {
|
|
||||||
$query = 'ALTER TABLE `' . self::DB_ROUNDSDATA . '`
|
|
||||||
ADD COLUMN `mappoints` INT(10) NOT NULL AFTER `matchpoints`,
|
ADD COLUMN `mappoints` INT(10) NOT NULL AFTER `matchpoints`,
|
||||||
CHANGE `time` `bestracetime` INT(10) NOT NULL,
|
CHANGE `time` `bestracetime` INT(10) NOT NULL,
|
||||||
ADD COLUMN `bestracecheckpoints` VARCHAR(1000) NOT NULL AFTER `bestracetime`,
|
ADD COLUMN `bestracecheckpoints` VARCHAR(1000) NOT NULL AFTER `bestracetime`,
|
||||||
@ -521,33 +524,33 @@ class MatchManagerCore implements CallbackListener, CommandListener, TimerListen
|
|||||||
ADD COLUMN `bestlapcheckpoints` VARCHAR(1000) NOT NULL AFTER `bestlaptime`,
|
ADD COLUMN `bestlapcheckpoints` VARCHAR(1000) NOT NULL AFTER `bestlaptime`,
|
||||||
ADD COLUMN `prevracetime` INT(10) NOT NULL AFTER `bestlapcheckpoints`,
|
ADD COLUMN `prevracetime` INT(10) NOT NULL AFTER `bestlapcheckpoints`,
|
||||||
ADD COLUMN `prevracecheckpoints` VARCHAR(1000) NOT NULL AFTER `prevracetime`,
|
ADD COLUMN `prevracecheckpoints` VARCHAR(1000) NOT NULL AFTER `prevracetime`,
|
||||||
MODIFY `teamid` INT(3) NOT NULL;';
|
MODIFY `teamid` INT(3) NOT NULL;
|
||||||
$mysqli->query($query);
|
ALTER TABLE `' . self::DB_TEAMSDATA . '`
|
||||||
if ($mysqli->error) {
|
|
||||||
trigger_error($mysqli->error, E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = 'ALTER TABLE `' . self::DB_TEAMSDATA . '`
|
|
||||||
ADD COLUMN `rank` INT(3) NOT NULL,
|
ADD COLUMN `rank` INT(3) NOT NULL,
|
||||||
MODIFY `id` INT(3) NOT NULL,
|
MODIFY `id` INT(3) NOT NULL,
|
||||||
CHANGE `points` `matchpoints` INT(10) NOT NULL,
|
CHANGE `points` `matchpoints` INT(10) NOT NULL,
|
||||||
ADD COLUMN `mappoints` INT(10) NOT NULL AFTER `matchpoints`,
|
ADD COLUMN `mappoints` INT(10) NOT NULL AFTER `matchpoints`,
|
||||||
ADD COLUMN `roundpoints` INT(10) NOT NULL AFTER `mappoints`;';
|
ADD COLUMN `roundpoints` INT(10) NOT NULL AFTER `mappoints`;
|
||||||
|
END IF;';
|
||||||
$mysqli->query($query);
|
$mysqli->query($query);
|
||||||
if ($mysqli->error) {
|
if ($mysqli->error) {
|
||||||
trigger_error($mysqli->error, E_USER_ERROR);
|
trigger_error($mysqli->error, E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
$query = 'IF NOT EXISTS( SELECT NULL
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE `table_name` = "' . self::DB_ROUNDSDATA . '"
|
||||||
|
AND `table_schema` = "' . $mysqliconfig->name . '"
|
||||||
|
AND `column_name` = "login"
|
||||||
|
AND `CHARACTER_MAXIMUM_LENGTH` = 36) THEN
|
||||||
|
|
||||||
$query = 'SELECT NULL FROM INFORMATION_SCHEMA.COLUMNS WHERE `table_schema` = "' . $mysqliconfig->name . '" AND `table_name` = "' . self::DB_ROUNDSDATA . '" AND `column_name` = "login" AND `CHARACTER_MAXIMUM_LENGTH` = 36;';
|
ALTER TABLE `' . self::DB_ROUNDSDATA . '`
|
||||||
if ($mysqli->query($query)->num_rows === 0) {
|
MODIFY `login` VARCHAR(36) NOT NULL;
|
||||||
$query = 'ALTER TABLE `' . self::DB_ROUNDSDATA . '` MODIFY `login` VARCHAR(36) NOT NULL;';
|
END IF;';
|
||||||
$mysqli->query($query);
|
$mysqli->query($query);
|
||||||
if ($mysqli->error) {
|
if ($mysqli->error) {
|
||||||
trigger_error($mysqli->error, E_USER_ERROR);
|
trigger_error($mysqli->error, E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getMatchStatus() {
|
public function getMatchStatus() {
|
||||||
return $this->matchStarted;
|
return $this->matchStarted;
|
||||||
|
Loading…
Reference in New Issue
Block a user