自定义季节提供

创建一个实现SeasonProvider的类,然后在插件启用上注册它

package net.momirealms.customcrops.api.example;

import net.momirealms.customcrops.api.core.world.Season;
import net.momirealms.customcrops.api.integration.SeasonProvider;
import org.bukkit.World;
import org.jetbrains.annotations.NotNull;

public class MySeasonProvider implements SeasonProvider {
    
    @Override
    public @NotNull Season getSeason(@NotNull World world) {
        return ...;
    }

    @Override
    public String identifier() {
        return "MySeasonPlugin";
    }
}
package net.momirealms.customcrops.api.example;

import net.momirealms.customcrops.api.BukkitCustomCropsPlugin;
import org.bukkit.plugin.java.JavaPlugin;

public class MyPlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        register();
    }

    public void register() {
        BukkitCustomCropsPlugin.getInstance().getIntegrationManager().registerSeasonProvider(new MySeasonProvider());
    }
}

最后更新于