本文整理汇总了Java中org.bukkit.event.entity.EntityCombustByEntityEvent类的典型用法代码示例。如果您正苦于以下问题:Java EntityCombustByEntityEvent类的具体用法?Java EntityCombustByEntityEvent怎么用?Java EntityCombustByEntityEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityCombustByEntityEvent类属于org.bukkit.event.entity包,在下文中一共展示了EntityCombustByEntityEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEntityCombust
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = false)
public void onEntityCombust(cn.nukkit.event.entity.EntityCombustEvent event) {
if (canIgnore(EntityCombustEvent.getHandlerList())) {
return;
}
// EntityCombustEvent and EntityCombustBy*Event share their handler
// lists. So this method can also be called with the event parameter set
// to an EntityCombustByEntityEvent or EntityCombustByBlockEvent. In that
// case, the event translation is a bit more involved.
if (event instanceof cn.nukkit.event.entity.EntityCombustByEntityEvent) {
onEntityCombustByEntity((cn.nukkit.event.entity.EntityCombustByEntityEvent) event);
return;
}
if (event instanceof cn.nukkit.event.entity.EntityCombustByBlockEvent) {
onEntityCombustByBlock((cn.nukkit.event.entity.EntityCombustByBlockEvent) event);
return;
}
EntityCombustEvent bukkitEvent = new EntityCombustEvent(PokkitEntity.toBukkit(event.getEntity()), event.getDuration());
callCancellable(event, bukkitEvent);
event.setDuration(bukkitEvent.getDuration());
}
示例2: n
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
public boolean n(Entity entity) {
boolean flag = super.n(entity);
if (flag) {
int i = this.world.difficulty.a();
if (this.be() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) {
// CraftBukkit start
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entity.setOnFire(event.getDuration());
}
// CraftBukkit end
}
}
return flag;
}
示例3: m
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
public boolean m(Entity entity) {
boolean flag = super.m(entity);
if (flag && this.aZ() == null && this.isBurning() && this.random.nextFloat() < (float) this.world.difficulty * 0.3F) {
// CraftBukkit start
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * this.world.difficulty);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entity.setOnFire(event.getDuration());
}
// CraftBukkit end
}
return flag;
}
示例4: onEntityCombustByEntity
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
EntityDamageByEntityEvent eventChange = null;
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) {
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
EntityDamageEvent.DamageCause.FIRE_TICK, (double)event.getDuration());
} else {
try {
Constructor<EntityDamageByEntityEvent> constructor = EntityDamageByEntityEvent.class.getConstructor(Entity.class,
Entity.class, EntityDamageEvent.DamageCause.class, Integer.TYPE);
eventChange = constructor.newInstance(event.getCombuster(), event.getEntity(),
EntityDamageEvent.DamageCause.FIRE_TICK, event.getDuration());
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
e.printStackTrace();
}
}
if (eventChange == null) {
return;
}
onEntityDamageByEntityEvent(eventChange);
if (eventChange.isCancelled()) {
event.setCancelled(true);
}
}
示例5: attackEntityAsMob
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
public boolean attackEntityAsMob(Entity p_70652_1_)
{
boolean flag = super.attackEntityAsMob(p_70652_1_);
if (flag)
{
int i = this.worldObj.difficultySetting.getDifficultyId();
if (this.getHeldItem() == null && this.isBurning() && this.rand.nextFloat() < (float)i * 0.3F)
{
// CraftBukkit start
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), p_70652_1_.getBukkitEntity(), 2 * i);
this.worldObj.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled())
{
p_70652_1_.setFire(event.getDuration());
}
// CraftBukkit end
}
}
return flag;
}
示例6: B
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
public boolean B(Entity entity) {
boolean flag = super.B(entity);
if (flag) {
int i = this.world.getDifficulty().a();
if (this.getItemInMainHand() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) {
// CraftBukkit start
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entity.setOnFire(event.getDuration());
}
// CraftBukkit end
}
}
return flag;
}
示例7: m
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
public boolean m(Entity entity) {
boolean flag = super.m(entity);
if (flag && this.bG() == null && this.isBurning() && this.random.nextFloat() < (float) this.world.difficulty * 0.3F) {
// CraftBukkit start
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * this.world.difficulty);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entity.setOnFire(event.getDuration());
}
// CraftBukkit end
}
return flag;
}
示例8: onCombust
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onCombust(final EntityCombustEvent event) {
cancelUnlessInteracting(event, event.getEntity());
if(event instanceof EntityCombustByEntityEvent) {
cancelUnlessInteracting(event, ((EntityCombustByEntityEvent) event).getCombuster());
}
}
示例9: onIgnition
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onIgnition(EntityCombustByEntityEvent event) {
MatchPlayer victim = getVictim(event.getEntity());
if(victim == null) return;
processDamageEvent(event, victim.getParticipantState(),
damageResolver.resolveDamage(EntityDamageEvent.DamageCause.FIRE, event.getEntity(), event.getCombuster()));
}
示例10: onEntityIgnite
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityIgnite(EntityCombustByEntityEvent event) {
if(event.getDuration() == 0) return;
FireInfo info = resolveBurning(event.getCombuster());
if(info != null) {
// First, try to resolve the player who ignited the combuster
info = new FireInfo(new EntityInfo(event.getCombuster(), info.getOwner()));
} else {
// If an igniter is not found, fall back to the owner of the entity
info = new FireInfo(entities.resolveEntity(event.getCombuster()));
}
burningEntities.put(event.getEntity(), info);
}
示例11: onCombust
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
/**
* Triggers when something combusts in the world.
*
* @param event
* The event being fired.
* @author HomieDion
* @since 1.1.0
*/
@EventHandler(ignoreCancelled = true)
public void onCombust(final EntityCombustEvent event) {
// Ignore if this is caused by an event lower down the chain.
if (event instanceof EntityCombustByEntityEvent || event instanceof EntityCombustByBlockEvent) {
return;
}
// Variables
final EntityType type = event.getEntityType();
final World world = event.getEntity().getWorld();
// Ignore world's without sunlight
if (world.getEnvironment() != Environment.NORMAL) {
return;
}
// Ignore disabled worlds
if (settings.isDisabledWorld(world)) {
return;
}
// Ignore someone without sunscreen
if (!settings.hasSunscreen(type)) {
return;
}
// Prevent the target from burning.
event.setCancelled(true);
}
示例12: onEntityCombustByEntity
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@EventHandler
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
if (Variables.friendlyfire_enable
&& event.getEntity() instanceof Player
&& event.getCombuster() instanceof Projectile
&& ((Projectile) event.getCombuster()).getShooter() instanceof Player) {
Player victim = (Player) event.getEntity();
Player attacker = (Player)((Projectile) event.getCombuster()).getShooter();
// Found right attacker
if (!victim.getUniqueId().equals(attacker.getUniqueId())
&& (Variables.friendlyfire_listworlds.contains("*")
|| Variables.friendlyfire_listworlds.contains(victim.getWorld().getName()))) {
// Friendly fire not allowed here
ThePlayer tpVictim = plugin.getPlayerHandler().getPlayer(victim.getUniqueId());
ThePlayer tpAttacker = plugin.getPlayerHandler().getPlayer(attacker.getUniqueId());
if (!tpVictim.getPartyName().isEmpty() && tpVictim.getPartyName().equalsIgnoreCase(tpAttacker.getPartyName())) {
// Calling API event
PartiesCombustFriendlyFireBlockedEvent partiesFriendlyFireEvent = new PartiesCombustFriendlyFireBlockedEvent(victim, attacker, event);
Bukkit.getServer().getPluginManager().callEvent(partiesFriendlyFireEvent);
if (!partiesFriendlyFireEvent.isCancelled()) {
// Friendly fire confirmed
Party party = plugin.getPartyHandler().getParty(tpVictim.getPartyName());
tpAttacker.sendMessage(Messages.canthitmates);
party.sendFriendlyFireWarn(tpVictim, tpAttacker);
event.setCancelled(true);
LogHandler.log(LogLevel.DEBUG, "Denied PvP friendly fire [Entity combust] between A:'" + attacker.getName() + "' and V:'" + victim.getName() + "'", true);
} else
LogHandler.log(LogLevel.DEBUG, "PartiesCombustFriendlyFireBlockedEvent is cancelled, ignoring [Entity combust] between A:'" + attacker.getName() + "' and V:'" + victim.getName() + "'", true);
}
}
}
}
示例13: onEntityCombustByEntity
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityCombustByEntity (EntityCombustByEntityEvent event)
{
//handle it just like we would an entity damge by entity event, except don't send player messages to avoid double messages
//in cases like attacking with a flame sword or flame arrow, which would ALSO trigger the direct damage event handler
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent eventWrapper = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), DamageCause.FIRE_TICK, event.getDuration());
this.handleEntityDamageEvent(eventWrapper, false);
event.setCancelled(eventWrapper.isCancelled());
}
示例14: onEntityCombustByEntity
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
private void onEntityCombustByEntity(cn.nukkit.event.entity.EntityCombustByEntityEvent event) {
// Called by onEntityCombust, so don't use an @EventHandler annotation
EntityCombustByEntityEvent bukkitEvent = new EntityCombustByEntityEvent(
PokkitEntity.toBukkit(event.getCombuster()),
PokkitEntity.toBukkit(event.getEntity()),
event.getDuration());
callCancellable(event, bukkitEvent);
event.setDuration(bukkitEvent.getDuration());
}
示例15: entityFire
import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void entityFire(EntityCombustByEntityEvent e){
if (e.isCancelled()) {
return;
}
Entity e1 = e.getEntity();
Entity e2 = e.getCombuster();
Location loc = e1.getLocation();
if (e2 instanceof Projectile) {
Projectile a = (Projectile)e2;
if (a.getShooter() instanceof Entity){
e2 = (Entity)a.getShooter();
}
a = null;
if (e2 == null) {
return;
}
}
Region r1 = RedProtect.get().rm.getTopRegion(loc);
if (r1 == null){
//global flags
if (e1 instanceof ArmorStand && e2 instanceof Player){
if (!RPConfig.getGlobalFlagBool(loc.getWorld().getName()+".build")){
e.setCancelled(true);
}
}
} else {
if (e1 instanceof ArmorStand && e2 instanceof Player){
if (!r1.canBuild(((Player)e2)) && !r1.canBreak(e1.getType())){
e.setCancelled(true);
RPLang.sendMessage(e2, "blocklistener.region.cantbreak");
}
}
}
}