本文整理汇总了Java中org.bukkit.entity.LightningStrike类的典型用法代码示例。如果您正苦于以下问题:Java LightningStrike类的具体用法?Java LightningStrike怎么用?Java LightningStrike使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LightningStrike类属于org.bukkit.entity包,在下文中一共展示了LightningStrike类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: strike
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
public LightningStrike strike(Location loc, boolean effect) {
BaseFullChunk chunk = nukkit.getChunk(loc.getChunk().getX(), loc.getChunk().getZ());
int x = loc.getBlockX();
int z = loc.getBlockZ();
int y = loc.getBlockY();
int bId = nukkit.getBlockIdAt(x, y, z);
if (bId != cn.nukkit.block.Block.TALL_GRASS && bId != cn.nukkit.block.Block.WATER)
y += 1;
CompoundTag nbt = new CompoundTag()
.putList(new ListTag<DoubleTag>("Pos").add(new DoubleTag("", x))
.add(new DoubleTag("", y)).add(new DoubleTag("", z)))
.putList(new ListTag<DoubleTag>("Motion").add(new DoubleTag("", 0))
.add(new DoubleTag("", 0)).add(new DoubleTag("", 0)))
.putList(new ListTag<FloatTag>("Rotation").add(new FloatTag("", 0))
.add(new FloatTag("", 0)));
EntityLightning bolt = new EntityLightning(chunk, nbt);
bolt.setEffect(effect);
bolt.spawnToAll();
return PokkitEntityLightningStrike.toBukkit(bolt);
}
示例2: toBukkit
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
public static LightningStrike toBukkit(cn.nukkit.entity.Entity nukkit) {
if (nukkit == null) {
return null;
}
if (!(nukkit instanceof EntityLightningStrike)) {
return null;
}
return new PokkitEntityLightningStrike(nukkit);
}
示例3: strikeLightning
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@Override
public LightningStrike strikeLightning(final Location loc) {
return TaskManager.IMP.sync(new RunnableVal<LightningStrike>() {
@Override
public void run(LightningStrike value) {
this.value = parent.strikeLightning(loc);
}
});
}
示例4: strikeLightningEffect
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@Override
public LightningStrike strikeLightningEffect(final Location loc) {
return TaskManager.IMP.sync(new RunnableVal<LightningStrike>() {
@Override
public void run(LightningStrike value) {
this.value = parent.strikeLightningEffect(loc);
}
});
}
示例5: canDodge
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
public boolean canDodge(Entity damager) {
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DODGE)) {
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
return false;
}
return skill.shouldProcess(damager);
}
return false;
}
示例6: onPlayerDeath
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onPlayerDeath(EntityDamageByEntityEvent event) {
if (event.getEntity() instanceof Player &&
event.getDamager() instanceof LightningStrike &&
strikeID.containsKey(event.getDamager().getEntityId()) &&
((Player)event.getEntity()).getHealth() - event.getDamage() <= 0 &&
Bukkit.getServer().getPlayer(strikeID.get(event.getDamager().getEntityId())) != null) {
event.setCancelled(true);
((Player)event.getEntity()).damage(event.getDamage(), Bukkit.getPlayer(strikeID.get(event.getDamager().getEntityId())));
}
}
示例7: onEntityDamageByEntity
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (event.getEntity() instanceof Player &&
event.getDamager() instanceof LightningStrike &&
strikeID.containsKey(event.getDamager().getEntityId()) &&
strikeID.get(event.getDamager().getEntityId()).equalsIgnoreCase(((Player) event.getEntity()).getName()))
event.setCancelled(true);
}
示例8: onPlayerDeathByLightning
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onPlayerDeathByLightning(EntityDamageByEntityEvent event) {
if (event.getEntity() instanceof Player &&
event.getDamager() instanceof LightningStrike &&
strikeID.containsKey(event.getDamager().getEntityId()) &&
((Player)event.getEntity()).getHealth() - event.getDamage() <= 0 &&
Bukkit.getServer().getPlayer(strikeID.get(event.getDamager().getEntityId())) != null) {
event.setCancelled(true);
((Player)event.getEntity()).damage(event.getDamage(), Bukkit.getPlayer(strikeID.get(event.getDamager().getEntityId())));
}
}
示例9: onEntityDamageByLightning
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@EventHandler
public void onEntityDamageByLightning(EntityDamageByEntityEvent event) {
if (event.getEntity() instanceof Player &&
event.getDamager() instanceof LightningStrike &&
strikeID.containsKey(event.getDamager().getEntityId()) &&
strikeID.get(event.getDamager().getEntityId()).equalsIgnoreCase(((Player) event.getEntity()).getName()))
event.setCancelled(true);
}
示例10: strikeLightning
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
public LightningStrike strikeLightning(Location loc) {
net.minecraft.entity.effect.EntityLightningBolt lightning = new net.minecraft.entity.effect.EntityLightningBolt(world, loc.getX(), loc.getY(), loc.getZ());
world.addWeatherEffect(lightning);
return new CraftLightningStrike(server, lightning);
}
示例11: strikeLightningEffect
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
public LightningStrike strikeLightningEffect(Location loc) {
net.minecraft.entity.effect.EntityLightningBolt lightning = new net.minecraft.entity.effect.EntityLightningBolt(world, loc.getX(), loc.getY(), loc.getZ(), true);
world.addWeatherEffect(lightning);
return new CraftLightningStrike(server, lightning);
}
示例12: callPigZapEvent
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
public static PigZapEvent callPigZapEvent(net.minecraft.entity.Entity pig, net.minecraft.entity.Entity lightning, net.minecraft.entity.Entity pigzombie) {
PigZapEvent event = new PigZapEvent((Pig) pig.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), (PigZombie) pigzombie.getBukkitEntity());
pig.getBukkitEntity().getServer().getPluginManager().callEvent(event);
return event;
}
示例13: callCreeperPowerEvent
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
public static CreeperPowerEvent callCreeperPowerEvent(net.minecraft.entity.Entity creeper, net.minecraft.entity.Entity lightning, CreeperPowerEvent.PowerCause cause) {
CreeperPowerEvent event = new CreeperPowerEvent((Creeper) creeper.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), cause);
creeper.getBukkitEntity().getServer().getPluginManager().callEvent(event);
return event;
}
示例14: strikeLightning
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@Override
public LightningStrike strikeLightning(Location loc)
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例15: strikeLightningEffect
import org.bukkit.entity.LightningStrike; //导入依赖的package包/类
@Override
public LightningStrike strikeLightningEffect(Location loc)
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}