Added missing MountData and SingleEntityMountData files.
For some reason, git decided that it was a good idea to remove these two files from the index...
This commit is contained in:
parent
6120c8246b
commit
c98b427fde
43
Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java
Normal file
43
Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java
Normal file
@ -0,0 +1,43 @@
|
||||
package mineplex.core.mount;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class MountData
|
||||
{
|
||||
|
||||
protected Player _owner;
|
||||
|
||||
public MountData(Player player)
|
||||
{
|
||||
_owner = player;
|
||||
}
|
||||
|
||||
public boolean isPartOfMount(Entity ent)
|
||||
{
|
||||
return getEntityParts().contains(ent);
|
||||
}
|
||||
|
||||
public abstract List<Entity> getEntityParts();
|
||||
|
||||
public boolean ownsMount(Player p)
|
||||
{
|
||||
return _owner.equals(p);
|
||||
}
|
||||
|
||||
public Player getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public void remove()
|
||||
{
|
||||
for(Entity e : getEntityParts())
|
||||
{
|
||||
e.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package mineplex.core.mount;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SingleEntityMountData<T extends Entity> extends MountData
|
||||
{
|
||||
|
||||
protected T Entity;
|
||||
|
||||
public SingleEntityMountData(Player player, T ent)
|
||||
{
|
||||
super(player);
|
||||
Entity = ent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntityParts()
|
||||
{
|
||||
List<Entity> list = new ArrayList<Entity>();
|
||||
list.add(Entity);
|
||||
return list;
|
||||
}
|
||||
|
||||
public T getEntity()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user