本文整理匯總了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;
}