-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
Fresh build of Spigot.
/ver:[18:54:36 INFO]: This server is running CraftBukkit version git-Spigot-3cb9dcb-8b1588e (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT) [18:54:36 INFO]: Checking version, please wait... [18:54:37 INFO]: You are running the latest version
macOS 10.14.3 (test server)
Java = Java(TM) SE Runtime Environment (build 1.8.0_201-b09)Only one plugin that I am working on, no other plugins
Fresh build of Spigot. /ver: [18:54:36 INFO]: This server is running CraftBukkit version git-Spigot-3cb9dcb-8b1588e (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT) [18:54:36 INFO]: Checking version, please wait... [18:54:37 INFO]: You are running the latest version macOS 10.14.3 (test server) Java = Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Only one plugin that I am working on, no other plugins
-
CraftBukkit version git-Spigot-3cb9dcb-8b1588e
-
Yes
I just come to find out that the force player to sleep method does not seem to be doing its job.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/HumanEntity.html#sleep-org.bukkit.Location-boolean-
According to the docs, it should be able to force the player to sleep if conditions are not met.
" The game may also enforce other requirements such as proximity to bed, monsters, and dimension type if force is not set. " and "force - whether to try and sleep at the location even if not normally possible"
Here is the code I tested
@EventHandler public void enterBedTest(PlayerInteractEvent e) { if (e.getAction() == Action.RIGHT_CLICK_BLOCK) { e.setCancelled(true); Bukkit.broadcastMessage("Clicked block: " + e.getClickedBlock().getType() + " Player: " + e.getPlayer().getName()); if (e.getPlayer().sleep(e.getClickedBlock().getLocation(), true)) e.getPlayer().sendMessage("SLEEPY TIME"); else e.getPlayer().sendMessage("NO SLEEPY TIME"); } }
This code was just used for testing. I added the cancel to prevent the "You can only sleep at night message" If I remove the event cancel, I get the same outcome.
If it is night time, the player will sleep and get the message "SLEEPY TIME"
When it is daytime, the player is not forced to sleep and they get the message "NO SLEEPY TIME"
I included a short little video so you can see this in action (this video is taking forever to publish)
https://youtu.be/sIQyC_jv-U8