bugfixes
This commit is contained in:
		| @@ -26,12 +26,12 @@ class BillData { | |||||||
| 	 * Construct new BillData | 	 * Construct new BillData | ||||||
| 	 * | 	 * | ||||||
| 	 * @param mixed  $function | 	 * @param mixed  $function | ||||||
| 	 * @param Player $player | 	 * @param Player/string $player | ||||||
| 	 * @param int    $amount | 	 * @param int    $amount | ||||||
| 	 * @param bool   $pay | 	 * @param bool   $pay | ||||||
| 	 * @param string $receiverLogin | 	 * @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->function      = $function; | ||||||
| 		$this->player        = $player; | 		$this->player        = $player; | ||||||
| 		$this->amount        = $amount; | 		$this->amount        = $amount; | ||||||
|   | |||||||
| @@ -1235,7 +1235,7 @@ class Connection | |||||||
| 	 * @return int BillId | 	 * @return int BillId | ||||||
| 	 * @throws InvalidArgumentException | 	 * @throws InvalidArgumentException | ||||||
| 	 */ | 	 */ | ||||||
| 	function sendBill($payer, $amount, $message, $payee, $multicall=false) | 	function sendBill($payer, $amount, $message, $payee = '', $multicall=false) | ||||||
| 	{ | 	{ | ||||||
| 		$payerLogin = $this->getLogin($payer); | 		$payerLogin = $this->getLogin($payer); | ||||||
| 		if($payerLogin === false) | 		if($payerLogin === false) | ||||||
|   | |||||||
| @@ -287,6 +287,8 @@ class GbxRemote | |||||||
| 			if($written === 0 || $written === false) | 			if($written === 0 || $written === false) | ||||||
| 				return false; | 				return false; | ||||||
|  |  | ||||||
|  | 			fflush($this->socket); | ||||||
|  |  | ||||||
| 			$data = substr($data, $written); | 			$data = substr($data, $written); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ class ManiaControl implements CommandListener, TimerListener { | |||||||
| 	/* | 	/* | ||||||
| 	 * Constants | 	 * Constants | ||||||
| 	 */ | 	 */ | ||||||
| 	const VERSION                     = '0.141'; | 	const VERSION                     = '0.142'; | ||||||
| 	const API_VERSION                 = '2013-04-16'; | 	const API_VERSION                 = '2013-04-16'; | ||||||
| 	const MIN_DEDIVERSION             = '2014-04-02_18_00'; | 	const MIN_DEDIVERSION             = '2014-04-02_18_00'; | ||||||
| 	const OS_UNIX                     = 'Unix'; | 	const OS_UNIX                     = 'Unix'; | ||||||
| @@ -64,9 +64,7 @@ class ManiaControl implements CommandListener, TimerListener { | |||||||
| 	/** @var \SimpleXMLElement $config */ | 	/** @var \SimpleXMLElement $config */ | ||||||
| 	public $config = null; | 	public $config = null; | ||||||
| 	public $configurator = null; | 	public $configurator = null; | ||||||
| 	/** | 	/** @var Connection $client */ | ||||||
| 	 * @var Connection $client |  | ||||||
| 	 */ |  | ||||||
| 	public $client = null; | 	public $client = null; | ||||||
| 	public $commandManager = null; | 	public $commandManager = null; | ||||||
| 	public $database = null; | 	public $database = null; | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ class Player { | |||||||
| 	public $uploadRate = -1; | 	public $uploadRate = -1; | ||||||
| 	public $skins = null; | 	public $skins = null; | ||||||
| 	public $daysSinceZoneInscription = -1; | 	public $daysSinceZoneInscription = -1; | ||||||
| 	public $cache = array(); | 	private $cache = array(); | ||||||
|  |  | ||||||
| 	//Flags details | 	//Flags details | ||||||
| 	public $forcedSpectatorState = 0; | 	public $forcedSpectatorState = 0; | ||||||
| @@ -271,6 +271,17 @@ class Player { | |||||||
| 		$this->cache[$className . $cacheName] = $data; | 		$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 | 	 * Clear the Player's Temporary Data | ||||||
| 	 */ | 	 */ | ||||||
|   | |||||||
| @@ -66,7 +66,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 	 * Returns Back to the Plugins | 	 * Returns Back to the Plugins | ||||||
| 	 */ | 	 */ | ||||||
| 	public function backToPlugins($callback, Player $player) { | 	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()); | 		$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle()); | ||||||
| 		$this->maniaControl->configurator->reopenMenu($player, $menuId); | 		$this->maniaControl->configurator->reopenMenu($player, $menuId); | ||||||
| 	} | 	} | ||||||
| @@ -118,7 +118,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
|  |  | ||||||
| 		$paging->setLabel($pageCountLabel); | 		$paging->setLabel($pageCountLabel); | ||||||
|  |  | ||||||
| 		$settingClass = $player->getCache(self::CACHE_SETTING_CLASS); | 		$settingClass = $player->getCache($this, self::CACHE_SETTING_CLASS); | ||||||
| 		if ($settingClass) { | 		if ($settingClass) { | ||||||
| 			// Show Settings Menu | 			// Show Settings Menu | ||||||
| 			return $this->getPluginSettingsMenu($frame, $width, $height, $paging, $player, $settingClass); | 			return $this->getPluginSettingsMenu($frame, $width, $height, $paging, $player, $settingClass); | ||||||
| @@ -387,7 +387,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 		} else if ($settings) { | 		} else if ($settings) { | ||||||
| 			// Open Settings Menu | 			// Open Settings Menu | ||||||
| 			$pluginClass                              = substr($actionId, strlen(self::ACTION_PREFIX_SETTINGS)); | 			$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) { | 		} else if ($boolSetting) { | ||||||
| 			$actionArray = explode(".", $actionId); | 			$actionArray = explode(".", $actionId); | ||||||
| 			$setting     = $actionArray[1]; | 			$setting     = $actionArray[1]; | ||||||
|   | |||||||
| @@ -597,7 +597,8 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				$sum     = $this->mxKarma["voteCount"] * $this->mxKarma["voteAverage"] - $oldVote + $vote * 100; | 				$sum     = $this->mxKarma["voteCount"] * $this->mxKarma["voteAverage"] - $oldVote + $vote * 100; | ||||||
| 				$modeSum = $this->mxKarma["modeVoteCount"] * $this->mxKarma["modeVoteAverage"] - $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["voteAverage"]           = $sum / $this->mxKarma["voteCount"]; | ||||||
| 			$this->mxKarma["modeVoteAverage"]       = $modeSum / $this->mxKarma["modeVoteCount"]; | 			$this->mxKarma["modeVoteAverage"]       = $modeSum / $this->mxKarma["modeVoteCount"]; | ||||||
| 			$this->mxKarma["votes"][$player->login] = $vote * 100; | 			$this->mxKarma["votes"][$player->login] = $vote * 100; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user