Skip to content

Commit

Permalink
Cleared block sending before teleport because it was causing weird block
Browse files Browse the repository at this point in the history
artifacts to appear.
  • Loading branch information
tastybento committed Jan 18, 2015
1 parent 4431962 commit f91b08e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
14 changes: 10 additions & 4 deletions src/com/wasteofplastic/askyblock/ASkyBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,17 +496,19 @@ protected boolean homeTeleport(final Player player) {
if (home == null) {
// The home is not safe
if (!player.performCommand(Settings.SPAWNCOMMAND)) {
player.teleport(player.getWorld().getSpawnLocation());
/*
player.sendBlockChange(player.getWorld().getSpawnLocation()
,player.getWorld().getSpawnLocation().getBlock().getType()
,player.getWorld().getSpawnLocation().getBlock().getData());
player.teleport(player.getWorld().getSpawnLocation());
*/
}
player.sendMessage(ChatColor.RED + Locale.warpserrorNotSafe);
return true;
}
//home.getWorld().refreshChunk(home.getChunk().getX(), home.getChunk().getZ());
// Removing this line because it appears to cause artifacts of hovering blocks
//home.getWorld().loadChunk(home.getChunk());
home.getWorld().loadChunk(home.getChunk());
//getLogger().info("DEBUG: " + home.toString());
// This next line should help players with long ping times
// http://bukkit.org/threads/workaround-for-playing-falling-after-teleport-when-lagging.293035/
Expand All @@ -515,7 +517,11 @@ protected boolean homeTeleport(final Player player) {
//player.sendBlockChange(home.getBlock().getRelative(BlockFace.DOWN).getLocation(),home.getBlock().getRelative(BlockFace.DOWN).getType(),home.getBlock().getRelative(BlockFace.DOWN).getData());
//getLogger().info("DEBUG: " + home.getBlock().getType().toString());
//getLogger().info("DEBUG: " + home.getBlock().getRelative(BlockFace.DOWN).getType());
player.teleport(home);
player.teleport(home);
/*
player.sendBlockChange(home,home.getBlock().getType(),home.getBlock().getData());
player.sendBlockChange(home.getBlock().getRelative(BlockFace.DOWN).getLocation(),home.getBlock().getRelative(BlockFace.DOWN).getType(),home.getBlock().getRelative(BlockFace.DOWN).getData());
*/
player.sendMessage(ChatColor.GREEN + Locale.islandteleport);
return true;
}
Expand Down Expand Up @@ -1924,10 +1930,10 @@ protected void removeMobsFromIsland(final Location loc) {
// Move player to spawn
if (plugin.getSpawn().getSpawnLoc() != null) {
// go to island spawn
pl.teleport(plugin.getSpawn().getSpawnLoc());
pl.sendBlockChange(plugin.getSpawn().getSpawnLoc()
,plugin.getSpawn().getSpawnLoc().getBlock().getType()
,plugin.getSpawn().getSpawnLoc().getBlock().getData());
pl.teleport(plugin.getSpawn().getSpawnLoc());
getLogger().warning("During island deletion player " + pl.getName() + " sent to spawn.");
} else {
if (!pl.performCommand(Settings.SPAWNCOMMAND)) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/wasteofplastic/askyblock/AdminCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ public void run() {
Location safeSpot = plugin.getSafeHomeLocation(playerUUID);
if (safeSpot != null) {
// This next line should help players with long ping times
((Player)sender).sendBlockChange(safeSpot,safeSpot.getBlock().getType(),safeSpot.getBlock().getData());
((Player)sender).teleport(safeSpot);
//((Player)sender).sendBlockChange(safeSpot,safeSpot.getBlock().getType(),safeSpot.getBlock().getData());
} else {
sender.sendMessage(ChatColor.RED + Locale.warpserrorNotSafe);
Location warpSpot = plugin.getPlayers().getIslandLocation(playerUUID);
Expand Down
8 changes: 6 additions & 2 deletions src/com/wasteofplastic/askyblock/IslandCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,15 @@ public void run() {
// go to spawn
//plugin.getLogger().info("Debug: getSpawn" + plugin.getSpawn().toString() );
//plugin.getLogger().info("Debug: getSpawn loc" + plugin.getSpawn().getSpawnLoc().toString() );
player.teleport(plugin.getSpawn().getSpawnLoc());
/*
player.sendBlockChange(plugin.getSpawn().getSpawnLoc()
,plugin.getSpawn().getSpawnLoc().getBlock().getType()
,plugin.getSpawn().getSpawnLoc().getBlock().getData());
player.sendBlockChange(plugin.getSpawn().getSpawnLoc().getBlock().getRelative(BlockFace.DOWN).getLocation()
,plugin.getSpawn().getSpawnLoc().getBlock().getRelative(BlockFace.DOWN).getType()
,plugin.getSpawn().getSpawnLoc().getBlock().getRelative(BlockFace.DOWN).getData());
player.teleport(plugin.getSpawn().getSpawnLoc());
*/
return true;
} else if (split[0].equalsIgnoreCase("top")) {
if (VaultHelper.checkPerm(player, Settings.PERMPREFIX + "island.topten")) {
Expand Down Expand Up @@ -1433,10 +1435,12 @@ public void run() {
} else {
// Just move target to spawn
if (!target.performCommand(Settings.SPAWNCOMMAND)) {
target.teleport(player.getWorld().getSpawnLocation());
/*
target.sendBlockChange(target.getWorld().getSpawnLocation()
,target.getWorld().getSpawnLocation().getBlock().getType()
,target.getWorld().getSpawnLocation().getBlock().getData());
target.teleport(player.getWorld().getSpawnLocation());
*/
}
}
target.sendMessage(ChatColor.RED + Locale.expelExpelled);
Expand Down
2 changes: 1 addition & 1 deletion src/com/wasteofplastic/askyblock/NetherPortals.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public void onPlayerPortal(PlayerPortalEvent event) {
event.setCancelled(true);
Location end_place = plugin.getServer().getWorld(Settings.worldName + "_the_end").getSpawnLocation();
if (ASkyBlock.isSafeLocation(end_place)) {
event.getPlayer().sendBlockChange(end_place, end_place.getBlock().getType(),end_place.getBlock().getData());
event.getPlayer().teleport(end_place);
//event.getPlayer().sendBlockChange(end_place, end_place.getBlock().getType(),end_place.getBlock().getData());
return;
} else {
event.getPlayer().sendMessage(ChatColor.RED + Locale.warpserrorNotSafe);
Expand Down

0 comments on commit f91b08e

Please sign in to comment.