mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-25 13:22:52 +02:00
Added WorldSetting#isTeleportPlayerToIslandUponIslandCreation()
Implements https://github.com/BentoBoxWorld/BentoBox/issues/1032
This commit is contained in:
parent
898118cfd9
commit
48f898aa2c
@ -423,4 +423,21 @@ public interface WorldSettings extends ConfigObject {
|
||||
// Note that glitches can enable bedrock to be removed in ways that will not generate events.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles whether the player should be teleported on his island after it got created.
|
||||
* <br/>
|
||||
* If set to {@code true}, the player will be teleported right away.
|
||||
* <br/>
|
||||
* If set to {@code false}, the player will remain where he is and a message will be sent inviting him to teleport to his island.
|
||||
* <br/><br/>
|
||||
* This does not apply to any other occurrences such as island reset, or island join.
|
||||
* <br/><br/>
|
||||
* Default value: {@code true} (to retain backward compatibility).
|
||||
* @return {@code true} if the player should be teleported to his island, {@code false} otherwise.
|
||||
* @since 1.10.0
|
||||
*/
|
||||
default boolean isTeleportPlayerToIslandUponIslandCreation() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -838,4 +838,22 @@ public class IslandWorldManager {
|
||||
public boolean isPasteMissingIslands(@NonNull World world) {
|
||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isPasteMissingIslands();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles whether the player should be teleported on his island after it got created.
|
||||
* <br/>
|
||||
* If set to {@code true}, the player will be teleported right away.
|
||||
* <br/>
|
||||
* If set to {@code false}, the player will remain where he is and a message will be sent inviting him to teleport to his island.
|
||||
* <br/><br/>
|
||||
* This does not apply to any other occurrences such as island reset, or island join.
|
||||
* <br/><br/>
|
||||
* Default value: {@code true} (to retain backward compatibility).
|
||||
* @param world world, not null.
|
||||
* @return {@code true} if the player should be teleported to his island, {@code false} otherwise.
|
||||
* @since 1.10.0
|
||||
*/
|
||||
public boolean isTeleportPlayerToIslandUponIslandCreation(@NonNull World world) {
|
||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isTeleportPlayerToIslandUponIslandCreation();
|
||||
}
|
||||
}
|
||||
|
@ -238,11 +238,16 @@ public class NewIsland {
|
||||
}
|
||||
// Stop the player from falling or moving if they are
|
||||
if (user.isOnline()) {
|
||||
user.getPlayer().setVelocity(new Vector(0,0,0));
|
||||
user.getPlayer().setFallDistance(0F);
|
||||
if (reason.equals(Reason.RESET) || (reason.equals(Reason.CREATE) && plugin.getIWM().isTeleportPlayerToIslandUponIslandCreation(world))) {
|
||||
user.getPlayer().setVelocity(new Vector(0, 0, 0));
|
||||
user.getPlayer().setFallDistance(0F);
|
||||
|
||||
// Teleport player after this island is built
|
||||
plugin.getIslands().homeTeleport(world, user.getPlayer(), true);
|
||||
// Teleport player after this island is built
|
||||
plugin.getIslands().homeTeleport(world, user.getPlayer(), true);
|
||||
} else {
|
||||
// let's send him a message so that he knows he can teleport to his island!
|
||||
user.sendMessage("commands.island.create.you-can-teleport-to-your-island");
|
||||
}
|
||||
} else {
|
||||
// Remove the player again to completely clear the data
|
||||
User.removePlayer(user.getPlayer());
|
||||
|
@ -449,6 +449,7 @@ commands:
|
||||
pick: "&2 Pick an island"
|
||||
unknown-blueprint: "&c That blueprint has not been loaded yet."
|
||||
on-first-login: "&a Welcome! We will start preparing your island in a few seconds."
|
||||
you-can-teleport-to-your-island: "&a You can teleport to your island when you please."
|
||||
info:
|
||||
description: "display info about your island or the player's island"
|
||||
parameters: "<player>"
|
||||
|
Loading…
Reference in New Issue
Block a user