mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-07-01 08:54:54 +02:00
1.8.8 compat
This commit is contained in:
parent
4212921a98
commit
57d27f39ee
|
@ -48,12 +48,21 @@ public class SleepTrait extends Trait {
|
||||||
|
|
||||||
if (npc.getEntity() instanceof Player) {
|
if (npc.getEntity() instanceof Player) {
|
||||||
Player player = (Player) npc.getEntity();
|
Player player = (Player) npc.getEntity();
|
||||||
|
if (!SUPPORT_BLOCKSTATE) {
|
||||||
|
NMS.sleep(player, true);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
if ((SUPPORT_BLOCKDATA && at.getBlock().getBlockData() instanceof Bed)
|
if ((SUPPORT_BLOCKDATA && at.getBlock().getBlockData() instanceof Bed)
|
||||||
|| at.getBlock().getState() instanceof Bed) {
|
|| at.getBlock().getState() instanceof Bed) {
|
||||||
player.sleep(at, true);
|
player.sleep(at, true);
|
||||||
} else {
|
} else {
|
||||||
NMS.sleep(player, true);
|
NMS.sleep(player, true);
|
||||||
}
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
SUPPORT_BLOCKSTATE = false;
|
||||||
|
NMS.sleep(player, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
sleeping = true;
|
sleeping = true;
|
||||||
} else if (npc.getEntity() instanceof Villager) {
|
} else if (npc.getEntity() instanceof Villager) {
|
||||||
sleeping = ((Villager) npc.getEntity()).sleep(at);
|
sleeping = ((Villager) npc.getEntity()).sleep(at);
|
||||||
|
@ -75,4 +84,5 @@ public class SleepTrait extends Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean SUPPORT_BLOCKDATA = null;
|
private static Boolean SUPPORT_BLOCKDATA = null;
|
||||||
|
private static boolean SUPPORT_BLOCKSTATE = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user