Made the /[gamemode] spawn command a delayed teleport command

Implements https://github.com/BentoBoxWorld/BentoBox/issues/1069
This commit is contained in:
Florian CUNY 2019-12-14 11:06:10 +01:00
parent fe570bd47d
commit 5bddee702e

View File

@ -3,6 +3,7 @@ package world.bentobox.bentobox.api.commands.island;
import java.util.List; import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.DelayedTeleportCommand;
import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.lists.Flags; import world.bentobox.bentobox.lists.Flags;
@ -11,7 +12,7 @@ import world.bentobox.bentobox.lists.Flags;
* @author Poslovitch * @author Poslovitch
* @since 1.1 * @since 1.1
*/ */
public class IslandSpawnCommand extends CompositeCommand { public class IslandSpawnCommand extends DelayedTeleportCommand {
public IslandSpawnCommand(CompositeCommand parent) { public IslandSpawnCommand(CompositeCommand parent) {
super(parent, "spawn"); super(parent, "spawn");
@ -33,7 +34,7 @@ public class IslandSpawnCommand extends CompositeCommand {
return false; return false;
} }
getIslands().spawnTeleport(getWorld(), user.getPlayer()); this.delayCommand(user, () -> getIslands().spawnTeleport(getWorld(), user.getPlayer()));
return true; return true;
} }
} }