From c98b427fdebb0d8abcce3a17731c0f9b35eece01 Mon Sep 17 00:00:00 2001 From: xGamingDudex Date: Tue, 1 Dec 2015 00:46:20 +0100 Subject: [PATCH] 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... --- .../src/mineplex/core/mount/MountData.java | 43 +++++++++++++++++++ .../core/mount/SingleEntityMountData.java | 35 +++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/mount/SingleEntityMountData.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java new file mode 100644 index 000000000..6c025dc0e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java @@ -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 getEntityParts(); + + public boolean ownsMount(Player p) + { + return _owner.equals(p); + } + + public Player getOwner() + { + return _owner; + } + + public void remove() + { + for(Entity e : getEntityParts()) + { + e.remove(); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/SingleEntityMountData.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/SingleEntityMountData.java new file mode 100644 index 000000000..eab47b74c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/SingleEntityMountData.java @@ -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 extends MountData +{ + + protected T Entity; + + public SingleEntityMountData(Player player, T ent) + { + super(player); + Entity = ent; + } + + @Override + public List getEntityParts() + { + List list = new ArrayList(); + list.add(Entity); + return list; + } + + public T getEntity() + { + return Entity; + } + + + +}