mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-24 00:51:41 +01:00
Set sleep status every tick for now (only necessary on 1.14 and below)
This commit is contained in:
parent
d9c55b97b0
commit
9d0028541e
@ -2,6 +2,7 @@ package net.citizensnpcs.trait;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.MemoryNPCDataStore;
|
||||
@ -53,6 +54,8 @@ public class SitTrait extends Trait {
|
||||
if (holder.getEntity() != null && !NMS.getPassengers(holder.getEntity()).contains(npc.getEntity())) {
|
||||
NMS.mount(holder.getEntity(), npc.getEntity());
|
||||
}
|
||||
|
||||
holder.teleport(sittingAt, TeleportCause.PLUGIN);
|
||||
}
|
||||
|
||||
public void setSitting(Location at) {
|
||||
|
@ -4,7 +4,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.block.Bed;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
@ -30,18 +29,14 @@ public class SleepTrait extends Trait {
|
||||
public void run() {
|
||||
if (!npc.isSpawned())
|
||||
return;
|
||||
if (sleeping) {
|
||||
if (at == null) {
|
||||
|
||||
if (at == null) {
|
||||
if (sleeping) {
|
||||
wakeup();
|
||||
} else {
|
||||
npc.teleport(at, TeleportCause.PLUGIN);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (at == null)
|
||||
return;
|
||||
|
||||
if (SUPPORT_BLOCKDATA == null) {
|
||||
try {
|
||||
SUPPORT_BLOCKDATA = true;
|
||||
@ -50,6 +45,7 @@ public class SleepTrait extends Trait {
|
||||
SUPPORT_BLOCKDATA = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (npc.getEntity() instanceof Player) {
|
||||
Player player = (Player) npc.getEntity();
|
||||
if ((SUPPORT_BLOCKDATA && at.getBlock().getBlockData() instanceof Bed)
|
||||
|
Loading…
Reference in New Issue
Block a user