🤖For Developers

Location and Access

The API is part of the AdvancedSeasons plugin package, and its main class is located in the net.advancedplugins.seasons.api package. To access the API, ensure that the AdvancedSeasons plugin is installed on your Spigot server.

Download API Jar

Latest API jar is available on AdvancedSeasons' github page. Direct link to the jar: https://github.com/AdvancedPlugins/Seasons/blob/main/AdvancedSeasons-API.jar

Key Functionalities

The AdvancedSeasonsAPI class provides several methods:

  1. getSeason(World world): Returns the current season of the specified world without transition phases (e.g., WINTER).

  2. getSeasonWithTransitions(World world): Similar to getSeason, but includes transition phases (e.g., WINTER_TRANSITION_3).

  3. setSeason(String season, World world): Allows setting the season of a specific world.

  4. getTemperature(Player player): Returns the temperature of a player in degrees.

  5. setTemperature(Player player, int temperature): Sets a player's temperature to a specified degree.

  6. boostTemperature(Player player, int temperature): Boosts a player's temperature by a specified degree.

Adding the Plugin as a Dependency

To use the AdvancedSeasons API in your project, you need to add the plugin as a dependency. This process typically involves the following steps:

  1. Download the AdvancedSeasons JAR File: Ensure you have the latest version of the plugin JAR file, this will be from SpigotMC, AdvancedPlugins.net or any distributed platforms.

  2. Add to Project Dependencies:

    • If using Maven, add the JAR to your local repository and include it in your pom.xml.

    • For Gradle, include the JAR in your libs folder and add it to the dependencies in your build.gradle

  3. Import API Classes: In your project, import the necessary classes from the net.advancedplugins.seasons.api package.

Example Usage

import net.advancedplugins.seasons.api.AdvancedSeasonsAPI;
import org.bukkit.World;
import org.bukkit.entity.Player;

// Example method to set winter season in a world
public void setWinter(World world) {
    AdvancedSeasonsAPI api = new AdvancedSeasonsAPI();
    api.setSeason("WINTER", world);
}

// Example method to get and increase a player's temperature
public void increasePlayerTemperature(Player player, int increaseBy) {
    AdvancedSeasonsAPI api = new AdvancedSeasonsAPI();
    int currentTemp = api.getTemperature(player);
    api.setTemperature(player, currentTemp + increaseBy);
}

Last updated