mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-18 22:31:21 +01:00
Only set the velocity if a player did successfully teleport. Issue #72
This commit is contained in:
parent
e3edcb88df
commit
1b42a25ccb
@ -267,12 +267,13 @@ public class MVTeleport {
|
||||
}
|
||||
|
||||
if (safeLoc != null) {
|
||||
e.teleport(safeLoc);
|
||||
if(e.teleport(safeLoc)) {
|
||||
if (!d.getVelocity().equals(new Vector(0, 0, 0))) {
|
||||
e.setVelocity(d.getVelocity());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.onarandombox.MultiverseCore.listeners.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -21,6 +22,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
@ -56,10 +58,6 @@ import com.onarandombox.MultiverseCore.commands.WhoCommand;
|
||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfig;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVConfigMigrator;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVCoreConfigMigrator;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPluginListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
|
||||
import com.onarandombox.utils.CannonDestination;
|
||||
import com.onarandombox.utils.DebugLog;
|
||||
import com.onarandombox.utils.DestinationFactory;
|
||||
@ -119,7 +117,6 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
getDataFolder().mkdirs();
|
||||
// Setup our Debug Log
|
||||
debugLog = new DebugLog("Multiverse-Core", getDataFolder() + File.separator + "debug.log");
|
||||
|
||||
}
|
||||
|
||||
public Configuration getConfig() {
|
||||
|
@ -126,8 +126,6 @@ public class TeleportCommand extends MultiverseCommand {
|
||||
}
|
||||
String message = ChatColor.GREEN + "Multiverse" + ChatColor.WHITE + " did not teleport " + ChatColor.AQUA + player + ChatColor.WHITE + " to " + ChatColor.DARK_AQUA + d.getName() + ChatColor.WHITE + " because it was unsafe.";
|
||||
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items, paramTypes, message, "Would you like to try anyway?", "", "", 15);
|
||||
} else {
|
||||
teleportee.setVelocity(d.getVelocity());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user