fixed empty message karma voting bug
This commit is contained in:
parent
0cadc02560
commit
5db1e23a7b
@ -231,8 +231,12 @@ class KarmaPlugin implements CallbackListener, Plugin {
|
|||||||
if(preg_match('/[^+-]/', $message)) {
|
if(preg_match('/[^+-]/', $message)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$vote = substr_count($message, '+');
|
$countPositive = substr_count($message, '+');
|
||||||
$vote -= substr_count($message, '-');
|
$countNegative = substr_count($message, '-');
|
||||||
|
if ($countPositive <= 0 && $countNegative <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$vote = $countPositive - $countNegative;
|
||||||
$success = $this->handleVote($player, $vote);
|
$success = $this->handleVote($player, $vote);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred.', $player->login);
|
$this->maniaControl->chat->sendError('Error occurred.', $player->login);
|
||||||
|
Loading…
Reference in New Issue
Block a user