@Override public void initialize(Spell spell, ConfigurationSection parameters) { super.initialize(spell, parameters); if (parameters.contains("biomes")) { ConfigurationSection biomeConfig = ConfigurationUtils.getConfigurationSection(parameters, "biomes"); biomeMap = new HashMap<>(); Collection<String> biomeKeys = biomeConfig.getKeys(false); for (String biomeKey : biomeKeys) { try { Biome biome = Biome.valueOf(biomeKey.toUpperCase()); List<String> treeTypes = ConfigurationUtils.getStringList(biomeConfig, biomeKey); for (String typeKey : treeTypes) { try { TreeType treeType = TreeType.valueOf(typeKey.toUpperCase()); List<TreeType> biomeTypes = biomeMap.get(biome); if (biomeTypes == null) { biomeTypes = new ArrayList<>(); biomeMap.put(biome, biomeTypes); } biomeTypes.add(treeType); } catch (Exception treeEx) { Bukkit.getLogger().warning("Invalid tree type: " + typeKey); } } } catch (Exception biomeEx) { Bukkit.getLogger().warning("Invalid biome: " + biomeKey); } } } }
@Override public void prepare(CastContext context, ConfigurationSection parameters) { super.prepare(context, parameters); targetEntityLocation = parameters.getBoolean("target_entity"); targetSelf = parameters.getBoolean("target_caster"); sourceAtTarget = parameters.getBoolean("source_at_target"); targetOffset = ConfigurationUtils.getVector(parameters, "target_offset"); sourceOffset = ConfigurationUtils.getVector(parameters, "source_offset"); randomTargetOffset = ConfigurationUtils.getVector(parameters, "random_target_offset"); randomSourceOffset = ConfigurationUtils.getVector(parameters, "random_source_offset"); sourceDirection = ConfigurationUtils.getVector(parameters, "source_direction"); targetDirection = ConfigurationUtils.getVector(parameters, "target_direction"); sourceDirectionOffset = ConfigurationUtils.getVector(parameters, "source_direction_offset"); targetDirectionOffset = ConfigurationUtils.getVector(parameters, "source_direction_offset"); persistTarget = parameters.getBoolean("persist_target", false); attachBlock = parameters.getBoolean("target_attachment", false); if (parameters.contains("target_direction_speed")) { targetDirectionSpeed = parameters.getDouble("target_direction_speed"); } else { targetDirectionSpeed = null; } if (parameters.contains("source_direction_speed")) { sourceDirectionSpeed = parameters.getDouble("source_direction_speed"); } else { sourceDirectionSpeed = null; } }
@Override public void prepare(CastContext context, ConfigurationSection parameters) { track = parameters.getBoolean("track", true); loot = parameters.getBoolean("loot", false); force = parameters.getBoolean("force", false); setTarget = parameters.getBoolean("set_target", false); speed = parameters.getDouble("speed", 0); direction = ConfigurationUtils.getVector(parameters, "direction"); dyOffset = parameters.getDouble("dy_offset", 0); if (parameters.contains("type")) { String mobType = parameters.getString("type"); entityData = context.getController().getMob(mobType); if (entityData == null) { entityData = new com.elmakers.mine.bukkit.entity.EntityData(context.getController(), parameters); } } if (parameters.contains("reason")) { String reasonText = parameters.getString("reason").toUpperCase(); try { spawnReason = CreatureSpawnEvent.SpawnReason.valueOf(reasonText); } catch (Exception ex) { spawnReason = CreatureSpawnEvent.SpawnReason.EGG; } } }
@Override public void prepare(CastContext context, ConfigurationSection parameters) { super.prepare(context, parameters); doVelocity = parameters.getBoolean("apply_velocity", true); doTeleport = parameters.getBoolean("teleport", true); noTarget = parameters.getBoolean("no_target", true); orient = parameters.getBoolean("orient", true); velocityOffset = ConfigurationUtils.getVector(parameters, "velocity_offset"); locationOffset = ConfigurationUtils.getVector(parameters, "location_offset"); try { String entityTypeName = parameters.getString("type", ""); if (!entityTypeName.isEmpty()) { entityType = EntityType.valueOf(entityTypeName.toUpperCase()); } } catch (Exception ex) { entityType = null; } if (parameters.contains("spawn_reason")) { String reasonText = parameters.getString("spawn_reason").toUpperCase(); try { spawnReason = CreatureSpawnEvent.SpawnReason.valueOf(reasonText); } catch (Exception ex) { context.getMage().sendMessage("Unknown spawn reason: " + reasonText); } } customName = parameters.getString("name"); isBaby = parameters.getBoolean("baby", false); variantName = parameters.getString("variant"); if (variantName != null && variantName.isEmpty()) { variantName = null; } }
@Override public void initialize(Spell spell, ConfigurationSection parameters) { super.initialize(spell, parameters); if (parameters.contains("entity_types")) { RandomUtils.populateStringProbabilityMap( entityTypeProbability, ConfigurationUtils.getConfigurationSection(parameters, "entity_types"), 0, 0, 0); } else { entityTypeProbability.add(new WeightedPair<String>(100.0f, "pig")); } }