Class CodeConfiguration

java.lang.Object
org.bukkit.configuration.MemorySection
org.bukkit.configuration.MemoryConfiguration
org.bukkit.configuration.file.FileConfiguration
org.bukkit.configuration.file.YamlConfiguration
ua.mcchickenstudio.opencreative.coding.CodeConfiguration
All Implemented Interfaces:
org.bukkit.configuration.Configuration, org.bukkit.configuration.ConfigurationSection, CodeStorage

public class CodeConfiguration extends org.bukkit.configuration.file.YamlConfiguration implements CodeStorage

CodeConfiguration

This class represents a code configuration, that has methods to save executor and action blocks.
  • Field Summary

    Fields inherited from class org.bukkit.configuration.file.YamlConfiguration

    BLANK_CONFIG, COMMENT_PREFIX

    Fields inherited from class org.bukkit.configuration.MemoryConfiguration

    defaults, options

    Fields inherited from class org.bukkit.configuration.MemorySection

    map
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getBlockNumber(org.bukkit.block.Block block)
     
    @Nullable org.bukkit.configuration.ConfigurationSection
    getSection(@NotNull String path)
    Returns configuration section, or null - if not exists.
    void
    loadCode(@NotNull File file)
    Loads data from file.
    void
    removeExecutorBlock(@NotNull org.bukkit.block.Block block, boolean notDependsOnHeight)
    Removes executor block data from configuration file, if it exists.
    void
    saveActionBlock(@NotNull org.bukkit.block.Block executorBlock, boolean notDependsOnHeight, @NotNull List<String> multiActions, @NotNull org.bukkit.block.Block actionBlock, @NotNull ActionCategory category, @NotNull ActionType type, @NotNull Target target)
    Saves action block data in configuration file.
    void
    saveArguments(@NotNull org.bukkit.block.Block executorBlock, boolean notDependsOnHeight, @NotNull List<String> multiActions, @NotNull org.bukkit.block.Block actionBlock, @NotNull String argument, @Nullable Object value, @NotNull ValueType type)
    Saves arguments for action block in configuration file.
    void
    saveExecutorBlock(@NotNull org.bukkit.block.Block block, boolean notDependsOnHeight, @NotNull ExecutorCategory category, @NotNull Executor executor)
    Saves executor block data in configuration file.
    void
    saveExecutorBlock(@NotNull org.bukkit.block.Block block, boolean notDependsOnHeight, @NotNull ExecutorCategory category, @NotNull Executor executor, boolean debug)
    Saves executor block data in configuration file.
    void
    saveToFile(@NotNull File file)
    Saves code to file.

    Methods inherited from class org.bukkit.configuration.file.YamlConfiguration

    loadConfiguration, loadConfiguration, loadFromString, options, saveToString

    Methods inherited from class org.bukkit.configuration.file.FileConfiguration

    buildHeader, load, load, load, save, save

    Methods inherited from class org.bukkit.configuration.MemoryConfiguration

    addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaults

    Methods inherited from class org.bukkit.configuration.MemorySection

    contains, contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInlineComments, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLocation, getLocation, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getOfflinePlayer, getOfflinePlayer, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, setComments, setInlineComments, toString

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface CodeStorage

    set
    Modifier and Type
    Method
    Description
    void
    set(@NotNull String path, @Nullable Object value)
    Sets value in path.

    Methods inherited from interface org.bukkit.configuration.ConfigurationSection

    getComponent, getComponent, getRichMessage, getRichMessage, setComponent, setRichMessage
  • Constructor Details

    • CodeConfiguration

      public CodeConfiguration()
  • Method Details

    • loadCode

      public void loadCode(@NotNull @NotNull File file)
      Description copied from interface: CodeStorage
      Loads data from file.

      Any errors loading the Configuration will be logged and then ignored. If the specified input is not a valid config, a blank config will be returned.

      The encoding used may follow the system dependent default.

      Specified by:
      loadCode in interface CodeStorage
      Parameters:
      file - Input file
    • removeExecutorBlock

      public void removeExecutorBlock(@NotNull @NotNull org.bukkit.block.Block block, boolean notDependsOnHeight)
      Description copied from interface: CodeStorage
      Removes executor block data from configuration file, if it exists.
      Specified by:
      removeExecutorBlock in interface CodeStorage
      Parameters:
      block - executor coding block.
      notDependsOnHeight - whether its horizontal or vertical platformer.
    • saveExecutorBlock

      public void saveExecutorBlock(@NotNull @NotNull org.bukkit.block.Block block, boolean notDependsOnHeight, @NotNull @NotNull ExecutorCategory category, @NotNull @NotNull Executor executor, boolean debug)
      Description copied from interface: CodeStorage
      Saves executor block data in configuration file.
      Specified by:
      saveExecutorBlock in interface CodeStorage
      Parameters:
      block - executor coding block.
      category - category of executor.
      executor - executor.
      debug - should print debug logs or not.
    • saveExecutorBlock

      public void saveExecutorBlock(@NotNull @NotNull org.bukkit.block.Block block, boolean notDependsOnHeight, @NotNull @NotNull ExecutorCategory category, @NotNull @NotNull Executor executor)
      Description copied from interface: CodeStorage
      Saves executor block data in configuration file.
      Specified by:
      saveExecutorBlock in interface CodeStorage
      Parameters:
      block - executor coding block.
      category - category of executor.
      executor - executor.
    • saveActionBlock

      public void saveActionBlock(@NotNull @NotNull org.bukkit.block.Block executorBlock, boolean notDependsOnHeight, @NotNull @NotNull List<String> multiActions, @NotNull @NotNull org.bukkit.block.Block actionBlock, @NotNull @NotNull ActionCategory category, @NotNull @NotNull ActionType type, @NotNull @NotNull Target target)
      Description copied from interface: CodeStorage
      Saves action block data in configuration file.
      Specified by:
      saveActionBlock in interface CodeStorage
      Parameters:
      multiActions - list of multi actions.
      actionBlock - action coding block.
      category - category of action.
      type - type of action.
      target - target for action.
    • saveArguments

      public void saveArguments(@NotNull @NotNull org.bukkit.block.Block executorBlock, boolean notDependsOnHeight, @NotNull @NotNull List<String> multiActions, @NotNull @NotNull org.bukkit.block.Block actionBlock, @NotNull @NotNull String argument, @Nullable @Nullable Object value, @NotNull @NotNull ValueType type)
      Description copied from interface: CodeStorage
      Saves arguments for action block in configuration file.
      Specified by:
      saveArguments in interface CodeStorage
      Parameters:
      multiActions - list of multi actions.
      actionBlock - action block to set arguments.
      argument - argument to set.
      value - value of argument.
      type - value type.
    • saveToFile

      public void saveToFile(@NotNull @NotNull File file) throws IOException
      Description copied from interface: CodeStorage
      Saves code to file.
      Specified by:
      saveToFile in interface CodeStorage
      Parameters:
      file - file to save in.
      Throws:
      IOException
    • getSection

      @Nullable public @Nullable org.bukkit.configuration.ConfigurationSection getSection(@NotNull @NotNull String path)
      Description copied from interface: CodeStorage
      Returns configuration section, or null - if not exists.
      Specified by:
      getSection in interface CodeStorage
      Parameters:
      path - path of section.
      Returns:
      configuration section, or null.
    • getBlockNumber

      public int getBlockNumber(org.bukkit.block.Block block)