SPIGOT-5180: Add Villager#sleep() and #wakeup() methods

By: LelouBil <bilel.jahid@gmail.com>
This commit is contained in:
Bukkit/Spigot 2019-07-22 00:00:36 +02:00
parent 63ec9ca6be
commit 17034cc249

View File

@ -2,6 +2,7 @@ package org.bukkit.entity;
import java.util.Locale;
import org.bukkit.Keyed;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull;
@ -76,6 +77,25 @@ public interface Villager extends AbstractVillager {
*/
public void setVillagerExperience(int experience);
/**
* Attempts to make this villager sleep at the given location.
* <br>
* The location must be in the current world and have a bed placed at the
* location. The villager will put its head on the specified block while
* sleeping.
*
* @param location the location of the bed
* @return whether the sleep was successful
*/
public boolean sleep(@NotNull Location location);
/**
* Causes this villager to wake up if he's currently sleeping.
*
* @throws IllegalStateException if not sleeping
*/
public void wakeup();
/**
* Represents Villager type, usually corresponding to what biome they spawn
* in.