mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-15 05:33:40 +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;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue