mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-25 13:49:12 +02:00
Cleanup ITarget
This commit is contained in:
@@ -1,28 +1,20 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
|
||||
|
||||
public class LocationTarget implements ITarget
|
||||
{
|
||||
private final Location location;
|
||||
private final String name;
|
||||
|
||||
LocationTarget(Location location)
|
||||
{
|
||||
this.location = location;
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation(Server server)
|
||||
public Location getLocation()
|
||||
{
|
||||
if (this.name != null)
|
||||
{
|
||||
|
||||
return server.getPlayerExact(name).getLocation();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
}
|
@@ -7,22 +7,16 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerTarget implements ITarget
|
||||
{
|
||||
private final Location location;
|
||||
private final String name;
|
||||
|
||||
PlayerTarget(Player entity)
|
||||
{
|
||||
this.name = entity.getName();
|
||||
this.location = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation()
|
||||
{
|
||||
if (this.name != null)
|
||||
{
|
||||
return Bukkit.getServer().getPlayerExact(name).getLocation();
|
||||
}
|
||||
return location;
|
||||
return Bukkit.getServer().getPlayerExact(name).getLocation();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user