Eliminate some errors.

This commit is contained in:
Steven Lawson 2011-10-27 20:37:30 -04:00
parent 91eae5163d
commit 342ece9934
3 changed files with 28 additions and 6 deletions

View File

@ -50,7 +50,17 @@ public class Command_expel extends TFM_Command
if (!p.equals(sender_p)) if (!p.equals(sender_p))
{ {
Location target_pos = p.getLocation(); Location target_pos = p.getLocation();
if (target_pos.distance(sender_pos) < radius)
boolean in_range = false;
try
{
in_range = target_pos.distance(sender_pos) < radius;
}
catch (IllegalArgumentException ex)
{
}
if (in_range)
{ {
sender.sendMessage("Pushing " + p.getName()); sender.sendMessage("Pushing " + p.getName());
Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize(); Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize();

View File

@ -31,7 +31,13 @@ public class Command_radar extends TFM_Command
{ {
if (!p.equals(sender_p)) if (!p.equals(sender_p))
{ {
radar_data.add(new TFM_RadarData(p, sender_pos.distance(p.getLocation()), p.getLocation())); try
{
radar_data.add(new TFM_RadarData(p, sender_pos.distance(p.getLocation()), p.getLocation()));
}
catch (IllegalArgumentException ex)
{
}
} }
} }

View File

@ -31,15 +31,21 @@ public class TFM_Heartbeat implements Runnable
if (plugin.disableNight) if (plugin.disableNight)
{ {
for (World world : Bukkit.getWorlds()) try
{ {
if (world.getTime() > 12000L) for (World world : Bukkit.getWorlds())
{ {
TFM_Util.setWorldTime(world, 1000L); if (world.getTime() > 12000L)
{
TFM_Util.setWorldTime(world, 1000L);
}
} }
} }
catch (NullPointerException ex)
{
}
} }
if (plugin.disableWeather) if (plugin.disableWeather)
{ {
for (World world : Bukkit.getWorlds()) for (World world : Bukkit.getWorlds())