renamed chat commands

This commit is contained in:
kremsy 2017-05-08 23:01:15 +02:00
parent 31be7e7409
commit 84b884154c

View File

@ -40,7 +40,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
const SETTING_PERMISSION_SHOW_SYSTEMINFO = 'Show SystemInfo';
const SETTING_PERMISSION_SHUTDOWN_SERVER = 'Shutdown Server';
const SETTING_PERMISSION_CHANGE_SERVERSETTINGS = 'Change ServerSettings';
const SETTING_PERMISSION_TM_HANDLE_POINTS_REPARTITION = 'Handle Points Repartion Settings';
const SETTING_PERMISSION_TM_HANDLE_POINTS_REPARTITION = 'Handle Points Distribution Settings';
/*
* Private properties
@ -101,8 +101,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'tm') {
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_TM_HANDLE_POINTS_REPARTITION, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
$this->maniaControl->getCommandManager()->registerCommandListener('setpointsrepartition', $this, 'commandSetPointsRepartition', true, 'Gets the Rounds Point Repartition.');
$this->maniaControl->getCommandManager()->registerCommandListener('getpointsrepartition', $this, 'commandGetPointsRepartition', true, 'Sets the Rounds Point Repartition.');
$this->maniaControl->getCommandManager()->registerCommandListener('setpointsdistribution', $this, 'commandSetPointsRepartition', true, 'Gets the Rounds Point Repartition.');
$this->maniaControl->getCommandManager()->registerCommandListener('getpointsdistribution', $this, 'commandGetPointsRepartition', true, 'Sets the Rounds Point Repartition.');
}
}
@ -474,10 +474,10 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
$pointString = $params[1];
$pointArray = explode(',', $pointString);
$this->maniaControl->getModeScriptEventManager()->setTrackmaniaPointsRepartition($pointArray);
$this->maniaControl->getChat()->sendInformation('Points Repartition Changed!');
$this->maniaControl->getChat()->sendInformation('Points Repartition Changed!', $player);
$this->commandGetPointsRepartition($chatCallback, $player);
} else {
$this->maniaControl->getChat()->sendError('You must provide a point Repartition in the following form: 10,8,6,4,3 !');
$this->maniaControl->getChat()->sendError('You must provide a point Repartition in the following form: 10,8,6,4,3 !', $player);
}
}
@ -494,14 +494,14 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
return;
}
$this->maniaControl->getModeScriptEventManager()->getTrackmaniaPointsRepartition()->setCallable(function (OnPointsRepartitionStructure $structure) {
$this->maniaControl->getModeScriptEventManager()->getTrackmaniaPointsRepartition()->setCallable(function (OnPointsRepartitionStructure $structure) use ($player){
$pointRepartitionString = "";
foreach ($structure->getPointsRepartition() as $points) {
$pointRepartitionString .= $points . ',';
}
$pointRepartitionString = substr($pointRepartitionString, 0, -1);
$this->maniaControl->getChat()->sendInformation('Current Points Repartition: ' . $pointRepartitionString);
$this->maniaControl->getChat()->sendInformation('Current Points Repartition: ' . $pointRepartitionString, $player);
});
}