-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
Rabbit.getRabbitType() returns null when getting the Rabbit.Type for a brown rabbit
Tested with:
BunnyType.java
public class BunnyType extends JavaPlugin implements Listener { @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onInteract(PlayerInteractEntityEvent event) { Entity entity = event.getRightClicked(); if (entity.getType().equals(EntityType.RABBIT)) { Rabbit rabbit = (Rabbit) entity; Rabbit.Type rabbitType = rabbit.getRabbitType(); String type; if (rabbitType == null) { type = "type was NULL"; } else { type = rabbitType.toString(); } event.getPlayer().sendMessage("Rabbit Type: " + type); } } }
Spawn in a brown rabbit and right click it.