DungeonsXL/api/src/main/java/de/erethon/dungeonsxl/api/world/GameWorld.java

130 lines
3.9 KiB
Java
Raw Normal View History

2020-01-27 01:42:36 +01:00
/*
2023-09-28 19:16:23 +02:00
* Copyright (C) 2014-2023 Daniel Saukel
2020-01-27 01:42:36 +01:00
*
* This library is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNULesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.api.world;
2020-01-27 19:51:54 +01:00
import de.erethon.dungeonsxl.api.dungeon.Dungeon;
import de.erethon.dungeonsxl.api.dungeon.Game;
import de.erethon.dungeonsxl.api.mob.DungeonMob;
import de.erethon.dungeonsxl.api.player.PlayerGroup;
2020-01-27 19:51:54 +01:00
import java.util.Collection;
2020-01-27 01:42:36 +01:00
import org.bukkit.Location;
import org.bukkit.block.Block;
2020-01-27 01:42:36 +01:00
/**
* A playable resource instance. There may be any amount of GameWorlds per {@link ResourceWorld}.
* <p>
2020-01-27 19:51:54 +01:00
* A game world is not equal to a {@link de.erethon.dungeonsxl.api.dungeon.Dungeon}.
2020-01-27 01:42:36 +01:00
*
* @author Daniel Saukel
*/
// Implementation-specific methods: [gameblock, secure objects, classes signs, mobs, triggers] methods, getMobCount(), setPlaying(), startGame(), listener methods
public interface GameWorld extends InstanceWorld {
enum Type {
START_FLOOR,
END_FLOOR,
DEFAULT
}
/**
* Returns the {@link Type} of this GameWorld.
*
* @return the {@link Type} of this GameWorld
*/
Type getType();
/**
* Sets the {@link Type} of this GameWorld.
*
* @param type the type
*/
void setType(Type type);
/**
* Returns the game that is played in the game world.
*
* @return the game that is played in the game world
*/
Game getGame();
/**
* Returns the dungeon that the game world is part of.
* <p>
* Note: While a {@link ResourceWorld} may be part of multiple dungeons, an instance is instantiated per game and thus has just one dungeon.
*
* @return the dungeon that the game world is part of
*/
Dungeon getDungeon();
2020-01-27 19:51:54 +01:00
/**
* Returns the living dungeon mobs
*
* @return the living dungeon mobs
*/
Collection<DungeonMob> getMobs();
/**
* Registers the given dungeon mob
*
* @param mob the mob
*/
void addMob(DungeonMob mob);
/**
* Unregisters the given dungeon mob
*
* @param mob the mob
*/
public void removeMob(DungeonMob mob);
2020-01-27 01:42:36 +01:00
/**
* Returns if the game has begun in the game world.
*
* @return if the game has begun in the game world
*/
boolean isPlaying();
/**
* Returns the start location of the world. This may be set by a start {@link de.erethon.dungeonsxl.api.sign.DungeonSign sign} or, if none exists, the
* Vanilla spawn location of the {@link #getWorld() world}.
*
* @param group each group might have its own start location
2020-01-27 01:42:36 +01:00
* @return the start location of the world
*/
Location getStartLocation(PlayerGroup group);
2020-01-27 01:42:36 +01:00
2020-03-13 23:48:49 +01:00
/**
* Returns if it is required to choose a class in order to start the game.
*
* @return if it is required to choose a class in order to start the game
*/
boolean areClassesEnabled();
/**
* Sets if it is required to choose a class in order to start the game.
*
* @param enabled if it is required to choose a class in order to start the game
*/
void setClassesEnabled(boolean enabled);
/**
* Returns a collection of the blocks that have been placed by players in the current game.
*
* @return a collection of the blocks that have been placed by players in the current game
*/
Collection<Block> getPlacedBlocks();
2020-01-27 01:42:36 +01:00
}