本文整理汇总了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;
}