> For the complete documentation index, see [llms.txt](https://scheduler.groupez.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scheduler.groupez.dev/implementation.md).

# Implementation

## Supported Plugins

To have your plugin appear here, contact me on the discord: <https://discord.groupez.dev/>

<table><thead><tr><th width="159">Plugin</th><th width="85">Price</th><th>Link</th></tr></thead><tbody><tr><td>zKoth</td><td>10€</td><td><a href="https://www.spigotmc.org/resources/zkoth-king-of-the-hill.76749/">https://www.spigotmc.org/resources/76749/</a></td></tr><tr><td>zTotem</td><td>10€</td><td><a href="https://www.spigotmc.org/resources/ztotem.47318/">https://www.spigotmc.org/resources/47318/</a></td></tr><tr><td>zAuctionHouse</td><td>12.99€</td><td><a href="https://www.spigotmc.org/resources/1-8-1-20-zauctionhouse-2000-servers-online.63010/">https://www.spigotmc.org/resources/63010/</a></td></tr></tbody></table>

### zKoth

```yaml
implementation: 
  name: ZKOTH 
  koth_name: "koth_name" 
  start_now: false
```

### zTotem

```yaml
implementation: 
  name: ZTOTEM
  totem_name: "totem_name" 
  start_now: false
```

### zAuctionHouse

```yaml
implementation: 
  name: ZAUCTIOHOUSE
```

This implementation allows you to manage the backup of the items.json file

## Create an implementation

Source code: <https://github.com/Maxlego08/zSchedulers>

### First step

The first step is to get the SchedulerManager

```java
@Override
public void onEnable() {
    SchedulerManager manager = getProvider(SchedulerManager.class);
}

private <T> T getProvider(Class<T> classz) {
    RegisteredServiceProvider<T> provider = getServer().getServicesManager().getRegistration(classz);
    return provider == null ? null : provider.getProvider() != null ? (T) provider.getProvider() : null;
}
```

### Implementation

Create a class which will implement Implementation interface.

```java
public class ZkothImplementation implements Implementation {

  private final ZKothPlugin plugin;

  public ZkothImplementation(ZKothPlugin plugin) {
    super();
    this.plugin = plugin;
  }

  @Override
  public String getName() {
    return "ZKOTH";
  }

  @Override
  public void schedule(Scheduler scheduler) {
    String kothName = (String) scheduler.getImplementationValues().getOrDefault("koth_name", "");
    boolean startNow = (boolean) scheduler.getImplementationValues().getOrDefault("start_now", false);

    Optional<Koth> optional = this.plugin.getKothManager().getKoth(kothName);
    if (optional.isPresent()) {

      Koth koth = optional.get();
      koth.spawn(startNow);

    } else {
      Logger.info("Koth with name " + kothName + " was not found with scheduler " + scheduler.getName(),
		LogType.ERROR);
    }
  }
}
```

Now you need to register your implementation:

```java
SchedulerManager schedulerManager = this.getProvider(SchedulerManager.class);
schedulerManager.registerImplementation(new ZkothImplementation(this));
```
