mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-14 05:01:28 +00:00
Cleanup ITarget
This commit is contained in:
parent
ac6b74887f
commit
98e427e831
2 changed files with 2 additions and 16 deletions
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue