Merge pull request #238 from ammaraskar/crash

Fix /lb tp crash (fixes #218) and remove unused import
This commit is contained in:
md-5
2012-09-21 16:23:13 -07:00
2 changed files with 11 additions and 2 deletions

View File

@@ -552,7 +552,17 @@ public class CommandsHandler implements CommandExecutor
final Location loc = new Location(params.world, rs.getInt(1) + 0.5, y, rs.getInt(3) + 0.5, player.getLocation().getYaw(), 90); final Location loc = new Location(params.world, rs.getInt(1) + 0.5, y, rs.getInt(3) + 0.5, player.getLocation().getYaw(), 90);
final int y2 = saveSpawnHeight(loc); final int y2 = saveSpawnHeight(loc);
loc.setY(y2); loc.setY(y2);
player.teleport(loc);
// Teleport the player sync because omg thread safety
logblock.getServer().getScheduler().scheduleSyncDelayedTask(logblock, new Runnable() {
@Override
public void run() {
player.teleport(loc);
}
});
sender.sendMessage(ChatColor.GREEN + "You were teleported " + Math.abs(y2 - y) + " blocks " + (y2 - y > 0 ? "above" : "below")); sender.sendMessage(ChatColor.GREEN + "You were teleported " + Math.abs(y2 - y) + " blocks " + (y2 - y > 0 ? "above" : "below"));
} else } else
sender.sendMessage(ChatColor.RED + "No block change found to teleport to"); sender.sendMessage(ChatColor.RED + "No block change found to teleport to");

View File

@@ -13,7 +13,6 @@ import static de.diddiz.LogBlock.config.Config.url;
import static de.diddiz.LogBlock.config.Config.useBukkitScheduler; import static de.diddiz.LogBlock.config.Config.useBukkitScheduler;
import static de.diddiz.LogBlock.config.Config.user; import static de.diddiz.LogBlock.config.Config.user;
import static org.bukkit.Bukkit.getPluginManager; import static org.bukkit.Bukkit.getPluginManager;
import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;