mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-25 21:59:08 +02:00
Cleanup ITarget
This commit is contained in:
@@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user