| 14 | import java.util.List; |
| 15 | |
| 16 | public class OpenLinkLoader implements Loader<OpenLink> { |
| 17 | |
| 18 | private final MenuPlugin plugin; |
| 19 | |
| 20 | public OpenLinkLoader(MenuPlugin plugin) { |
| 21 | this.plugin = plugin; |
| 22 | } |
| 23 | |
| 24 | @Override |
| 25 | public OpenLink load(@NonNull YamlConfiguration configuration, @NonNull String path, Object... objects) throws InventoryException { |
| 26 | |
| 27 | Action action = Action.valueOf(configuration.getString(path + "action", "OPEN_URL").toUpperCase()); |
| 28 | String link = configuration.getString(path + "link"); |
| 29 | String message = configuration.getString(path + "message"); |
| 30 | String replace = configuration.getString(path + "replace"); |
| 31 | List<String> hover = configuration.getStringList(path + "hover"); |
| 32 | |
| 33 | return new ZOpenLink(this.plugin, action, message, link, replace, hover); |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | public void save(OpenLink object, @NonNull YamlConfiguration configuration, @NonNull String path, File file, Object... objects) { |
| 38 | |
| 39 | configuration.set(path + "action", "OPEN_URL"); |
| 40 | configuration.set(path + "link", object.getLink()); |
| 41 | configuration.set(path + "message", object.getMessage()); |
| 42 | configuration.set(path + "replace", object.getReplace()); |
| 43 | configuration.set(path + "hover", object.getHover()); |
| 44 | |
| 45 | try { |
| 46 | configuration.save(file); |
| 47 | } catch (IOException e) { |
| 48 | throw new RuntimeException(e); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | } |
nothing calls this directly
no outgoing calls
no test coverage detected