13
0
geforkt von Mirrors/Paper

Add API for getting and setting Skeleton and Zombie types. Fixes BUKKIT-2818

By: James Clarke <jamesrtclarke@me.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2012-11-05 18:09:38 +00:00
Ursprung 0a9f6c2cc2
Commit e788e4799e
2 geänderte Dateien mit 84 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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];
}
}
}

Datei anzeigen

@ -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);
}