Select structure type by string

Discussion in 'Plugin Development' started by lecreep, Dec 2, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    lecreep

    I get "type" from a config file.
    Something to solve this is possible?
    Code:
    String type="BURIED_TREASURE";
    StructureType structure = StructureType.type;
     
  2. Offline

    Kars

    @lecreep did you even google it?
    PHP:
    StructureType.valueOf(type);
     
  3. Offline

    Strahan

    Don't forget to wrap a try/catch around it so you can catch if someone messed the config entry up. You want to trap IllegalArgumentException.
     
    Kars likes this.
Thread Status:
Not open for further replies.

Share This Page