bugfixes
This commit is contained in:
parent
74320397ea
commit
bc578d9a4e
@ -26,12 +26,12 @@ class BillData {
|
||||
* Construct new BillData
|
||||
*
|
||||
* @param mixed $function
|
||||
* @param Player $player
|
||||
* @param Player/string $player
|
||||
* @param int $amount
|
||||
* @param bool $pay
|
||||
* @param string $receiverLogin
|
||||
*/
|
||||
public function __construct($function, Player $player, $amount, $pay = false, $receiverLogin = null) {
|
||||
public function __construct($function, $player, $amount, $pay = false, $receiverLogin = null) {
|
||||
$this->function = $function;
|
||||
$this->player = $player;
|
||||
$this->amount = $amount;
|
||||
|
@ -1235,7 +1235,7 @@ class Connection
|
||||
* @return int BillId
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
function sendBill($payer, $amount, $message, $payee, $multicall=false)
|
||||
function sendBill($payer, $amount, $message, $payee = '', $multicall=false)
|
||||
{
|
||||
$payerLogin = $this->getLogin($payer);
|
||||
if($payerLogin === false)
|
||||
|
@ -287,6 +287,8 @@ class GbxRemote
|
||||
if($written === 0 || $written === false)
|
||||
return false;
|
||||
|
||||
fflush($this->socket);
|
||||
|
||||
$data = substr($data, $written);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ManiaControl implements CommandListener, TimerListener {
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
const VERSION = '0.141';
|
||||
const VERSION = '0.142';
|
||||
const API_VERSION = '2013-04-16';
|
||||
const MIN_DEDIVERSION = '2014-04-02_18_00';
|
||||
const OS_UNIX = 'Unix';
|
||||
@ -64,9 +64,7 @@ class ManiaControl implements CommandListener, TimerListener {
|
||||
/** @var \SimpleXMLElement $config */
|
||||
public $config = null;
|
||||
public $configurator = null;
|
||||
/**
|
||||
* @var Connection $client
|
||||
*/
|
||||
/** @var Connection $client */
|
||||
public $client = null;
|
||||
public $commandManager = null;
|
||||
public $database = null;
|
||||
|
@ -40,7 +40,7 @@ class Player {
|
||||
public $uploadRate = -1;
|
||||
public $skins = null;
|
||||
public $daysSinceZoneInscription = -1;
|
||||
public $cache = array();
|
||||
private $cache = array();
|
||||
|
||||
//Flags details
|
||||
public $forcedSpectatorState = 0;
|
||||
@ -271,6 +271,17 @@ class Player {
|
||||
$this->cache[$className . $cacheName] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a Cache
|
||||
*
|
||||
* @param $object
|
||||
* @param $cacheName
|
||||
*/
|
||||
public function destroyCache($object, $cacheName) {
|
||||
$className = $this->getClassName($object);
|
||||
unset($this->cache[$className . $cacheName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the Player's Temporary Data
|
||||
*/
|
||||
|
@ -66,7 +66,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
||||
* Returns Back to the Plugins
|
||||
*/
|
||||
public function backToPlugins($callback, Player $player) {
|
||||
unset($player->cache[self::CACHE_SETTING_CLASS]);
|
||||
$player->destroyCache($this, self::CACHE_SETTING_CLASS);
|
||||
$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle());
|
||||
$this->maniaControl->configurator->reopenMenu($player, $menuId);
|
||||
}
|
||||
@ -118,7 +118,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
||||
|
||||
$paging->setLabel($pageCountLabel);
|
||||
|
||||
$settingClass = $player->getCache(self::CACHE_SETTING_CLASS);
|
||||
$settingClass = $player->getCache($this, self::CACHE_SETTING_CLASS);
|
||||
if ($settingClass) {
|
||||
// Show Settings Menu
|
||||
return $this->getPluginSettingsMenu($frame, $width, $height, $paging, $player, $settingClass);
|
||||
@ -387,7 +387,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
||||
} else if ($settings) {
|
||||
// Open Settings Menu
|
||||
$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_SETTINGS));
|
||||
$player->cache[self::CACHE_SETTING_CLASS] = $pluginClass;
|
||||
$player->setCache($this, self::CACHE_SETTING_CLASS, $pluginClass);
|
||||
} else if ($boolSetting) {
|
||||
$actionArray = explode(".", $actionId);
|
||||
$setting = $actionArray[1];
|
||||
|
@ -597,7 +597,8 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$sum = $this->mxKarma["voteCount"] * $this->mxKarma["voteAverage"] - $oldVote + $vote * 100;
|
||||
$modeSum = $this->mxKarma["modeVoteCount"] * $this->mxKarma["modeVoteAverage"] - $oldVote + $vote * 100;
|
||||
}
|
||||
|
||||
//FIXME, how can here ever be division by zero?, a voting just happened before, and a vote of a player is set
|
||||
//edit problem is if someone votes on one server (on a map which has no votes yet, joins another server than where same map is running and votes again)
|
||||
$this->mxKarma["voteAverage"] = $sum / $this->mxKarma["voteCount"];
|
||||
$this->mxKarma["modeVoteAverage"] = $modeSum / $this->mxKarma["modeVoteCount"];
|
||||
$this->mxKarma["votes"][$player->login] = $vote * 100;
|
||||
|
Loading…
Reference in New Issue
Block a user