Remove incorrect JavaDoc and forced use of SafeSpotTeleport builder

This commit is contained in:
tastybento 2020-04-04 08:20:32 -07:00
parent a0dcb15026
commit 63e6f244bd
1 changed files with 6 additions and 7 deletions

View File

@ -52,14 +52,9 @@ public class SafeSpotTeleport {
/**
* Teleports and entity to a safe spot on island
* @param plugin - plugin object
* @param entity - entity to teleport
* @param location - the location initial desired location to go to
* @param failureMessage - locale key for the failure message
* @param portal - true if this is a portal teleport
* @param homeNumber - home number to go to
* @param builder - safe spot teleport builder
*/
public SafeSpotTeleport(Builder builder) {
SafeSpotTeleport(Builder builder) {
this.plugin = builder.getPlugin();
this.entity = builder.getEntity();
this.location = builder.getLocation();
@ -72,6 +67,7 @@ public class SafeSpotTeleport {
// If the desired location is safe, then that's where you'll go if there's no portal
bestSpot = location;
} else {
plugin.logDebug("Insta teleport Player's velocity = " + entity.getVelocity());
// If this is not a portal teleport, then go to the safe location immediately
Util.teleportAsync(entity, location).thenRun(() -> {
if (runnable != null) Bukkit.getScheduler().runTask(plugin, runnable);
@ -155,6 +151,7 @@ public class SafeSpotTeleport {
location.getBlock().setType(Material.AIR, false);
location.getBlock().getRelative(BlockFace.UP).setType(Material.AIR, false);
location.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP).setType(m, false);
plugin.logDebug("Make and teleport Player's velocity = " + entity.getVelocity());
Util.teleportAsync(entity, location.clone().add(new Vector(0.5D, 0D, 0.5D))).thenRun(() -> {
if (runnable != null) Bukkit.getScheduler().runTask(plugin, runnable);
});
@ -237,7 +234,9 @@ public class SafeSpotTeleport {
plugin.getPlayers().setHomeLocation(User.getInstance(entity), loc, homeNumber);
}
// Return to main thread and teleport the player
plugin.logDebug("Safe teleport spot Player's velocity = " + entity.getVelocity());
Bukkit.getScheduler().runTask(plugin, () -> Util.teleportAsync(entity, loc).thenRun(() -> {
plugin.logDebug("Teleported. Player's velocity = " + entity.getVelocity());
if (runnable != null) Bukkit.getScheduler().runTask(plugin, runnable);
}));
}