Skip to content

Advanced Bukkit configuration wrapper. Advanced and easy way of creating configurations using reflection. Easily add custom behaviour, comments and much more due to the library's modularity.

Notifications You must be signed in to change notification settings

aparx/bufig-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

👉 Bufig - Bukkit configuration library

Advanced Bukkit configuration wrapper. Providing a way to easily integrate configurations using plain old Java objects, nested documentation, custom serialization and much more. Built with modularity in mind, which gives users the ability to alter the library's behaviour to their specific needs.

A wiki will follow in the future.

Installation

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>
<dependency>
  <groupId>com.github.aparx</groupId>
  <artifactId>bufig-library</artifactId>
  <version>VERSION</version>
</dependency>

Requirements

  1. JDK 11 or newer
  2. Bukkit 1.8.8 or newer (for the tested experience)
  3. Shading of this library into your plugin

Simple example

  @Override
  public void onEnable() {
    // Refer to `ConfigHandlers` to create different types of handlers
    ConfigHandler<? super YamlConfig> handler = ConfigHandler.of(this);
    MainConfig mainConfig = new MainConfig(handler);
    mainConfig.load();
  }

  @ConfigId("main")
  @Document({
      "<============================>",
      "    Our main configuration    ",
      "<============================>"
  })
  public static class MainConfig extends ConfigObject {

    @ConfigMapping
    @Document("The primary prefix of our example plugin")
    public String prefix = "[Prefix] ";

    @ConfigMapping
    @Document("The (initial) spawning location of all new players")
    public Location spawnLocation = new Location(Bukkit.getWorld("world"), 30, 80, 30);

    @ConfigMapping("hourly.rotations")
    @Document({
        "The amount of rotations done by the sun per hour.",
        "The number must be less than 360."
    })
    public int rotations = 3;

    @ConfigMapping("hourly.particles")
    @Document("The amount of particles spawned per hour")
    public int particles = 3;

    public MainConfig(@NonNull ConfigHandler<?> handler) {
      super(handler);
    }
  }

Outputs following at plugins/BufigExample/main.yml:

# <============================>
#     Our main configuration    
# <============================>

# The primary prefix of our example plugin
prefix: '[Prefix] '
# The (initial) spawning location of all new players
spawnLocation:
  world: world
  x: 30.0
  y: 80.0
  z: 30.0
  pitch: 0.0
  yaw: 0.0
hourly:
  # The amount of rotations done by the sun per hour.
  # The number must be less than 360.
  rotations: 3
  # The amount of particles spawned per hour
  particles: 3

About

Advanced Bukkit configuration wrapper. Advanced and easy way of creating configurations using reflection. Easily add custom behaviour, comments and much more due to the library's modularity.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages