当前位置: 首页>>代码示例>>Java>>正文


Java EntitySpawnEvent.setCancelled方法代码示例

本文整理汇总了Java中org.bukkit.event.entity.EntitySpawnEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java EntitySpawnEvent.setCancelled方法的具体用法?Java EntitySpawnEvent.setCancelled怎么用?Java EntitySpawnEvent.setCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.entity.EntitySpawnEvent的用法示例。


在下文中一共展示了EntitySpawnEvent.setCancelled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDragonSpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
/**
    * This handles end dragon spawning
    * 
    * @param event
    */
   @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
   public void onDragonSpawn(EntitySpawnEvent event) {
if (!Settings.createEnd) {
    return;
}
if (!event.getLocation().getWorld().equals(ASkyGrid.getEndWorld())) {
    return;
}
if (event.getEntityType().equals(EntityType.ENDER_DRAGON)) {
    //plugin.getLogger().info("DEBUG: removing ender dragon");
    LivingEntity dragon = (LivingEntity)event.getEntity();
    dragon.setHealth(0);
    event.getEntity().remove();
    event.setCancelled(true);
}
   }
 
开发者ID:tastybento,项目名称:askygrid,代码行数:22,代码来源:BlockEndDragon.java

示例2: onEntitySpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
/**
 * Prevents lobby players from interacting in the world.
 *
 * @param event The event
 */
@EventHandler
public void onEntitySpawn(final EntitySpawnEvent event) {
  if (event.getLocation().getWorld().equals(world)) {
    event.setCancelled(true);
  }
}
 
开发者ID:twizmwazin,项目名称:OpenUHC,代码行数:12,代码来源:LobbyModule.java

示例3: onEntitySpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
/**
 * Disable Guardian spawn (Mining Fatique effect)
 *
 * @param event Event
 */
@EventHandler
public void onEntitySpawn(EntitySpawnEvent event)
{
    if (event.getEntityType() == EntityType.GUARDIAN || event.getEntityType() == EntityType.WITCH)
        event.setCancelled(true);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:12,代码来源:GameListener.java

示例4: onEntitySpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
@EventHandler
public void onEntitySpawn(EntitySpawnEvent ev)
{
    switch (ev.getEntityType())
    {
    case ARMOR_STAND:
    case PLAYER:
    case SLIME:
    case MAGMA_CUBE:
        return ;
    default:
        ev.setCancelled(true);
    }
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:15,代码来源:WorldListener.java

示例5: onSpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
@EventHandler
public void onSpawn(EntitySpawnEvent event) {
    if (Skywars.getInstance().isSingleServerMode()) {
        if (event.getEntityType() != EntityType.PLAYER && event.getEntityType() != EntityType.DROPPED_ITEM && event.getEntityType() != EntityType.PRIMED_TNT) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:JordanOsterberg,项目名称:SkywarsSeries,代码行数:9,代码来源:EntitySpawn.java

示例6: creatureSpawnEvent

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void creatureSpawnEvent(EntitySpawnEvent event) {
    Entity entity = event.getEntity();
    Location location = BukkitUtil.getLocation(entity.getLocation());
    PlotArea area = location.getPlotArea();
    if (area == null) {
        return;
    }
    Plot plot = area.getOwnedPlotAbs(location);
    if (plot == null) {
        if (!area.MOB_SPAWNING) {
            if (event.getEntityType().isAlive() || !area.MISC_SPAWN_UNOWNED) {
                event.setCancelled(true);
            }
        }
        return;
    }
    if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) {
        event.setCancelled(true);
    }
    switch (entity.getType()) {
        case ENDER_CRYSTAL:
            if (PlayerEvents.checkEntity(entity, plot)) {
                event.setCancelled(true);
            }
        case SHULKER:
        	if(!entity.hasMetadata("plot")) {
        		entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot.getId()));
        	}
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:32,代码来源:EntitySpawnListener.java

示例7: onSpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
@EventHandler
public void onSpawn(EntitySpawnEvent event)
{
    //plugin.getLogger().info("SPAWN EVENT!");
    if(event.getEntity() instanceof EnderCrystal)
    {
        ItemBox itemBox = plugin.getItemBoxRegistry().getByLocation(event.getLocation().getBlock().getLocation());

        if(itemBox != null && !itemBox.getEnderCrystal().equals(event.getEntity()))
        {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:ColonelHedgehog,项目名称:Equestrian-Dash,代码行数:15,代码来源:EntitySpawnListener.java

示例8: onSpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
@EventHandler
public void onSpawn(EntitySpawnEvent e) {
    if (e.getEntity() instanceof Animals) e.setCancelled(true);
}
 
开发者ID:cadox8,项目名称:PA,代码行数:5,代码来源:GameEvents.java

示例9: armorStandStop

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
@EventHandler
public void armorStandStop(EntitySpawnEvent event)
{
    if(event.getEntityType() == EntityType.ARMOR_STAND)
        event.setCancelled(true);
}
 
开发者ID:MrLittleKitty,项目名称:AnnihilationPro,代码行数:7,代码来源:ArmorStandListener.java

示例10: onEntitySpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntitySpawn(EntitySpawnEvent event) {
  if (spawning) {
    event.setCancelled(false);
  }
}
 
开发者ID:SupaHam,项目名称:NPCs,代码行数:7,代码来源:NPCManager.java


注:本文中的org.bukkit.event.entity.EntitySpawnEvent.setCancelled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。