Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Shoot command use new argument system. Example syntax: - shoot s…
…ource:p@davidcernat projectile:falling_block
- Loading branch information
1 parent
db1fc9e
commit aa55664
Showing
3 changed files
with
119 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/net/aufdemrand/denizen/utilities/entity/Position.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package net.aufdemrand.denizen.utilities.entity; | ||
|
||
import java.util.List; | ||
|
||
import org.bukkit.entity.Entity; | ||
|
||
public class Position { | ||
|
||
/** | ||
* Mounts a list of entities on top of each other. | ||
* | ||
* @param entities The list of entities | ||
*/ | ||
|
||
public static void mount(List<Entity> entities) { | ||
|
||
Entity lastEntity = null; | ||
|
||
for (Entity entity : entities) { | ||
|
||
if (lastEntity != null) { | ||
// Because setPassenger() is a toggle, only use it if the new passenger | ||
// is not already the current passenger | ||
|
||
if (entity.getPassenger() != lastEntity) { | ||
lastEntity.teleport(entity.getLocation()); | ||
entity.setPassenger(lastEntity); | ||
} | ||
} | ||
|
||
lastEntity = entity; | ||
} | ||
} | ||
|
||
/** | ||
* Dismounts a list of entities. | ||
* | ||
* @param entities The list of entities | ||
*/ | ||
public static void dismount(List<Entity> entities) { | ||
|
||
for (Entity entity : entities) { | ||
|
||
entity.leaveVehicle(); | ||
} | ||
} | ||
} |