Cleanup ITarget

This commit is contained in:
KHobbits 2013-06-08 21:43:42 +01:00
parent ac6b74887f
commit 98e427e831
2 changed files with 2 additions and 16 deletions

View file

@ -1,28 +1,20 @@
package com.earth2me.essentials; package com.earth2me.essentials;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server;
public class LocationTarget implements ITarget public class LocationTarget implements ITarget
{ {
private final Location location; private final Location location;
private final String name;
LocationTarget(Location location) LocationTarget(Location location)
{ {
this.location = location; this.location = location;
this.name = null;
} }
@Override @Override
public Location getLocation(Server server) public Location getLocation()
{ {
if (this.name != null)
{
return server.getPlayerExact(name).getLocation();
}
return location; return location;
} }
} }

View file

@ -7,22 +7,16 @@ import org.bukkit.entity.Player;
public class PlayerTarget implements ITarget public class PlayerTarget implements ITarget
{ {
private final Location location;
private final String name; private final String name;
PlayerTarget(Player entity) PlayerTarget(Player entity)
{ {
this.name = entity.getName(); this.name = entity.getName();
this.location = null;
} }
@Override @Override
public Location getLocation() public Location getLocation()
{
if (this.name != null)
{ {
return Bukkit.getServer().getPlayerExact(name).getLocation(); return Bukkit.getServer().getPlayerExact(name).getLocation();
} }
return location;
}
} }