diff --git a/core/src/main/java/de/erethon/dungeonsxl/event/gameworld/GameWorldStartGameEvent.java b/api/src/main/java/de/erethon/dungeonsxl/api/event/world/GameWorldStartGameEvent.java
similarity index 55%
rename from core/src/main/java/de/erethon/dungeonsxl/event/gameworld/GameWorldStartGameEvent.java
rename to api/src/main/java/de/erethon/dungeonsxl/api/event/world/GameWorldStartGameEvent.java
index 9318aafd..7661d9c0 100644
--- a/core/src/main/java/de/erethon/dungeonsxl/event/gameworld/GameWorldStartGameEvent.java
+++ b/api/src/main/java/de/erethon/dungeonsxl/api/event/world/GameWorldStartGameEvent.java
@@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package de.erethon.dungeonsxl.event.gameworld;
+package de.erethon.dungeonsxl.api.event.world;
-import de.erethon.dungeonsxl.dungeon.DGame;
-import de.erethon.dungeonsxl.world.DGameWorld;
+import de.erethon.dungeonsxl.api.dungeon.Game;
+import de.erethon.dungeonsxl.api.world.GameWorld;
+import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -29,25 +30,43 @@ public class GameWorldStartGameEvent extends GameWorldEvent implements Cancellab
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
- private DGame game;
+ private Game game;
+ private Location startLocation;
- public GameWorldStartGameEvent(DGameWorld gameWorld, DGame game) {
- super(gameWorld);
+ public GameWorldStartGameEvent(GameWorld gameWorld, Game game, Location location) {
+ super(gameWorld, gameWorld.getDungeon());
this.game = game;
}
/**
+ * Returns the game.
+ *
* @return the game
*/
- public DGame getGame() {
+ public Game getGame() {
return game;
}
/**
- * @param game the game to set
+ * Returns the location where the players are teleported.
+ *
+ * @return the location where the players are teleported
*/
- public void setGame(DGame game) {
- this.game = game;
+ public Location getStartLocation() {
+ return startLocation;
+ }
+
+ /**
+ * Sets the location where the players are teleported.
+ *
+ * @param startLocation a location in the game world
+ * @throws IllegalArgumentException if the given location is not in the game world.
+ */
+ public void setStartLocation(Location startLocation) {
+ if (startLocation.getWorld() != getGameWorld().getWorld()) {
+ throw new IllegalArgumentException("Location " + startLocation + " is not in world " + getGameWorld().getWorld());
+ }
+ this.startLocation = startLocation;
}
@Override
diff --git a/core/src/main/java/de/erethon/dungeonsxl/event/gameworld/GameWorldEvent.java b/core/src/main/java/de/erethon/dungeonsxl/event/gameworld/GameWorldEvent.java
deleted file mode 100644
index 84366416..00000000
--- a/core/src/main/java/de/erethon/dungeonsxl/event/gameworld/GameWorldEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2012-2020 Frank Baumann
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package de.erethon.dungeonsxl.event.gameworld;
-
-import de.erethon.dungeonsxl.world.DGameWorld;
-import org.bukkit.event.Event;
-
-/**
- * @author Daniel Saukel
- */
-public abstract class GameWorldEvent extends Event {
-
- protected DGameWorld gameWorld;
-
- public GameWorldEvent(DGameWorld gameWorld) {
- this.gameWorld = gameWorld;
- }
-
- /**
- * @return the gameWorld
- */
- public DGameWorld getGameWorld() {
- return gameWorld;
- }
-
- /**
- * @param gameWorld the gameWorld to set
- */
- public void setGameWorld(DGameWorld gameWorld) {
- this.gameWorld = gameWorld;
- }
-
-}