Ejemplo n.º 1
0
  @TraitConfigurationNeeded(
      fields = {
        @TraitConfigurationField(fieldName = "duration", classToExpect = Integer.class),
        @TraitConfigurationField(fieldName = "totalDamage", classToExpect = Double.class)
      })
  @Override
  public void setConfiguration(TraitConfiguration configMap)
      throws TraitConfigurationFailedException {
    super.setConfiguration(configMap);

    duration = (Integer) configMap.get("duration");
    totalDamage = (Double) configMap.get("totalDamage");
  }
Ejemplo n.º 2
0
  @TraitConfigurationNeeded(
      fields = {
        @TraitConfigurationField(
            fieldName = "range",
            classToExpect = Integer.class,
            optional = true),
        @TraitConfigurationField(fieldName = "time", classToExpect = Integer.class, optional = true)
      })
  @Override
  public void setConfiguration(TraitConfiguration configMap)
      throws TraitConfigurationFailedException {
    super.setConfiguration(configMap);

    if (configMap.containsKey("range")) range = configMap.getAsInt("range");
    if (configMap.containsKey("time")) seconds = configMap.getAsInt("time");
  }