Code Monkey home page Code Monkey logo

singleplayersleep's Introduction

SinglePlayerSleep

Download Links

https://www.spigotmc.org/resources/single-player-sleep.68139/

https://dev.bukkit.org/projects/singleplayersleep2

Introduction

First Off, I watch several Hermitcrafters, and after seeing them have issues with their Single Player Sleep command block, rain messes it up. I decided to make this simple plugin.

Description

When a player right clicks on a bed, the plugin broadcasts <player> is sleeping [CANCEL], if no one clicks on Cancel, then after 10 seconds the plugin will advance the time ahead to the next morning. Thus the day and difficulty is not affected. The plugin also checks for storms, and if the player has the permissions, it will clear them. There is also a permission for the Cancel command.

Permissions

sps.update - description: Allows the player to check for updates.
    
sps.unrestricted - Allows the player to sleep uninterrupted. Other players will not be able to cancel it.

sps.hermits - Allows player to sleep when other players are online.

sps.downfall - Allows player to clear downfall.

sps.thunder - Allows player to clear thunderstorm.

sps.cancel - Allows player to cancel SPS of other players
    
sp.command - Allows player to use /sleep command, instead of a bed.

sps.* - Admin, grants all sps permissions.

If the player is the only player online, then the bed functions as normal, since the sleep function works before the 10 second delay.

*/sleep still requires it to be night or storming to use. ie - after 13187

Contributing

Building the jar

Thanks to maven, building the jar is easy. However, most of this project's dependencies are not available on a maven repository. As such, their jars have to be downloaded individually and added to the local maven repository. Due to potential licencing conflicts, spigot is not included for the time being; you'll have to build that yourself.

Fortunately, all of this can be pretty easy if you do the following. (Note that if you're using an IDE there's an option somewhere to run maven commands so you don't have to use a shell.)

  1. Add the spigot server jar to the lib folder.
    • NOTE: You'll need to go to their website and follow the instructions for using "buildtools.java" to create it.
  2. Run this maven command in your project directory: mvn validate
    • What does this do? Validate will install these jars into your local maven repository so when it comes time to package everything maven knows where to look. (You can find your local repository in your user directory, under .m2.)
  3. Run this maven command in your project directory: mvn package
    • NOTE: The default version is "local-SNAPSHOT." If you want it to be something else, add the -Drevision= flag to the package command.
  4. Ta-da! You're done!

singleplayersleep's People

Contributors

artick avatar britooo09 avatar icrusai avatar imdabigboss avatar joelgodofwar avatar johntrapp avatar malonehedges avatar peprolinbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

singleplayersleep's Issues

Feature: Prefix

Allow for the ability to change prefix with color codes, I like to keep the plugins under the same message format and this would make it a lot better!

Plugin needs update.

This plugin needs updating to 1.10. I need a way to get one player sleep in 1.10 survival.

players can re-sleep immediately uninterrupted

Hello, having some weird issues while testing this out: [ Paper 1.15.2 | Win10HostVM | Java8u241 | SPS 1.13_2.13.34 ]

  1. can't use multiple formatting values (Trying to use BOLD and YELLOW for sleepmsgcolor) not sure how to state this in config correctly.
    1b. adding a character (space or anything) adds those characters before & after the player name as well as after the cancel text (this is actually wierd to me) https://i.gyazo.com/08df31a4c940207a6ca29e01d5a6e4b1.png
  2. if a player sleeps. and someone cancels it, they can just jump back in bed uninterrupted while anyone trying to cancel it again is told there is nothing to cancel
    If this is because i'm resetting (day/night) manullay before a timer runs out, the timer should be reset immediately upon action taken.
    And/or if the player tried to sleep again, within x time it should tell the player 'sleep was canceled by when they click the bed (if broadcast is disabled) and say something like sleeping disabled for x seconds, please try again later.

config - Copy.txt

PS. the discord link(s) on your plugin's page's are invalid ><

Inconsistency between ability to click left and right hand brackets of the [Cancel] sleep chat component.

What behaviour is expected:

The left and right hand brackets of the [CANCEL] button chat component that appears when someone enters a bed would either both be clickable, or not clickable.

What behaviour is observed:

The left and right hand brackets of the [CANCEL] button chat component that appears when someone enters a bed are inconsistent in the ability to click them. The left hand bracket is impossible to click, whereas the right hand bracket is. This is presumably caused by the right hand bracket being appended as a text component with no action, but the game assigns it the action of the previous chat component anyway.

Steps/models to reproduce:

Have someone sleep in a bed
Hover mouse over the cancel button in chat, observe as the left bracket is not clickable while the right bracket is clickable.

Plugin list:

CoreProtect, dynmap, Dynmap-GriefPrevention, LuckPerms, MobHeads, Plan, PvPToggle, QuickShop, SecuredNetwork, SinglePlayerSleep, Vault, XConomy and 2 proprietary plugins.

Bukkit/Spigot server version or Paper build number:

Waterfall version 1.16-R0.4-SNAPSHOT:6496349:370
PaperMC version git-Paper-1daafe455

Colors

Please help me to add colors to my config

Single Player sleep won't load in spigot.

I tried to launch single player sleep in my server and here is what I got from the console.

13.06 13:04:17 [Server] ERROR Could not load 'plugins/SinglePlayerSleep.jar' in folder 'plugins'
13.06 13:04:17 [Server] INFO org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/github/joelgodofwar/sps/PluginBase : Unsupported major.minor version 52.0
13.06 13:04:17 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
13.06 13:04:17 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
13.06 13:04:17 [Server] INFO at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
13.06 13:04:17 [Server] INFO at org.bukkit.craftbukkit.v1_10_R1.CraftServer.loadPlugins(CraftServer.java:297) [spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
13.06 13:04:17 [Server] INFO at net.minecraft.server.v1_10_R1.DedicatedServer.init(DedicatedServer.java:202) [spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
13.06 13:04:17 [Server] INFO at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:539) [spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
13.06 13:04:17 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79]
13.06 13:04:17 [Server] INFO Caused by: java.lang.UnsupportedClassVersionError: com/github/joelgodofwar/sps/PluginBase : Unsupported major.minor version 52.0
13.06 13:04:17 [Server] INFO at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_79]
13.06 13:04:17 [Server] INFO at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[?:1.7.0_79]
13.06 13:04:17 [Multicraft] Skipped 39 lines due to rate limit (30/s)

[Future]

Hello

I am using your plugin on my server.

Now I installed the plugin "SurvivalPlus - Reloaded"
Survival plus is an plugin for refreshing players energie, while sleeping.
The problem is that either only one or all of them can go to bed. However, in Survival Plus, the player consumes energy throughout the day.

Can you give an update to sleep always?

example option:
##
# This option means, player can always sleep.
# With this option, the time persists.
##
alwaysSleep : true/false

example permissions:
# Allow player sleeping every time.
singleplayersleep.alwayssleep 
example option:
##
# This option means, player can sleep only in day time.
# Combinations are accepted. Time persists.
##
SleepTime: [ day, night, noon, midnight ]

example permissions:
# Allow player sleeping every time.
singleplayersleep.sleep.*
singleplayersleep.sleep.day
singleplayersleep.sleep.night
singleplayersleep.sleep.noon
singleplayersleep.sleep.midnight

I would go for the second option because it's more custom.

Latest version breaks the plugin

After updating to the latest version of the plugin, each time a player enters a bed, this error shows up in the console:

[19:03:59 ERROR]: Could not pass event PlayerBedEnterEvent to SinglePlayerSleep v2.13.15
java.lang.NoClassDefFoundError: net/minecraft/server/v1_11_R1/Packet
at com.github.joelgodofwar.sps.PluginBase.PlayerIsSleeping(PluginBase.java:164) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor12.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.14.4.jar:git-Paper-209]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.14.4.jar:git-Paper-209]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.14.4.jar:git-Paper-209]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:545) ~[patched_1.14.4.jar:git-Paper-209]
at org.bukkit.craftbukkit.v1_14_R1.event.CraftEventFactory.callPlayerBedEnterEvent(CraftEventFactory.java:258) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.EntityHuman.sleep(EntityHuman.java:1295) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.EntityPlayer.sleep(EntityPlayer.java:1020) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.EntityPlayer.sleep(EntityPlayer.java:1014) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.BlockBed.interact(BlockBed.java:55) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.IBlockData.interact(IBlockData.java:226) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.PlayerInteractManager.a(PlayerInteractManager.java:487) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:1361) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:27) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:5) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.TickTask.run(SourceFile:18) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.MinecraftServer.aX(MinecraftServer.java:1029) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.MinecraftServer.executeNext(MinecraftServer.java:1022) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.MinecraftServer.sleepForTick(MinecraftServer.java:1006) ~[patched_1.14.4.jar:git-Paper-209]
at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:929) ~[patched_1.14.4.jar:git-Paper-209]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException: net.minecraft.server.v1_11_R1.Packet
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:90) ~[patched_1.14.4.jar:git-Paper-209]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:85) ~[patched_1.14.4.jar:git-Paper-209]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_212]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_212]
... 27 more 

Could you take a look at it please? Thanks.

EDIT: I fixed the formatting

timeout does not work

Hi there,

when one player goes to bed the message is shown but the time transition happens immediately and not after 10 seconds. This way the other playes have no chance of clicking cancel. Currently we are only two players to test and both are Operator/Admin with all permissions.

I use the current plugin Version and CraftBukkit version git-Bukkit-2012f1e (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)

Could you explain this behavior?

Kind Regards
Clemens

Unnecessary version updates?

Hi,

Is there any particular reason why there are empty commits to just update the version? I don't know if it's to push your mod to the top of the "recently updated" list every once in a while, but it's causing my server to output "new version available" messages to all players. An explanation would be nice.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.