001/*
002 * PlotSquared, a land and world management plugin for Minecraft.
003 * Copyright (C) IntellectualSites <https://intellectualsites.com>
004 * Copyright (C) IntellectualSites team and contributors
005 *
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
018 */
019package com.plotsquared.core.util;
020
021import org.checkerframework.checker.nullness.qual.NonNull;
022import org.checkerframework.checker.nullness.qual.Nullable;
023
024import java.util.Collection;
025
026/**
027 * This class should be implemented by each platform to allow PlotSquared to interact
028 * with the world management solution used on the server.
029 * <p>
030 * Special support for world management plugins such as Multiverse and
031 * Hyperverse can be added by extending the platform specific class. This
032 * way PlotSquared can hook into different APIs and provide better support for that
033 * particular plugin
034 */
035public interface PlatformWorldManager<T> {
036
037    /**
038     * Initialize the platform world manager
039     */
040    void initialize();
041
042    /**
043     * Inform the manager that PlotSquared has created a new world, using
044     * a specified generator.
045     *
046     * @param worldName World name
047     * @param generator World generator
048     * @return Created world
049     */
050    @Nullable T handleWorldCreation(
051            final @NonNull String worldName,
052            final @Nullable String generator
053    );
054
055    /**
056     * Get the implementation name
057     *
058     * @return implementation name
059     */
060    String getName();
061
062    /**
063     * Get the names of all worlds on the server
064     *
065     * @return Worlds
066     */
067    Collection<String> getWorlds();
068
069}