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


Java CreatureSpawnEvent.SpawnReason方法代码示例

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


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

示例1: evaluate

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@Override
public FilterState evaluate(Object evaluating) {
  if (evaluating instanceof CreatureSpawnEvent) {
    return FilterState.fromBoolean(((CreatureSpawnEvent) evaluating).getSpawnReason().equals(spawnReason));
  } else if (evaluating instanceof CreatureSpawnEvent.SpawnReason) {
    return FilterState.fromBoolean(spawnReason.equals(evaluating));
  }
  return FilterState.ABSTAIN;
}
 
开发者ID:CardinalDevelopment,项目名称:Cardinal,代码行数:10,代码来源:SpawnFilter.java

示例2: MobSpawn

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void MobSpawn(final CreatureSpawnEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof Player) {
        return;
    }
    final Location loc = BukkitUtil.getLocation(event.getLocation());
    final String world = loc.getWorld();
    if (!PlotSquared.isPlotWorld(world)) {
        return;
    }
    if (!MainUtil.isPlotArea(loc)) {
        return;
    }
    final PlotWorld pW = PlotSquared.getPlotWorld(world);
    final CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
    if ((reason == CreatureSpawnEvent.SpawnReason.SPAWNER_EGG || reason == CreatureSpawnEvent.SpawnReason.DISPENSE_EGG) && !pW.SPAWN_EGGS) {
        event.setCancelled(true);
        return;
    } else if ((reason == CreatureSpawnEvent.SpawnReason.BREEDING) && !pW.SPAWN_BREEDING) {
        event.setCancelled(true);
        return;
    } else if ((reason == CreatureSpawnEvent.SpawnReason.CUSTOM) && !pW.SPAWN_CUSTOM && !(event.getEntityType().getTypeId() == 30)) {
        event.setCancelled(true);
        return;
    }
    Plot plot = MainUtil.getPlot(loc);
    if (checkEntity(entity, plot)) {
        event.setCancelled(true);
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:32,代码来源:PlayerEvents.java

示例3: addToWorld

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public static boolean addToWorld(World world, Entity entity, CreatureSpawnEvent.SpawnReason reason)
{
    try {
        Object worldHandle = getHandle(world);
        Object entityHandle = getHandle(entity);
        class_World_addEntityMethod.invoke(worldHandle, entityHandle, reason);
    } catch (Throwable ex) {
        ex.printStackTrace();
        return false;
    }

    return true;
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:14,代码来源:CompatibilityUtils.java

示例4: onCreatureSpawn

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) {
    Entity entity = event.getEntity();
    CreatureSpawnEvent.SpawnReason spawnReason = event.getSpawnReason();

    List<String> allowedSpawnReasons = plugin.getConfig().getStringList("events.spawned");

    if (allowedSpawnReasons.contains(spawnReason.name())) {
        message.sendMessage(entity, Message.EventType.spawned);
    }
}
 
开发者ID:Programie,项目名称:TalkingMobs,代码行数:12,代码来源:EventListener.java

示例5: EntitySpawnQuery

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public EntitySpawnQuery(Event event, Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
    super(entity);
    this.event = checkNotNull(event);
    this.spawnReason = checkNotNull(spawnReason);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:6,代码来源:EntitySpawnQuery.java

示例6: getSpawnReason

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@Override
public CreatureSpawnEvent.SpawnReason getSpawnReason() {
    return spawnReason;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:EntitySpawnQuery.java

示例7: spawn

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@ExtraMethod("public void spawn(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {\n"
					 + "  this.world.addEntity(this, spawnReason);\n"
					 + "}")
void spawn(CreatureSpawnEvent.SpawnReason spawnReason);
 
开发者ID:InventivetalentDev,项目名称:CompactNPCLib,代码行数:5,代码来源:NPCEntity.java

示例8: spawnPlayer

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@ExtraMethod("public void spawnPlayer(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {\n"
					 + "  this.world.players.add(this);\n"
					 + "  this.world.entityList.add(this);\n"
					 + "}")
void spawnPlayer(CreatureSpawnEvent.SpawnReason spawnReason);
 
开发者ID:InventivetalentDev,项目名称:CompactNPCLib,代码行数:6,代码来源:EntityPlayer.java

示例9: NPCSpawnEvent

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public NPCSpawnEvent(NPCAbstract<?, ?> npc, CreatureSpawnEvent.SpawnReason spawnReason) {
	super(npc);
	this.spawnReason = spawnReason;
}
 
开发者ID:InventivetalentDev,项目名称:CompactNPCLib,代码行数:5,代码来源:NPCSpawnEvent.java

示例10: getReturnType

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public Class<? extends CreatureSpawnEvent.SpawnReason> getReturnType() {
	return CreatureSpawnEvent.SpawnReason.class;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:4,代码来源:ExprSpawnReason.java

示例11: get

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@Nullable
protected CreatureSpawnEvent.SpawnReason[] get(Event e) {
	return new CreatureSpawnEvent.SpawnReason[]{((CreatureSpawnEvent)e).getSpawnReason()};
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:5,代码来源:ExprSpawnReason.java

示例12: getReason

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public CreatureSpawnEvent.SpawnReason getReason() {
    return reason;
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:4,代码来源:SpawnFilterParser.java

示例13: InvalidSpawnListener

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public InvalidSpawnListener(Plugin plugin, EntityChecker entityChecker, Class toCheck, Set<CreatureSpawnEvent.SpawnReason> skips) {
    this.plugin = plugin;
    this.toCheck = toCheck;
    this.entityChecker = entityChecker;
    this.skips = ImmutableSet.copyOf(skips);
}
 
开发者ID:Eluinhost,项目名称:UberHardcore,代码行数:7,代码来源:InvalidSpawnListener.java

示例14: withSupressedInvalidSpawnReasons

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public MobOverride withSupressedInvalidSpawnReasons(CreatureSpawnEvent.SpawnReason... reasons) {
    this.suppressedInvalidSpawnReasons = ImmutableSet.copyOf(reasons);
    return this;
}
 
开发者ID:Eluinhost,项目名称:UberHardcore,代码行数:5,代码来源:MobOverride.java

示例15: getSuppressedInvalidSpawnReasons

import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
/**
 * @return spawn reasons not to log if they have invalid spawns, cancel silently.
 */
public Set<CreatureSpawnEvent.SpawnReason> getSuppressedInvalidSpawnReasons() {
    return suppressedInvalidSpawnReasons;
}
 
开发者ID:Eluinhost,项目名称:UberHardcore,代码行数:7,代码来源:MobOverride.java


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