diff --git a/pom.xml b/pom.xml
index 4ef6b93b..4128eff3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
com.comphenix.protocol
ProtocolLib
- 3.0.0-SNAPSHOT
+ 3.1.0
7.9.1-SNAPSHOT
diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java
index 4c60de93..6da5126e 100644
--- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java
+++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java
@@ -786,9 +786,9 @@ public class PacketsManager {
|| event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT
|| event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {
event.setCancelled(true);
- }
-
- else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {
+ } else if (event.getPacketType() == PacketType.Play.Server.BED) {
+ ReflectionManager.setAllowSleep(observer);
+ } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {
Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer(), event.getPlayer());
if (disguise.isSelfDisguiseSoundsReplaced() && !disguise.getType().isPlayer()
&& event.getPacket().getBytes().read(0) == (ReflectionManager.isAfter17() ? 2 : 1)) {
diff --git a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java
index e002cc0c..dca767c4 100644
--- a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java
+++ b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java
@@ -10,6 +10,7 @@ import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class ReflectionManager {
@@ -56,6 +57,17 @@ public class ReflectionManager {
}
}
+ public static void setAllowSleep(Player player) {
+ try {
+ Object nmsEntity = getNmsEntity(player);
+ Object connection = nmsEntity.getClass().getField("playerConnection").get(nmsEntity);
+ Field check = connection.getClass().getField("checkMovement");
+ check.setBoolean(connection, true);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
public static Object createEntityInstance(String entityName) {
try {
Class entityClass = getNmsClass("Entity" + entityName);