Fix possible bugs with test & play commands

This commit is contained in:
Daniel Saukel 2016-01-10 16:48:58 +01:00
parent 3c80c7635f
commit 1499f71a28
2 changed files with 13 additions and 1 deletions

View File

@ -70,7 +70,7 @@ public class PlayCommand extends DCommand {
if ( !GameWorld.canPlayDungeon(identifier, player)) {
File file = new File(plugin.getDataFolder() + "/maps/" + identifier + "/config.yml");
if (file != null) {
if (file.exists()) {
WorldConfig confReader = new WorldConfig(file);
if (confReader != null) {
@ -96,6 +96,12 @@ public class PlayCommand extends DCommand {
dGroup.setGameWorld(GameWorld.load(DGroup.getByPlayer(player).getMapName()));
}
if (dGroup.getGameWorld() == null) {
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_SAVED, DGroup.getByPlayer(player).getMapName()));
dGroup.remove();
return;
}
if (dGroup.getGameWorld().getLocLobby() == null) {
new DPlayer(player, dGroup.getGameWorld().getWorld(), dGroup.getGameWorld().getWorld().getSpawnLocation(), false);

View File

@ -72,6 +72,12 @@ public class TestCommand extends DCommand {
dGroup.setGameWorld(GameWorld.load(DGroup.getByPlayer(player).getMapName()));
}
if (dGroup.getGameWorld() == null) {
MessageUtil.sendMessage(player, dMessages.getMessage(Messages.ERROR_NOT_SAVED, DGroup.getByPlayer(player).getMapName()));
dGroup.remove();
return;
}
DPlayer newDPlayer;
if (dGroup.getGameWorld().getLocLobby() == null) {