本文整理匯總了Java中org.bukkit.entity.EntityType.ENDER_CRYSTAL屬性的典型用法代碼示例。如果您正苦於以下問題:Java EntityType.ENDER_CRYSTAL屬性的具體用法?Java EntityType.ENDER_CRYSTAL怎麽用?Java EntityType.ENDER_CRYSTAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.entity.EntityType
的用法示例。
在下文中一共展示了EntityType.ENDER_CRYSTAL屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parse
@Override
public PickupModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
KitParser kitParser = context.needModule(KitParser.class);
FilterParser filterParser = context.needModule(FilterParser.class);
RegionParser regionParser = context.needModule(RegionParser.class);
for(Element el : XMLUtils.flattenElements(doc.getRootElement(), "pickups", "pickup")) {
String name = el.getAttributeValue("name");
EntityType appearance = XMLUtils.parseEnum(Node.fromAttr(el, "appearance"), EntityType.class, "entity type", EntityType.ENDER_CRYSTAL);
if(appearance != EntityType.ENDER_CRYSTAL) {
throw new InvalidXMLException("Only ender crystal appearances are supported right now", el);
}
Filter visible = filterParser.property(el, "spawn-filter").optional(StaticFilter.ALLOW);
Filter pickup = filterParser.property(el, "pickup-filter").optional(StaticFilter.ALLOW);
Region region = regionParser.property(el, "region").validate(RandomPointsValidation.INSTANCE).required();
Kit kit = kitParser.property(el, "kit").optional(KitNode.EMPTY);
Duration refresh = XMLUtils.parseDuration(Node.fromAttr(el, "respawn-time"), Duration.ofSeconds(3));
Duration cooldown = XMLUtils.parseDuration(Node.fromAttr(el, "pickup-time"), Duration.ofSeconds(3));
boolean effects = XMLUtils.parseBoolean(Node.fromAttr(el, "effects"), true);
boolean sounds = XMLUtils.parseBoolean(Node.fromAttr(el, "sounds"), true);
context.features().define(el, new PickupDefinitionImpl(name, appearance, visible, pickup, region, kit, refresh, cooldown, effects, sounds));
}
return null;
}
示例2: onPlayerInteractEntity
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (event.getRightClicked().getType() == EntityType.ENDER_CRYSTAL) {
handleBossSpawn(event.getPlayer(), event.getRightClicked());
event.setCancelled(true);
} else if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
handleRewards(event.getPlayer(), event.getRightClicked());
}
}
示例3: onPlayerHitDungeonDisplay
@EventHandler
public void onPlayerHitDungeonDisplay(EntityDamageByEntityEvent event) {
if (event.getEntityType() == EntityType.ENDER_CRYSTAL) {
if (event.getDamager() instanceof Player)
handleBossSpawn(event.getDamager(), event.getEntity());
event.setCancelled(true);
} else if (event.getEntityType() == EntityType.ARMOR_STAND) {
if (event.getDamager() instanceof Player)
handleRewards(event.getDamager(), event.getEntity());
}
}
示例4: onPlayerInteractEntity
@EventHandler
public static void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (event.getRightClicked().getType() == EntityType.ENDER_CRYSTAL) {
handleBuff(event.getPlayer(), event.getRightClicked());
event.setCancelled(true);
}
}
示例5: onPlayerHitBuffEvent
@EventHandler
public static void onPlayerHitBuffEvent(EntityDamageByEntityEvent event) {
if (event.getEntityType() == EntityType.ENDER_CRYSTAL) {
if (event.getDamager() instanceof Player)
handleBuff(event.getDamager(), event.getEntity());
else if (event.getDamager() instanceof Projectile) {
if (((Projectile) event.getDamager()).getShooter() instanceof Player)
handleBuff(((Player) ((Projectile) event.getDamager()).getShooter()), event.getEntity());
}
event.setCancelled(true);
}
}
示例6: getType
public EntityType getType() {
return EntityType.ENDER_CRYSTAL;
}