proper scoping to callback structures + usage Information Method
This commit is contained in:
		| @@ -3,8 +3,8 @@ | |||||||
| namespace ManiaControl\Callbacks\Structures; | namespace ManiaControl\Callbacks\Structures; | ||||||
|  |  | ||||||
|  |  | ||||||
| use ManiaControl\General\Dumpable; |  | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
|  | use ReflectionClass; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Base Structure of all Callback Structures |  * Base Structure of all Callback Structures | ||||||
| @@ -13,7 +13,7 @@ use ManiaControl\ManiaControl; | |||||||
|  * @copyright 2014-2017 ManiaControl Team |  * @copyright 2014-2017 ManiaControl Team | ||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| abstract class BaseStructure implements Dumpable { | abstract class BaseStructure { | ||||||
| 	/** @var ManiaControl $maniaControl */ | 	/** @var ManiaControl $maniaControl */ | ||||||
| 	protected $maniaControl; | 	protected $maniaControl; | ||||||
| 	private   $plainJsonObject; | 	private   $plainJsonObject; | ||||||
| @@ -31,10 +31,34 @@ abstract class BaseStructure implements Dumpable { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Var_Dump the Structure | 	 * Gets Information about the Class, and a List of the Public Method | ||||||
| 	 */ | 	 */ | ||||||
| 	public function dump() { | 	public function getUsage() { | ||||||
| 		var_dump(json_decode(json_encode($this))); | 		$reflection = new ReflectionClass(get_class($this)); | ||||||
| 		var_dump("Class Name including Namespace: " . get_class($this)); | 		echo $reflection->getDocComment(); | ||||||
|  |  | ||||||
|  | 		echo "\nStructure Name of Class = " . get_class($this); | ||||||
|  |  | ||||||
|  | 		echo "\nMethods:\n"; | ||||||
|  |  | ||||||
|  | 		$metody  = $reflection->getMethods(); | ||||||
|  | 		$methods = array_reverse($metody); | ||||||
|  | 		foreach ($methods as $key => $value) { | ||||||
|  | 			/** @var \ReflectionMethod $value */ | ||||||
|  | 			//Don't print the Constructor | ||||||
|  | 			if ($value->isPublic() && $value->getName() != "__construct" && $value->getName() != "getUsage") { | ||||||
|  | 				echo "\n\n"; | ||||||
|  | 				$txt = preg_replace('/\t/', '', $value->getDocComment()); | ||||||
|  |  | ||||||
|  | 				echo $txt; | ||||||
|  | 				echo "\n \$result = " . $value->getName() . "();"; | ||||||
|  | 				$parameters = $value->getParameters(); | ||||||
|  |  | ||||||
|  | 				foreach ($parameters as $parameter) { | ||||||
|  | 					echo "\n" . $parameter; | ||||||
|  | 				} | ||||||
|  | 				echo "\n"; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @@ -14,7 +14,7 @@ use ManiaControl\ManiaControl; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class StartEndStructure extends BaseStructure { | class StartEndStructure extends BaseStructure { | ||||||
| 	public $count; | 	private $count; | ||||||
|  |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, $data) { | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
| 		parent::__construct($maniaControl, $data); | 		parent::__construct($maniaControl, $data); | ||||||
| @@ -23,7 +23,9 @@ class StartEndStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 * Get the Count of this Section | ||||||
|  | 	 * | ||||||
|  | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getCount() { | 	public function getCount() { | ||||||
| 		return $this->count; | 		return $this->count; | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ use ManiaControl\ManiaControl; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class StartServerStructure extends BaseStructure { | class StartServerStructure extends BaseStructure { | ||||||
| 	public $restarted; | 	private $restarted; | ||||||
|  |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, $data) { | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
| 		parent::__construct($maniaControl, $data); | 		parent::__construct($maniaControl, $data); | ||||||
| @@ -23,6 +23,8 @@ class StartServerStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Flag if the Server got Restarted | ||||||
|  | 	 * | ||||||
| 	 * @return mixed | 	 * @return mixed | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getRestarted() { | 	public function getRestarted() { | ||||||
|   | |||||||
| @@ -10,14 +10,14 @@ class Landmark { | |||||||
| 	private $position = null; | 	private $position = null; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTag() { | 	public function getTag() { | ||||||
| 		return $this->tag; | 		return $this->tag; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @param mixed $tag | 	 * @param string $tag | ||||||
| 	 */ | 	 */ | ||||||
| 	public function setTag($tag) { | 	public function setTag($tag) { | ||||||
| 		$this->tag = $tag; | 		$this->tag = $tag; | ||||||
| @@ -52,14 +52,14 @@ class Landmark { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 * @return \ManiaControl\Callbacks\Structures\ShootMania\Models\Position | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getPosition() { | 	public function getPosition() { | ||||||
| 		return $this->position; | 		return $this->position; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @param mixed $position | 	 * @param \ManiaControl\Callbacks\Structures\ShootMania\Models\Position $position | ||||||
| 	 */ | 	 */ | ||||||
| 	public function setPosition(Position $position) { | 	public function setPosition(Position $position) { | ||||||
| 		$this->position = $position; | 		$this->position = $position; | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ use ManiaControl\Players\Player; | |||||||
|  */ |  */ | ||||||
| class OnCaptureStructure extends BaseStructure { | class OnCaptureStructure extends BaseStructure { | ||||||
|  |  | ||||||
| 	public  $time; | 	private $time; | ||||||
| 	private $landMark; | 	private $landMark; | ||||||
|  |  | ||||||
| 	private $playerArray = array(); | 	private $playerArray = array(); | ||||||
| @@ -44,23 +44,17 @@ class OnCaptureStructure extends BaseStructure { | |||||||
| 		$this->landMark->setPosition($position); | 		$this->landMark->setPosition($position); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		var_dump($this->landMark); |  | ||||||
| 		parent::dump(); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get the logins | 	 * Get the logins as Array | ||||||
| 	 * | 	 * | ||||||
| 	 * @return array | 	 * @return string[] | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getLoginArray() { | 	public function getLoginArray() { | ||||||
| 		return $this->playerArray; | 		return $this->playerArray; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get the players | 	 * Get the Players as Player Array | ||||||
| 	 * | 	 * | ||||||
| 	 * @return Player[] | 	 * @return Player[] | ||||||
| 	 */ | 	 */ | ||||||
| @@ -76,16 +70,11 @@ class OnCaptureStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return LandMark | 	 * Returns Information about the Captured Landmark | ||||||
|  | 	 * | ||||||
|  | 	 * @return \ManiaControl\Callbacks\Structures\ShootMania\Models\LandMark | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getLandMark() { | 	public function getLandMark() { | ||||||
| 		return $this->landMark; | 		return $this->landMark; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * @param mixed $landMark |  | ||||||
| 	 */ |  | ||||||
| 	public function setLandMark(Landmark $landMark) { |  | ||||||
| 		$this->landMark = $landMark; |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| @@ -14,9 +14,9 @@ use ManiaControl\ManiaControl; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnCommandStructure extends BaseStructure { | class OnCommandStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	public $name; | 	private $name; | ||||||
| 	public $value; | 	private $value; | ||||||
|  |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, $data) { | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
| 		parent::__construct($maniaControl, $data); | 		parent::__construct($maniaControl, $data); | ||||||
| @@ -26,13 +26,9 @@ class OnCommandStructure extends BaseStructure { | |||||||
| 		$this->value = $this->getPlainJsonObject()->value; | 		$this->value = $this->getPlainJsonObject()->value; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		parent::dump(); |  | ||||||
| 		var_dump("With getShooter() you get a Player Object"); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Server time when the event occured | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -40,14 +36,22 @@ class OnCommandStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 * < Name of the command | ||||||
|  | 	 * | ||||||
|  | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getName() { | 	public function getName() { | ||||||
| 		return $this->name; | 		return $this->name; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return \ManiaControl\Players\Player | 	 * < The value passed by the command | ||||||
|  | 	 * "boolean": true, | ||||||
|  | 	 * "integer": 123, | ||||||
|  | 	 * "real": 123.456, | ||||||
|  | 	 * "text": "an example value" | ||||||
|  | 	 * | ||||||
|  | 	 * @return mixed | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getValue() { | 	public function getValue() { | ||||||
| 		return $this->value; | 		return $this->value; | ||||||
|   | |||||||
| @@ -14,8 +14,8 @@ use ManiaControl\ManiaControl; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnDefaultEventStructure extends BaseStructure { | class OnDefaultEventStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	public $type; | 	private $type; | ||||||
|  |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, $data) { | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
| 		parent::__construct($maniaControl, $data); | 		parent::__construct($maniaControl, $data); | ||||||
| @@ -25,6 +25,8 @@ class OnDefaultEventStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Returns Server time when the event occured | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -32,6 +34,8 @@ class OnDefaultEventStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Returns the type of event | ||||||
|  | 	 * | ||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getType() { | 	public function getType() { | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ use ManiaControl\Players\Player; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnFallDamageStructure extends BaseStructure { | class OnFallDamageStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	/** | 	/** | ||||||
| 	 * @var Player $shooter | 	 * @var Player $shooter | ||||||
| 	 */ | 	 */ | ||||||
| @@ -29,6 +29,8 @@ class OnFallDamageStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Server time when the event occured | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -36,15 +38,12 @@ class OnFallDamageStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Player who fell | ||||||
|  | 	 * | ||||||
| 	 * @return Player | 	 * @return Player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getVictim() { | 	public function getVictim() { | ||||||
| 		return $this->victim; | 		return $this->victim; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		parent::dump(); |  | ||||||
| 		var_dump("With getVictim() you get a Player Object"); |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| @@ -17,15 +17,15 @@ use ManiaControl\Players\Player; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnHitNearMissArmorEmptyStructure extends BaseStructure { | class OnHitNearMissArmorEmptyStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	public $weapon; | 	private $weapon; | ||||||
| 	public $damage; | 	private $damage; | ||||||
| 	public $distance = 0; //Note no distance on the OnHit and ArmorEmpty yet | 	private $distance = 0; //Note no distance on the OnHit and ArmorEmpty yet | ||||||
|  |  | ||||||
| 	private $shooterPosition; | 	private $shooterPosition; | ||||||
| 	private $victimPosition; | 	private $victimPosition; | ||||||
| 	protected $shooter; | 	private $shooter; | ||||||
| 	protected $victim; | 	private $victim; | ||||||
|  |  | ||||||
| 	//private $shooterPoints; (was in mp3) | 	//private $shooterPoints; (was in mp3) | ||||||
| 	//private $hitDistance; (was in mp3) | 	//private $hitDistance; (was in mp3) | ||||||
| @@ -43,7 +43,7 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { | |||||||
| 		$jsonObj      = $this->getPlainJsonObject(); | 		$jsonObj      = $this->getPlainJsonObject(); | ||||||
| 		$this->time   = $jsonObj->time; | 		$this->time   = $jsonObj->time; | ||||||
| 		$this->weapon = $jsonObj->weapon; | 		$this->weapon = $jsonObj->weapon; | ||||||
| 		$this->damage = $jsonObj->damage; | 		$this->damage = $jsonObj->damage; //TODO does only exist on onhit -> make baseclass | ||||||
|  |  | ||||||
| 		$this->shooterPosition = new Position(); | 		$this->shooterPosition = new Position(); | ||||||
| 		$this->shooterPosition->setX($jsonObj->shooterposition->x); | 		$this->shooterPosition->setX($jsonObj->shooterposition->x); | ||||||
| @@ -63,18 +63,9 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { | |||||||
| 		$this->victim  = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->victim); | 		$this->victim  = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->victim); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		var_dump("Dump of property Shooter Position"); |  | ||||||
| 		var_dump($this->shooterPosition); |  | ||||||
| 		var_dump("Dump of property Victim Position"); |  | ||||||
| 		var_dump($this->victimPosition); |  | ||||||
| 		parent::dump(); |  | ||||||
| 		var_dump("With getShooter() you get a Player Object"); |  | ||||||
| 		var_dump("With getVictim() you get a Player Object"); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Server time when the event occured | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -82,6 +73,9 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Id of the weapon [1-Laser, 2-Rocket, 3-Nucleus, 5-Arrow] | ||||||
|  | 	 * | ||||||
|  | 	 * @see \ManiaControl\Callbacks\Structures\ShootMania\Models\Weapons | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getWeapon() { | 	public function getWeapon() { | ||||||
| @@ -89,6 +83,9 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Amount of Damage done by the hit (only on onHit) | ||||||
|  | 	 * TODO base class and extend properties) | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getDamage() { | 	public function getDamage() { | ||||||
| @@ -96,7 +93,7 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * TODO Position Object | 	 * < Position of the Shooter at the time | ||||||
| 	 * | 	 * | ||||||
| 	 * @return Position | 	 * @return Position | ||||||
| 	 */ | 	 */ | ||||||
| @@ -105,15 +102,17 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * TODO Position Object | 	 * < Position of the Victim at the time | ||||||
| 	 * | 	 * | ||||||
| 	 * @return Position | 	 * @return \ManiaControl\Callbacks\Structures\ShootMania\Models\Position | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getVictimPosition() { | 	public function getVictimPosition() { | ||||||
| 		return $this->victimPosition; | 		return $this->victimPosition; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Shooter Player | ||||||
|  | 	 * | ||||||
| 	 * @return Player | 	 * @return Player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getShooter() { | 	public function getShooter() { | ||||||
| @@ -121,6 +120,8 @@ class OnHitNearMissArmorEmptyStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Victim Player | ||||||
|  | 	 * | ||||||
| 	 * @return Player | 	 * @return Player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getVictim() { | 	public function getVictim() { | ||||||
|   | |||||||
| @@ -15,9 +15,9 @@ use ManiaControl\Players\Player; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnPlayerRequestRespawnStructure extends BaseStructure { | class OnPlayerRequestRespawnStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	/** | 	/** | ||||||
| 	 * @var Player $shooter | 	 * @var Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	private $player; | 	private $player; | ||||||
|  |  | ||||||
| @@ -26,9 +26,13 @@ class OnPlayerRequestRespawnStructure extends BaseStructure { | |||||||
|  |  | ||||||
| 		$this->time   = $this->getPlainJsonObject()->time; | 		$this->time   = $this->getPlainJsonObject()->time; | ||||||
| 		$this->player = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->login); | 		$this->player = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->login); | ||||||
|  |  | ||||||
|  | 		$this->getUsage(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Returns the Time the Event Happened | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -36,15 +40,11 @@ class OnPlayerRequestRespawnStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return Player | 	 * Gets the Player | ||||||
|  | 	 * | ||||||
|  | 	 * @return \ManiaControl\Players\Player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getPlayer() { | 	public function getPlayer() { | ||||||
| 		return $this->player; | 		return $this->player; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		parent::dump(); |  | ||||||
| 		var_dump("With getPlayer() you get a Player Object"); |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| @@ -6,7 +6,6 @@ namespace ManiaControl\Callbacks\Structures\ShootMania; | |||||||
| use ManiaControl\Callbacks\Structures\BaseStructure; | use ManiaControl\Callbacks\Structures\BaseStructure; | ||||||
| use ManiaControl\Callbacks\Structures\ShootMania\Models\TeamScore; | use ManiaControl\Callbacks\Structures\ShootMania\Models\TeamScore; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Players\Player; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Structure Class for the OnScores Structure Callback |  * Structure Class for the OnScores Structure Callback | ||||||
| @@ -16,13 +15,13 @@ use ManiaControl\Players\Player; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnScoresStructure extends BaseStructure { | class OnScoresStructure extends BaseStructure { | ||||||
| 	public  $responseId; | 	private $responseId; | ||||||
| 	public  $section; | 	private $section; | ||||||
| 	public  $useTeams; | 	private $useTeams; | ||||||
| 	public  $winnerTeam; | 	private $winnerTeam; | ||||||
| 	public  $winnerPlayer; | 	private $winnerPlayer; | ||||||
| 	private $teamScores = array(); | 	private $teamScores = array(); | ||||||
| 	public  $players; //TODO implement | 	private $players; //TODO implement | ||||||
|  |  | ||||||
| 	//TODO test | 	//TODO test | ||||||
| 	public function __construct(ManiaControl $maniaControl, $data) { | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
| @@ -51,36 +50,36 @@ class OnScoresStructure extends BaseStructure { | |||||||
| 		//TODO implement player | 		//TODO implement player | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		parent::dump(); |  | ||||||
| 		var_dump("With getWinnerPlayer() you get a Player Object"); |  | ||||||
| 		var_dump($this->teamScores); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return Player | 	 * Get the Winner Player Object | ||||||
|  | 	 * | ||||||
|  | 	 * @return \ManiaControl\Players\Player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getWinnerPlayer() { | 	public function getWinnerPlayer() { | ||||||
| 		return $this->winnerPlayer; | 		return $this->winnerPlayer; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 * Get the Response Id | ||||||
|  | 	 * | ||||||
|  | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getResponseId() { | 	public function getResponseId() { | ||||||
| 		return $this->responseId; | 		return $this->responseId; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 *  < Current progress of the match. Can be "" | "EndRound" | "EndMap" | "EndMatch" | ||||||
|  | 	 * | ||||||
|  | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getSection() { | 	public function getSection() { | ||||||
| 		return $this->section; | 		return $this->section; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Returns if the GameMode uses Teams or not | ||||||
|  | 	 * | ||||||
| 	 * @return boolean | 	 * @return boolean | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getUseTeams() { | 	public function getUseTeams() { | ||||||
| @@ -88,13 +87,17 @@ class OnScoresStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Get the Winner Team Id | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getWinnerTeam() { | 	public function getWinnerTeamId() { | ||||||
| 		return $this->winnerTeam; | 		return $this->winnerTeam; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Returns the TeamScores | ||||||
|  | 	 * | ||||||
| 	 * @return TeamScore[] | 	 * @return TeamScore[] | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTeamScores() { | 	public function getTeamScores() { | ||||||
| @@ -102,6 +105,8 @@ class OnScoresStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Get The Player Scores | ||||||
|  | 	 * | ||||||
| 	 * @return mixed | 	 * @return mixed | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getPlayers() { | 	public function getPlayers() { | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ class OnShootStructure extends BaseStructure { | |||||||
| 		$this->weapon  = $this->getPlainJsonObject()->weapon; | 		$this->weapon  = $this->getPlainJsonObject()->weapon; | ||||||
|  |  | ||||||
| 		$this->shooter = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->shooter); | 		$this->shooter = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->shooter); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -5,7 +5,6 @@ namespace ManiaControl\Callbacks\Structures\ShootMania; | |||||||
|  |  | ||||||
| use ManiaControl\Callbacks\Structures\BaseStructure; | use ManiaControl\Callbacks\Structures\BaseStructure; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Players\Player; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -16,12 +15,12 @@ use ManiaControl\Players\Player; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnShotDenyStructure extends BaseStructure { | class OnShotDenyStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	public $shooterWeapon; | 	private $shooterWeapon; | ||||||
| 	public $victimWeapon; | 	private $victimWeapon; | ||||||
|  |  | ||||||
| 	protected $shooter; | 	private $shooter; | ||||||
| 	protected $victim; | 	private $victim; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Construct a new On Hit Structure | 	 * Construct a new On Hit Structure | ||||||
| @@ -41,14 +40,9 @@ class OnShotDenyStructure extends BaseStructure { | |||||||
| 		$this->victim  = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->victim); | 		$this->victim  = $this->maniaControl->getPlayerManager()->getPlayer($this->getPlainJsonObject()->victim); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		parent::dump(); |  | ||||||
| 		var_dump("With getShooter() you get a Player Object"); |  | ||||||
| 		var_dump("With getVictim() you get a Player Object"); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * ServerTime The Event Happened //TODO add Trait for the Time Property | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -57,14 +51,18 @@ class OnShotDenyStructure extends BaseStructure { | |||||||
|  |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return Player | 	 * Gets the Shooter Player | ||||||
|  | 	 * | ||||||
|  | 	 * @return \ManiaControl\Players\Player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getShooter() { | 	public function getShooter() { | ||||||
| 		return $this->shooter; | 		return $this->shooter; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return Player | 	 * Gets the Victim Player | ||||||
|  | 	 * | ||||||
|  | 	 * @return \ManiaControl\Players\Player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getVictim() { | 	public function getVictim() { | ||||||
| 		return $this->victim; | 		return $this->victim; | ||||||
| @@ -78,7 +76,10 @@ class OnShotDenyStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 * Get the Victim Weapon | ||||||
|  | 	 * | ||||||
|  | 	 * @see \ManiaControl\Callbacks\Structures\ShootMania\Models\Weapons | ||||||
|  | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getVictimWeapon() { | 	public function getVictimWeapon() { | ||||||
| 		return $this->victimWeapon; | 		return $this->victimWeapon; | ||||||
|   | |||||||
| @@ -14,9 +14,9 @@ use ManiaControl\ManiaControl; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnCommandStructure extends BaseStructure { | class OnCommandStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	public $name; | 	private $name; | ||||||
| 	public $value; | 	private $value; | ||||||
|  |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, $data) { | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
| 		parent::__construct($maniaControl, $data); | 		parent::__construct($maniaControl, $data); | ||||||
| @@ -26,13 +26,9 @@ class OnCommandStructure extends BaseStructure { | |||||||
| 		$this->value = $this->getPlainJsonObject()->value; | 		$this->value = $this->getPlainJsonObject()->value; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Dumps the Object with some Information */ |  | ||||||
| 	public function dump() { |  | ||||||
| 		parent::dump(); |  | ||||||
| 		var_dump("With getShooter() you get a Player Object"); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * < Server time when the event occured | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -40,18 +36,24 @@ class OnCommandStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return mixed | 	 * < Name of the command | ||||||
|  | 	 * | ||||||
|  | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getName() { | 	public function getName() { | ||||||
| 		return $this->name; | 		return $this->name; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @return \ManiaControl\Players\Player | 	 * < The value passed by the command | ||||||
|  | 	 * "boolean": true, | ||||||
|  | 	 * "integer": 123, | ||||||
|  | 	 * "real": 123.456, | ||||||
|  | 	 * "text": "an example value" | ||||||
|  | 	 * | ||||||
|  | 	 * @return mixed | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getValue() { | 	public function getValue() { | ||||||
| 		return $this->value; | 		return $this->value; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -14,8 +14,8 @@ use ManiaControl\ManiaControl; | |||||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class OnDefaultEventStructure extends BaseStructure { | class OnDefaultEventStructure extends BaseStructure { | ||||||
| 	public $time; | 	private $time; | ||||||
| 	public $type; | 	private $type; | ||||||
|  |  | ||||||
| 	public function __construct(ManiaControl $maniaControl, $data) { | 	public function __construct(ManiaControl $maniaControl, $data) { | ||||||
| 		parent::__construct($maniaControl, $data); | 		parent::__construct($maniaControl, $data); | ||||||
| @@ -25,6 +25,8 @@ class OnDefaultEventStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Returns Server time when the event occured | ||||||
|  | 	 * | ||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getTime() { | 	public function getTime() { | ||||||
| @@ -32,6 +34,8 @@ class OnDefaultEventStructure extends BaseStructure { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|  | 	 * Returns the type of event | ||||||
|  | 	 * | ||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getType() { | 	public function getType() { | ||||||
|   | |||||||
| @@ -29,6 +29,8 @@ class CallbacksListStructure extends BaseStructure { | |||||||
|  |  | ||||||
| 		$this->responseId = $this->getPlainJsonObject()->responseid; | 		$this->responseId = $this->getPlainJsonObject()->responseid; | ||||||
| 		$this->callbacks  = $this->getPlainJsonObject()->callbacks; | 		$this->callbacks  = $this->getPlainJsonObject()->callbacks; | ||||||
|  |  | ||||||
|  | 		$this->getUsage(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user