Add a fix to prevent players from teleporting to others and being below

them when riding vehicles. This would usually cause them to fall through
blocks in for example rail systems that are suspended.
This commit is contained in:
sigonasr2 2013-11-20 03:26:04 -07:00
parent df4abe0ef5
commit c46c4e52df

View File

@ -1580,11 +1580,19 @@ public String convertToItemName(String val) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
p2.teleport(target2); if (target2.isInsideVehicle()) {
p2.teleport(target2.getLocation().add(0,1,0));
} else {
p2.teleport(target2);
}
} }
},5); },5);
} else { } else {
p.teleport(target); if (target.isInsideVehicle()) {
p.teleport(target.getLocation().add(0,1,0));
} else {
p.teleport(target);
}
} }
} else { } else {
p.sendMessage("You need $"+ChatColor.YELLOW+df.format(finalcost)+" in the bank to teleport to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+"!"); p.sendMessage("You need $"+ChatColor.YELLOW+df.format(finalcost)+" in the bank to teleport to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+"!");