Merge branch 'release/3.2'

This commit is contained in:
Dylan K. Taylor 2018-07-21 09:53:50 +01:00
commit bfc372c6fb
2 changed files with 7 additions and 19 deletions

View File

@ -62,15 +62,7 @@ class KillCommand extends VanillaCommand{
$player = $sender->getServer()->getPlayer($args[0]); $player = $sender->getServer()->getPlayer($args[0]);
if($player instanceof Player){ if($player instanceof Player){
$sender->getServer()->getPluginManager()->callEvent($ev = new EntityDamageEvent($player, EntityDamageEvent::CAUSE_SUICIDE, 1000)); $player->attack(new EntityDamageEvent($player, EntityDamageEvent::CAUSE_SUICIDE, 1000));
if($ev->isCancelled()){
return true;
}
$player->setLastDamageCause($ev);
$player->setHealth(0);
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.kill.successful", [$player->getName()])); Command::broadcastCommandMessage($sender, new TranslationContainer("commands.kill.successful", [$player->getName()]));
}else{ }else{
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.player.notFound")); $sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.player.notFound"));
@ -86,14 +78,7 @@ class KillCommand extends VanillaCommand{
return true; return true;
} }
$sender->getServer()->getPluginManager()->callEvent($ev = new EntityDamageEvent($sender, EntityDamageEvent::CAUSE_SUICIDE, 1000)); $sender->attack(new EntityDamageEvent($sender, EntityDamageEvent::CAUSE_SUICIDE, 1000));
if($ev->isCancelled()){
return true;
}
$sender->setLastDamageCause($ev);
$sender->setHealth(0);
$sender->sendMessage(new TranslationContainer("commands.kill.successful", [$sender->getName()])); $sender->sendMessage(new TranslationContainer("commands.kill.successful", [$sender->getName()]));
}else{ }else{
throw new InvalidCommandSyntaxException(); throw new InvalidCommandSyntaxException();

View File

@ -86,8 +86,11 @@ class ZippedResourcePack implements ResourcePack{
$archive->close(); $archive->close();
$manifest = json_decode($manifestData); $manifest = json_decode($manifestData);
if($manifest === null or !self::verifyManifest($manifest)){ if($manifest === null){
throw new ResourcePackException("manifest.json is invalid or incomplete"); throw new ResourcePackException("Failed to parse manifest.json: " . json_last_error_msg());
}
if(!self::verifyManifest($manifest)){
throw new ResourcePackException("manifest.json is missing required fields");
} }
$this->manifest = $manifest; $this->manifest = $manifest;