本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例6: getSpawnReason
import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@Override
public CreatureSpawnEvent.SpawnReason getSpawnReason() {
return spawnReason;
}
示例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);
示例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);
示例9: NPCSpawnEvent
import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public NPCSpawnEvent(NPCAbstract<?, ?> npc, CreatureSpawnEvent.SpawnReason spawnReason) {
super(npc);
this.spawnReason = spawnReason;
}
示例10: getReturnType
import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public Class<? extends CreatureSpawnEvent.SpawnReason> getReturnType() {
return CreatureSpawnEvent.SpawnReason.class;
}
示例11: get
import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
@Nullable
protected CreatureSpawnEvent.SpawnReason[] get(Event e) {
return new CreatureSpawnEvent.SpawnReason[]{((CreatureSpawnEvent)e).getSpawnReason()};
}
示例12: getReason
import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public CreatureSpawnEvent.SpawnReason getReason() {
return reason;
}
示例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);
}
示例14: withSupressedInvalidSpawnReasons
import org.bukkit.event.entity.CreatureSpawnEvent; //导入方法依赖的package包/类
public MobOverride withSupressedInvalidSpawnReasons(CreatureSpawnEvent.SpawnReason... reasons) {
this.suppressedInvalidSpawnReasons = ImmutableSet.copyOf(reasons);
return this;
}
示例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;
}