Skip to content

Commit

Permalink
Streamline Shoot command.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcernat committed Sep 4, 2013
1 parent cca5439 commit ec6e964
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 119 deletions.
42 changes: 37 additions & 5 deletions src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Expand Up @@ -38,6 +38,7 @@
import org.bukkit.entity.Villager;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;

public class dEntity implements dObject {

Expand Down Expand Up @@ -330,7 +331,7 @@ public boolean isLivingEntity() {

public NPC getNPC() {

return CitizensAPI.getNPCRegistry().getNPC(getBukkitEntity());
return CitizensAPI.getNPCRegistry().getNPC(entity);
}

/**
Expand All @@ -340,7 +341,7 @@ public NPC getNPC() {
*/

public boolean isNPC() {
return CitizensAPI.getNPCRegistry().isNPC(getBukkitEntity());
return CitizensAPI.getNPCRegistry().isNPC(entity);
}

/**
Expand All @@ -351,7 +352,7 @@ public boolean isNPC() {

public Player getPlayer() {

return (Player) getBukkitEntity();
return (Player) entity;
}

/**
Expand All @@ -361,7 +362,7 @@ public Player getPlayer() {
*/

public boolean isPlayer() {
return getBukkitEntity() instanceof Player;
return entity instanceof Player;
}

/**
Expand All @@ -385,7 +386,7 @@ public boolean isGeneric() {
public dLocation getLocation() {

if (!isGeneric()) {
return new dLocation(getBukkitEntity().getLocation());
return new dLocation(entity.getLocation());
}

return null;
Expand All @@ -406,6 +407,32 @@ public dLocation getEyeLocation() {
return null;
}

/**
* Gets the velocity of this entity
*
* @return The velocity's vector
*/

public Vector getVelocity() {

if (!isGeneric()) {
return entity.getVelocity();
}
return null;
}

/**
* Sets the velocity of this entity
*
*/

public void setVelocity(Vector vector) {

if (!isGeneric()) {
entity.setVelocity(vector);
}
}

public void spawnAt(Location location) {
// If the entity is already spawned, teleport it.
if (entity != null && isUnique()) entity.teleport(location);
Expand Down Expand Up @@ -583,6 +610,11 @@ else if (entity != null)
public boolean isSpawned() {
return entity != null;
}

public boolean isValid() {

return entity.isValid();
}

public void remove() {
entity.remove();
Expand Down
Expand Up @@ -1527,7 +1527,7 @@ public void registerCoreMembers() {

// <--[command]
// @Name Shoot
// @Usage shoot [<entity>|...] (origin:<entity>/<location>) (destination:<location>) [{calculated} (height:<#.#>) (gravity:<#.#>)]/[custom speed:<#.#> duration:<value>] (script:<name>)
// @Usage shoot [<entity>|...] (origin:<entity>/<location>) (destination:<location>) (height:<#.#>) (gravity:<#.#>) (script:<name>))
// @Required 1
// @Stable Todo
// @Short Todo
Expand All @@ -1542,7 +1542,7 @@ public void registerCoreMembers() {
// Todo
// -->
registerCoreMember(ShootCommand.class,
"SHOOT", "shoot [<entity>|...] (origin:<entity>/<location>) (destination:<location>) [{calculated} (height:<#.#>) (gravity:<#.#>)]/[custom speed:<#.#> duration:<value>] (script:<name>)", 1);
"SHOOT", "shoot [<entity>|...] (origin:<entity>/<location>) (destination:<location>) (height:<#.#>) (gravity:<#.#>) (script:<name>)", 1);

// <--[command]
// @Name ShowFake
Expand Down

0 comments on commit ec6e964

Please sign in to comment.