[Bleeding] Add ProjectileSource interface. Addresses BUKKIT-1038, BUKKIT-1156

By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
Bukkit/Spigot
2014-01-26 20:08:28 -05:00
parent b3c27cf60d
commit 03235e2288
6 changed files with 87 additions and 21 deletions

View File

@@ -0,0 +1,13 @@
package org.bukkit.projectiles;
import org.bukkit.block.Block;
public interface BlockProjectileSource extends ProjectileSource {
/**
* Gets the block this projectile source belongs to.
*
* @return Block for the projectile source
*/
public Block getBlock();
}

View File

@@ -0,0 +1,28 @@
package org.bukkit.projectiles;
import org.bukkit.entity.Projectile;
import org.bukkit.util.Vector;
/**
* Represents a valid source of a projectile.
*/
public interface ProjectileSource {
/**
* Launches a {@link Projectile} from the ProjectileSource.
*
* @param projectile class of the projectile to launch
* @return the launched projectile
*/
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile);
/**
* Launches a {@link Projectile} from the ProjectileSource with an
* initial velocity.
*
* @param projectile class of the projectile to launch
* @param velocity the velocity with which to launch
* @return the launched projectile
*/
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity);
}