diff options
author | James Clarke <jamesrtclarke@me.com> | 2012-11-05 18:09:38 +0000 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-11-17 10:05:53 -0600 |
commit | bc5e54d9041e9f3a279424f8b2fa39880cf4cb99 (patch) | |
tree | 6cc8cefefcc59d1d7299f5658686fee5b69a3c22 /src/main/java | |
parent | b854d0ee34ef40b3c4e90d2cabd4e4150f7a6bf6 (diff) | |
download | bukkit-bc5e54d9041e9f3a279424f8b2fa39880cf4cb99.tar bukkit-bc5e54d9041e9f3a279424f8b2fa39880cf4cb99.tar.gz bukkit-bc5e54d9041e9f3a279424f8b2fa39880cf4cb99.tar.lz bukkit-bc5e54d9041e9f3a279424f8b2fa39880cf4cb99.tar.xz bukkit-bc5e54d9041e9f3a279424f8b2fa39880cf4cb99.zip |
Add API for getting and setting Skeleton and Zombie types. Fixes BUKKIT-2818
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/entity/Skeleton.java | 56 | ||||
-rw-r--r-- | src/main/java/org/bukkit/entity/Zombie.java | 30 |
2 files changed, 84 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java index f362e57c..c91b1039 100644 --- a/src/main/java/org/bukkit/entity/Skeleton.java +++ b/src/main/java/org/bukkit/entity/Skeleton.java @@ -3,4 +3,58 @@ package org.bukkit.entity; /** * Represents a Skeleton. */ -public interface Skeleton extends Monster {} +public interface Skeleton extends Monster { + /** + * Gets the current type of this skeleton. + * + * @return Current type + */ + public SkeletonType getSkeletonType(); + + /** + * Sets the new type of this skeleton. + * + * @param type New type + */ + public void setSkeletonType(SkeletonType type); + + /* + * Represents the various different Skeleton types. + */ + public enum SkeletonType { + NORMAL(0), + WITHER(1); + + private static final SkeletonType[] types = new SkeletonType[SkeletonType.values().length]; + private final int id; + + static { + for (SkeletonType type : values()) { + types[type.getId()] = type; + } + } + + private SkeletonType(int id) { + this.id = id; + } + + /** + * Gets the ID of this skeleton type. + * + * @return Skeleton type ID + */ + public int getId() { + return id; + } + + /** + * Gets a skeleton type by its ID. + * + * @param id ID of the skeleton type to get. + * @return Resulting skeleton type, or null if not found. + */ + public static SkeletonType getType(int id) { + return (id >= types.length) ? null : types[id]; + } + } +} diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java index 3bbbad3d..7f1ffd19 100644 --- a/src/main/java/org/bukkit/entity/Zombie.java +++ b/src/main/java/org/bukkit/entity/Zombie.java @@ -3,4 +3,32 @@ package org.bukkit.entity; /** * Represents a Zombie. */ -public interface Zombie extends Monster {} +public interface Zombie extends Monster { + /** + * Gets whether the zombie is a baby + * + * @return Whether the zombie is a baby + */ + public boolean isBaby(); + + /** + * Sets whether the zombie is a baby + * + * @param flag Whether the zombie is a baby + */ + public void setBaby(boolean flag); + + /** + * Gets whether the zombie is a villager + * + * @return Whether the zombie is a villager + */ + public boolean isVillager(); + + /** + * Sets whether the zombie is a villager + * + * @param flag Whether the zombie is a villager + */ + public void setVillager(boolean flag); +} |