prevent too huge donation amounts

This commit is contained in:
Steffen Schröder 2014-07-20 00:12:28 +02:00
parent ea04eca452
commit d6405550ee

View File

@ -274,6 +274,13 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
* @param string $receiverName * @param string $receiverName
*/ */
private function handleDonation(Player $player, $amount, $receiver = '', $receiverName = null) { private function handleDonation(Player $player, $amount, $receiver = '', $receiverName = null) {
if ($amount > 1000000) {
// Prevent too huge donation amounts that would cause xmlrpc parsing errors
$message = "You can only donate 1.000.000 Planets at a time!";
$this->maniaControl->chat->sendError($message, $player);
return;
}
if (!$receiverName) { if (!$receiverName) {
$serverName = $this->maniaControl->client->getServerName(); $serverName = $this->maniaControl->client->getServerName();
$message = 'Donate ' . $amount . ' Planets to $<' . $serverName . '$>?'; $message = 'Donate ' . $amount . ' Planets to $<' . $serverName . '$>?';