Last active
October 19, 2015 10:26
-
-
Save haniokasai/f4c74bd11baf054a6623 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pocketmine-mpのプラグインのサンプルコード集です。 | |
http://blog.haniokasai.com/2015/10/pocketmine-mp.html | |
ここのソースは肉なり焼くなり好きにしてください。 | |
プレイヤーが殺した時お金をもらう。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use pocketmine\Player; | |
use pocketmine\event\player\PlayerDeathEvent; | |
public function deathdesu(PlayerDeathEvent $event){ | |
if($event->getEntity()->getLastDamageCause() instanceof EntityDamageByEntityEvent){ | |
$player = $event->getEntity(); | |
if ($player instanceof Player){ | |
$killer =$event->getEntity()->getLastDamageCause()->getDamager(); | |
$killername = $killer->getName();//殺した人 | |
$shinda =$event->getEntity();//殺されたプレイヤー | |
$shindaname = $event->getEntity()->getName(); | |
$this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->addMoney($killername,1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment