001/*
002 * Trident - A Multithreaded Server Alternative
003 * Copyright 2014 The TridentSDK Team
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *    http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package net.tridentsdk.world.settings;
018
019import javax.annotation.concurrent.ThreadSafe;
020import java.util.Set;
021
022/**
023 * Represents the settings of the world, such as the level type, gamemode, etc...
024 *
025 * @author The TridentSDK Team
026 * @since 0.4-alpha
027 */
028@ThreadSafe
029public interface WorldSettings {
030    /**
031     * Obtains the seed used to generate the world
032     *
033     * @return the world seed
034     */
035    long seed();
036
037    /**
038     * Gets the dimension of a world
039     *
040     * @return The dimension of a world
041     */
042    Dimension dimension();
043
044    /**
045     * Gets the difficulty set in a world
046     *
047     * @return The difficulty set in a world
048     */
049    Difficulty difficulty();
050
051    /**
052     * Sets the world difficulty
053     *
054     * @param difficulty the difficulty
055     */
056    void setDifficulty(Difficulty difficulty);
057
058    /**
059     * Gets the default gamemode in a given chunk
060     *
061     * @return The default gamemode in a given chunk
062     */
063    GameMode defaultGameMode();
064
065    /**
066     * Sets the world game mode
067     *
068     * @param gameMode the world gamemode
069     */
070    void setGameMode(GameMode gameMode);
071
072    /**
073     * Gets the type of a world
074     *
075     * @return The type of a world
076     */
077    LevelType levelType();
078
079    /**
080     * Gets the set boolean for the given gamerule
081     *
082     * @return The set boolean for the given gamerule
083     */
084    boolean isRule(String rule);
085
086    /**
087     * Obtains a list of the game rules applied to this world
088     *
089     * @return the world's game rules
090     */
091    Set<String> gameRules();
092
093    /**
094     * Obtains the boolean value indicating the allowance or disallowance of pvp
095     *
096     * @return {@code true} to allow, {@code false} to disallow
097     */
098    boolean allowPvp();
099
100    /**
101     * Allows or disallows player vs. player damage
102     *
103     * @param enable {@code true} to allow, {@code false} to disallow
104     */
105    void setAllowPvp(boolean enable);
106
107    /**
108     * Checks if structures are generated in a world (Stronghold, villages, dungeons)
109     *
110     * @return True if structures are generated in a world (Stronghold, villages, dungeons)
111     */
112    boolean generateStructures();
113}