當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。