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


Java EntitySpawnEvent类代码示例

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


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

示例1: loadArmorStand

import org.bukkit.event.entity.EntitySpawnEvent; //导入依赖的package包/类
private static void loadArmorStand() {
    Registration.registerEvent("Armor Stand Interact Event", SimpleEvent.class, PlayerArmorStandManipulateEvent.class, "armor stand (manipulate|interact)")
            .document("Armor Stand Interact", "1.6.9", "Called when a player right clicks an armor stand to put something on it / take something off of it. "
                    + "The event is called before the interaction fully happens, meaning, for example, player's tool is what was in the player's hand before interacting, "
                    + "and (if it isn't air) represents what the player is putting on the armor stand. "
                    + "Note: If you are using Umbaska, make sure to use manipulate instead of interact, as interact conflicts with an Umbaska event.")
            .eventValue(Player.class, "1.6.9", "The player.")
            .eventValue(Entity.class, "1.6.9", "The armor stand.")
            .eventValue(ItemStack.class, "1.6.9", "The item being taken off.")
            .eventValue(Slot.class, "1.6.9", "The equipment slot, use this to set the item in that particular event.");
    Registration.registerEventValue(PlayerArmorStandManipulateEvent.class, ItemStack.class, PlayerArmorStandManipulateEvent::getArmorStandItem);
    Registration.registerEventValue(PlayerArmorStandManipulateEvent.class, Slot.class, e ->
            new ArmorStandEquipmentSlot(e.getRightClicked(), ArmorStandEquipmentSlot.EquipSlot.getByEquipmentSlot(e.getSlot())));
    Registration.registerEvent("Armor Stand Place Event", EvtArmorStandPlace.class, EntitySpawnEvent.class, "armor stand place")
            .document("Armor Stand Place", "1.6.9", "Called when an armor stand is placed")
            .eventValue(Entity.class, "1.6.9", "The armor stand that was placed");
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:18,代码来源:MiscMundo.java

示例2: 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

示例3: checkAndRemoveTooManyEntities

import org.bukkit.event.entity.EntitySpawnEvent; //导入依赖的package包/类
private void checkAndRemoveTooManyEntities(EntitySpawnEvent event, List<EntityType> passives) {
	Entity[] cents = event.getEntity().getLocation().getChunk().getEntities();
	int count = 0;
	for (Entity e : cents) {
		if (e instanceof LivingEntity) {
			LivingEntity le = (LivingEntity) e;
			if (passives.contains(e.getType())) {
				if ((le.getCustomName() != null) || le.isCustomNameVisible()) {
					if (count > Settings.getTamedPerChunk()) {
						e.remove();
					} else {
						count++;
					}
				}
			}
		}
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:19,代码来源:EntityListener.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: onSpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = false)
public void onSpawn(cn.nukkit.event.entity.EntitySpawnEvent event) {
	if (canIgnore(EntitySpawnEvent.getHandlerList())) {
		return;
	}
	EntitySpawnEvent bukkitEvent = new EntitySpawnEvent(PokkitEntity.toBukkit(event.getEntity()));

	callUncancellable(bukkitEvent);
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:10,代码来源:EntityEvents.java

示例9: onEntitySpawn

import org.bukkit.event.entity.EntitySpawnEvent; //导入依赖的package包/类
/**
    * Handles entity spawning
    *
    * @param e an event representing a spawned entity
    * @see EntitySpawnEvent
    * @since 2.1.0
    */
@EventHandler(ignoreCancelled = true)
public void onEntitySpawn(EntitySpawnEvent e) {
	Entity entity = e.getEntity();

	Plot plot;
	if ((plot = Plot.getPlot(entity.getLocation())) != null) {
		if (!plot.addEntity(entity))
			entity.remove();
	}
}
 
开发者ID:stefvanschie,项目名称:buildinggame,代码行数:18,代码来源:EntitySpawn.java

示例10: 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

示例11: spawnListener

import org.bukkit.event.entity.EntitySpawnEvent; //导入依赖的package包/类
@EventHandler
public void spawnListener(final EntitySpawnEvent event) {
	if (!this.spawnListener) { return; }

	try {
		@SuppressWarnings("unused") final StoredEntity entity = this.module.getOrCreateEntity(event.getEntity());
		this.spawnListenerInserts++;
	}
	catch (final Exception e) { CraftoMessenger.report(this.getClass(), "Failed to store entity: " + event.getEntity().getType() + " (" + event.getEntity().getUniqueId() + ")", e); }
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:11,代码来源:EntitySpawnListener.java

示例12: 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

示例13: 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

示例14: check

import org.bukkit.event.entity.EntitySpawnEvent; //导入依赖的package包/类
@Override
public boolean check(Event event) {
    return event instanceof EntitySpawnEvent && ((EntitySpawnEvent) event).getEntity() instanceof ArmorStand;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:5,代码来源:EvtArmorStandPlace.java

示例15: 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


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