Skip to content

Config Logic Model

saletrak edited this page Jul 20, 2019 · 1 revision

This page describes how works fetching data from confings in MoneyMaker plugin. Typical way is creating two classes such as SomeFeautureConfig and SomeFeautureConfigLogic. What is a purpouse of this solution? Read below.

Config Class

This class usually contains:

  • Static reference to Config object, something like pointer to configuration file.
  • Static functions which provide a pure data from configuration file. These functions returns data in a basic types such as String, int, Map<Integer, MemorySection>
  • Static function setDefaults(), in case of no existing configuration file or if that is empty then file is filled by the values in this function.

Logic Class

This class contains:

  • All fields in config are represented by a class variable. These variables might be in type relevant to feauture, for example CustomLevelsFeauture - Level levels
  • Functions that mutate the saved data in config
Clone this wiki locally