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;
018
019import javax.annotation.concurrent.ThreadSafe;
020
021/**
022 * Obtains the state of the weather, and allows control of the Weather in a world
023 *
024 * @author The TridentSDK Team
025 * @since 0.4-alpha
026 */
027@ThreadSafe
028public interface WeatherConditions {
029    /**
030     * Checks if it is raining in a world
031     *
032     * @return True if it is raining in a world
033     */
034    boolean isRaining();
035
036    /**
037     * Gets the number of ticks before raining is toggled
038     *
039     * @return The number of ticks before raining is toggled
040     */
041    int rainTime();
042
043    /**
044     * Toggles raining within the world
045     *
046     * @param ticks the ticks until the next rain toggle, or {@code 0} to toggle immediately
047     */
048    void toggleRain(int ticks);
049
050    /**
051     * Sets raining to the provided boolean
052     *
053     * @param raining {@code true} to start raining, {@code false} to stop
054     */
055    void setRaining(boolean raining);
056
057    /**
058     * Checks if it is thundering in a world
059     *
060     * @return True if it is thundering in a world
061     */
062    boolean isThundering();
063
064    /**
065     * Gets the number of ticks before thundering is toggled
066     *
067     * @return The number of ticks before thundering is toggled
068     */
069    int thunderTime();
070
071    /**
072     * Toggles thundering within the world
073     *
074     * @param ticks the amount of ticks until the next thunder toggle, {@code 0} to toggle immediately
075     */
076    void toggleThunder(int ticks);
077
078    /**
079     * Sets thundering to the boolean provided
080     *
081     * @param thundering {@code true} to start thundering, {@code false} to stop
082     */
083    void setThundering(boolean thundering);
084
085    /**
086     * Whether or not any weather is occurring within the world
087     *
088     * @return {@code true} if no weather is occurring, {@code false} if it is
089     */
090    boolean isSunny();
091
092    /**
093     * Sets the world to sunny, stopping both thundering and raining if present
094     */
095    void setSunny();
096}