Throw invalid event exception when a plugin tries to declare an abstract event

This commit is contained in:
Shoghi Cervantes 2014-08-15 16:15:12 +02:00
parent 2f9494ed52
commit 31b92b392e
2 changed files with 2 additions and 2 deletions

View File

@ -2008,7 +2008,7 @@ class Server{
$this->scheduler->scheduleAsyncTask($this->lastSendUsage);
}
public function titleTick(){
private function titleTick(){
if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and \pocketmine\ANSI === true){
echo "\x1b]0;PocketMine-MP " . $this->getPocketMineVersion() . " | Online " . count($this->players) . "/" . $this->getMaxPlayers() . " | RAM " . round((memory_get_usage() / 1024) / 1024, 2) . "/" . round((memory_get_usage(true) / 1024) / 1024, 2) . " MB | U ". round($this->mainInterface->getUploadUsage() / 1024, 2) ." D ". round($this->mainInterface->getDownloadUsage() / 1024, 2) ." kB/s | TPS " . $this->getTicksPerSecond() . "\x07";
}

View File

@ -704,7 +704,7 @@ class PluginManager{
* @throws \Exception
*/
public function registerEvent($event, Listener $listener, $priority, EventExecutor $executor, Plugin $plugin, $ignoreCancelled = false){
if(!is_subclass_of($event, "pocketmine\\event\\Event")){
if(!is_subclass_of($event, "pocketmine\\event\\Event") or (new \ReflectionClass($event))->isAbstract()){
throw new \Exception($event . " is not a valid Event");
}