本文整理汇总了PHP中pocketmine\Player::addEffect方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::addEffect方法的具体用法?PHP Player::addEffect怎么用?PHP Player::addEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::addEffect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onEffect
private function onEffect(Player $laeng)
{
$g = 0;
while ($g > 0) {
switch (mt_rand(1, 14)) {
case 1:
$g = 1;
break;
case 3:
$g = 3;
break;
case 5:
$g = 5;
break;
case 8:
$g = 8;
break;
case 10:
$g = 10;
break;
case 11:
$g = 11;
break;
case 12:
$g = 12;
break;
case 13:
$g = 13;
break;
case 14:
$g = 14;
break;
default:
$g = 0;
break;
}
}
$laeng->addEffect(Effect::getEffect($g)->setDuration($this->setting->get("rb-effect-timer"))->setAmplifier(1));
}
示例2: addEffect
/**
* /effect <player> <effect> [seconds] [amplifier] [hideParticles]
*
* @param Player $player
* @param $effectType
* @param int $duration
* @param int $amplification
* @param bool $hiderParticles
* @return true
*/
public static function addEffect(Player $player, $effectType, $duration = 300, $amplification = 0, $hiderParticles = false)
{
$effect = Effect::getEffectByName($effectType);
if ($effect === null) {
$effect = Effect::getEffect((int) $effectType);
}
// $duration = 300;
$amplification = 0;
if ($hiderParticles) {
$effect->setVisible(\false);
}
$effect->setDuration($duration)->setAmplifier($amplification);
$player->addEffect($effect);
return $effect;
}
示例3: giveEffect
public function giveEffect($e, Player $p)
{
$effect = Effect::getEffect($e);
if ($e === 1) {
$effect->setAmplifier(9);
} else {
$effect->setAmplifier(1);
}
$effect->setDuration(9999999999.0);
$effect->setVisible(false);
$p->addEffect($effect);
}
示例4: initialEntity
public function initialEntity(Player $player)
{
assert($player->namedtag instanceof CompoundTag);
if (isset($player->namedtag->ActiveEffects)) {
foreach ($player->namedtag->ActiveEffects->getValue() as $e) {
$effect = Effect::getEffect($e["Id"]);
if ($effect === null) {
continue;
}
$effect->setAmplifier($e["Amplifier"])->setDuration($e["Duration"])->setVisible($e["ShowParticles"] > 0);
$player->addEffect($effect);
}
}
if (isset($player->namedtag->CustomName)) {
$player->setNameTag($player->namedtag["CustomName"]);
if (isset($player->namedtag->CustomNameVisible)) {
$player->setNameTagVisible($this->namedtag["CustomNameVisible"] > 0);
}
}
$player->scheduleUpdate();
}
示例5: giveEffect
public function giveEffect(Player $player)
{
$player->addEffect(Effect::getEffect(Effect::SPEED)->setAmplifier(3)->setDuration(30000));
if (GameGenius::$GIVE_JUMP_SPELL) {
$player->addEffect(Effect::getEffect(Effect::JUMP)->setAmplifier(3)->setDuration(30000));
}
}
示例6: Receive
public function Receive(Player $p)
{
if ($p->hasPermission("finejoineffects.player")) {
$cg = $this->getConfig();
$jnmsg = $cg->get("Enable-Message-With-Join");
$eft1 = $cg->get("Effect-1-Type");
$dtn1 = $cg->get("Effect-1-Duration");
$eft2 = $cg->get("Effect-2-Type");
$dtn2 = $cg->get("Effect-2-Duration");
$eft3 = $cg->get("Effect-3-Type");
$dtn3 = $cg->get("Effect-3-Duration");
$eft4 = $cg->get("Effect-4-Type");
$dtn4 = $cg->get("Effect-4-Duration");
$eft5 = $cg->get("Effect-5-Type");
$dtn5 = $cg->get("Effect-5-Duration");
$amp1 = $cg->get("Effect-1-Amplifier");
$amp2 = $cg->get("Effect-2-Amplifier");
$amp3 = $cg->get("Effect-3-Amplifier");
$amp4 = $cg->get("Effect-4-Amplifier");
$amp5 = $cg->get("Effect-5-Amplifier");
$enb2 = $cg->get("Enable-2-Effect");
$enb3 = $cg->get("Enable-3-Effect");
$enb4 = $cg->get("Enable-4-Effect");
$enb5 = $cg->get("Enable-5-Effect");
$msg = $cg->get("Message-With-Effects");
$effect = Effect::getEffect($eft1);
$effect->setVisible(true);
$effect->setDuration($dtn1)->setAmplifier($amp1);
$p->addEffect($effect);
if ($enb2 == true) {
$effect = Effect::getEffect($eft2);
$effect->setVisible(true);
$effect->setDuration($dtn2)->setAmplifier($amp2);
$p->addEffect($effect);
}
if ($enb3 == true) {
$effect = Effect::getEffect($eft3);
$effect->setVisible(true);
$effect->setDuration($dtn3)->setAmplifier($amp3);
$p->addEffect($effect);
}
if ($enb4 == true) {
$effect = Effect::getEffect($eft4);
$effect->setVisible(true);
$effect->setDuration($dtn4)->setAmplifier($amp4);
$p->addEffect($effect);
}
if ($enb5 == true) {
$effect = Effect::getEffect($eft5);
$effect->setVisible(true);
$effect->setDuration($dtn5)->setAmplifier($amp5);
$p->addEffect($effect);
}
if ($jnmsg == true) {
$p->sendMessage("§l§b[FineJoinEffect]§a {$msg}");
}
}
if ($p->hasPermission("finejoineffects.vip")) {
$cg = $this->getConfig();
$p = $event->getPlayer();
$jnmsgv = $cg->get("Enable-Message-With-VIP-Join");
$eft1v = $cg->get("Effect-1-VIP-Type");
$dtn1v = $cg->get("Effect-1-VIP-Duration");
$eft2v = $cg->get("Effect-2-VIP-Type");
$dtn2v = $cg->get("Effect-2-VIP-Duration");
$eft3v = $cg->get("Effect-3-VIP-Type");
$dtn3v = $cg->get("Effect-3-VIP-Duration");
$eft4v = $cg->get("Effect-4-VIP-Type");
$dtn4v = $cg->get("Effect-4-VIP-Duration");
$eft5v = $cg->get("Effect-5-VIP-Type");
$dtn5v = $cg->get("Effect-5-VIP-Duration");
$amp1v = $cg->get("Effect-1-VIP-Amplifier");
$amp2v = $cg->get("Effect-2-VIP-Amplifier");
$amp3v = $cg->get("Effect-3-VIP-Amplifier");
$amp4v = $cg->get("Effect-4-VIP-Amplifier");
$amp5v = $cg->get("Effect-5-VIP-Amplifier");
$enb2v = $cg->get("Enable-2-VIP-Effect");
$enb3v = $cg->get("Enable-3-VIP-Effect");
$enb4v = $cg->get("Enable-4-VIP-Effect");
$enb5v = $cg->get("Enable-5-VIP-Effect");
$msgv = $cg->get("Message-With-VIP-Effects");
$effect = Effect::getEffect($eft1v);
$effect->setVisible(true);
$effect->setDuration($dtn1v)->setAmplifier($amp1v);
$p->addEffect($effect);
if ($enb2v == true) {
$effect = Effect::getEffect($eft2v);
$effect->setVisible(true);
$effect->setDuration($dtn2v)->setAmplifier($amp2v);
$p->addEffect($effect);
}
if ($enb3v == true) {
$effect = Effect::getEffect($eft3v);
$effect->setVisible(true);
$effect->setDuration($dtn3v)->setAmplifier($amp3v);
$p->addEffect($effect);
}
if ($enb4v == true) {
$effect = Effect::getEffect($eft4v);
$effect->setVisible(true);
//.........这里部分代码省略.........
开发者ID:GoneTone,项目名称:Chinese-Traditional-Translations-For-PocketMine-MP-Plugins,代码行数:101,代码来源:FineJoinEffects.php
示例7: giveEffects
/**
*
* @param Player $player
*/
public function giveEffects(Player $player)
{
$effects = $this->getEffects();
foreach ($effects as $effect) {
$player->addEffect($effect);
}
}