Filled Auto Restart

Discussion in 'Plugin Requests' started by tcwolf12, May 16, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    tcwolf12

    Thanks I'll edit this post after the test, I'm sorry to hear about that lightning strike, I haven't been online in a few days sorry for the delay.

    EDIT: This plugin is awesome! It works just as I need it too, there is only a minor mis-spelling (you put to a's in restart) but that's fine, I wish you the best of luck with the lightning problem.
     
    Last edited: Jun 6, 2016
  2. Offline

    I Al Istannen

    @tcwolf12
    Hey, thanks :p
    I fixed the spelling, I made the typo in the preset, so it got used for all commands. I uploaded it, just redownload it from the same link. Took some time, so I hope everything went well :p

    Have a nice day!
     
  3. Offline

    tcwolf12

    Thanks! @I Al Istannen I'm glad to have a plugin that doesn't spam console!
     
  4. Offline

    tcwolf12

    Sorry to bother you but I've encountered an error on my console.
    System specs (Thought that might help) OS X, 5GB Memory Allocated, i7 core, running on the BASH (Bourne Again Shell (FreeBSD/UNIX)) Java 8 (Apple won't allow any lower version on OS X 10.11 so Java 7 isn't an option for me)
    Code:
    [16:44:15 WARN]: javax.script.ScriptException: <eval>:1:0 Invalid left hand side for assignment
    21598 = 10
    ^ in <eval> at line number 1 at column number 0
    [16:44:15 WARN]:     at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467)
    [16:44:15 WARN]:     at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:534)
    [16:44:15 WARN]:     at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:521)
    [16:44:15 WARN]:     at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:399)
    [16:44:15 WARN]:     at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
    [16:44:15 WARN]:     at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
    [16:44:15 WARN]:     at me.ialistannen.auto_restart.management.MessageSender.fillBuffer(MessageSender.java:100)
    [16:44:15 WARN]:     at me.ialistannen.auto_restart.management.MessageSender.access$0(MessageSender.java:90)
    [16:44:15 WARN]:     at me.ialistannen.auto_restart.management.MessageSender$1.run(MessageSender.java:76)
    [16:44:15 WARN]:     at org.bukkit.craftbukkit.v1_9_R2.scheduler.CraftTask.run(CraftTask.java:71)
    [16:44:15 WARN]:     at org.bukkit.craftbukkit.v1_9_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
    [16:44:15 WARN]:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    [16:44:15 WARN]:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    [16:44:15 WARN]:     at java.lang.Thread.run(Thread.java:745)
    [16:44:15 WARN]: Caused by: jdk.nashorn.internal.runtime.ParserException: <eval>:1:0 Invalid left hand side for assignment
    21598 = 10
    ^
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:267)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.referenceError(Parser.java:3043)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.verifyAssignment(Parser.java:639)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3338)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3279)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.expressionStatement(Parser.java:1152)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.statement(Parser.java:969)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.sourceElements(Parser.java:775)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.program(Parser.java:711)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.parse(Parser.java:284)
    [16:44:15 WARN]:     at jdk.nashorn.internal.parser.Parser.parse(Parser.java:250)
    [16:44:15 WARN]:     at jdk.nashorn.internal.runtime.Context.compile(Context.java:1281)
    [16:44:15 WARN]:     at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1248)
    [16:44:15 WARN]:     at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:629)
    [16:44:15 WARN]:     at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:532)
    [16:44:15 WARN]:     ... 12 more
    Also other than that it seems to work, I'm not sure though if that was from dynamically loading the plugin in.
     
  5. Offline

    I Al Istannen

    @tcwolf12
    I still have no real Internet and i am on my phone, so bear with my spelling.

    This error is on your part. The boolean expression you provided in the config is invalid. Replace the = with a ==. = assigns a value to a variable (which is the error you got, as the number is no variable) and == Tests for equality.
     
  6. Offline

    tcwolf12

    Cool thanks, hope you get internet back to normal soon, and the rest of every thing back to normal and thanks again.
     
  7. Offline

    Khriz

    With a maximum of 60 minutes? ( 1 hour )? Why don't you just make it if the player were to set the time to 2h go for 120 minutes? Or am I confuzed?
     
  8. Offline

    tcwolf12

    I'm pretty sure that he gave up on this project.
     
  9. Offline

    Khriz

    ;-;
     
  10. Offline

    patricksterza

    @I Al Istannen Can you teach me better how to config this plugin please, i am looking thur this for long time.
     
  11. Offline

    I Al Istannen

    @patricksterza
    If you could go in a bit greater detail with what you exactly don't understand, I will happily help you.
    But I will explain the config here nontheless:
    Code:
    # The boolean expression to test if the warn message should be send. Use {TIME} to get the time left in seconds
    warn condition: "{TIME} < 10"
     
    # The warn message. {TIME} is the time left. The unit will be appended automatically.
    warn message: "&cThe server is restarting in &6{TIME}&c."
     
    # The automatic restart interval. Format is "XXd XXh XXm XXs XXms". You don't need to specify all of them. "12h" is just fine.
    restart interval: 12h
     
    # The prefix for all messages from AutoRestart
    prefix: "&8[&3&lAutoRestart&8] "
     
    # The command to execute
    command: "stop"
    What the warnmessage, the prefix and the command is, is probably self explaining.

    The restart interval is what you would guess it is. The time after which the command will be executed. If the command is something that doesn't stop the server, it will work too and execute the command again after the same time.

    The warn condition is a bit more tricky. It's intention is quite simple though. If this condition is true, it will send the warn message.
    You have a placeholder called "{TIME}" which is the time in seconds until the command is executed.
    It is evaluated using a JavaScript engine, so you must use JavaScript syntax. I never did anything with JavaScript, but for this it is mostly the same as Java and quite easy too. You have the basic operations:
    • Logical OR (||)
    • Logical AND (&&)
    • Equals (==)
    • NOT (!)
    • Remainder (%) ==> This is the remainder of a whole number division. So 11 % 5 would be 1, as 11 / 5 is 2 with a remainder of 1.
    • Brackets ( and ) to group operations together
    • Smaller (<)
    • Bigger (>)
    • Smaller or equal (<=)
    • Bigger or equal (>=)
    • And probably some more I am just not aware of
    If you want the message to be send if ten or less seconds are left, use "{TIME} <= 10". If you want it to be send if the time is smaller than 1 minute (60 seconds) and the time is dividable by 5 OR the time is smaller or equal to ten, you write: "{TIME} <= 60 && ({TIME} % 5 == 0 || {TIME} <= 10)" (not tested, but should work ;))

    If you have any more questions, feel free to explain them a bit more and ask them!
     
    patricksterza likes this.
  12. Offline

    patricksterza

    I would like the plugin to send a message before 2 minutes for the server restart like:
    2 min before server will restart:
    [Server] Server restart will occur in 2 minutes.

    1 min before server restart
    [Server] Server restart will occur in 1 minute.

    30 sec before server restart
    [Server] Server restart will occur in 30 seconds.

    10 sec before server restart
    [Server] Server restart will occur in 10 seconds.

    how do i do this? How do i make this to happen?

    Also could you implement me a new code?
    If player types " /reinicio ? " Will show him when will the server restart like
    Command > /reinicio ?
    Send Message to the Player > [Server Restart] Next server restart will occur in 4 hours 21 minutes and 40 seconds.

    Could the messages be editable so i can adpt to my main language? Thanks for the attention

    @I Al Istannen
     
  13. Offline

    I Al Istannen

    @patricksterza
    Currently not. I have another plugin I am doing.
    The restart message actually IS customizable.
    Just not the time, as I use an Apache Utils class for it.

    For your times: Just use what i said in the posts before. You will maybe need to think about it for a bit, but it makes it much more flexible.
    Code:
    warn condition: "{TIME} == 10 || {TIME} == 30 || {TIME} == 60 || {TIME} == 120"
    Remind me in a few days and I may be able to adapt it.
     
    patricksterza likes this.
  14. Offline

    reboxer

    @I Al Istannen

    Hey! i try the plugin and the timer works fine, but i use multicraft and the problem is when the timer is 0, multicraft take this like a crash of the server and do a restart, and the command to execute dont work.
     
  15. Offline

    I Al Istannen

    @reboxer
    It only executes the command in the config. This works. The default is "stop" which will stop the server, which is then logically detected as a crash in Multicraft. I believe you would need to write a "lock" file to tell multicraft that the server should be stopped and didn't crash. I don't use it, so I can't tell.

    But it doesn't seem like a problem with my plugin. If you changed the command and maybe reloaded/restarted the server and it still restarts, please post the console log.
     
  16. Offline

    reboxer

    @I Al Istannen

    i change the command in the config to 'say hello' to try something different and the server just stop and here is when multicraft take it like a crash.

    EDIT: yesterday i try this, but today works, when the timer ends the server say hello
    EDIT 2: maybe is a problem with my multicraft, i try to use 'restart' using the command in-game, but have this error:
    16.06 13:54:42 [Server] INFO Startup script './start.sh' does not exist! Stopping server.
    16.06 13:54:43 [Multicraft] Server shut down (running)
    16.06 13:54:43 [Multicraft] Restarting crashed server in 5 seconds
    16.06 13:54:43 [Multicraft] Server stopped
     
    Last edited: Jun 16, 2016
  17. Offline

    I Al Istannen

    @reboxer
    Yes, I think the command is only changed when you reload/restart the server. Which is bad, but whatever. Won't need it that often.

    And it is probably no error with Multicraft. I would guess multicraft just checks if the server is running and if not assumes it crashed. As long as there is no crashreport generated or an error in the console, all is good :)
     
  18. Offline

    reboxer

    @I Al Istannen
    well, i try a lot of time, and i see if i run 'restart' in console the server dont crash, but if i use the command in-game it does, the commands in the plugin are executed in the console? if not, you can try to add it to the plugin, so the plugin can run the command 'restart' as the console.
     
  19. Offline

    I Al Istannen

    @reboxer
    It executes the command as console. Does the server really crash, or does mutlicraft just says so?
    Executing as Bukkit console sender is the best I can do, as far as I know. Maybe the server console provides special handling?
    I would need to look into multicraft to find it out, but I currently don't have the time to do it nor the motivation if your only problem is a message in the log.

    If it is more than that, sending me your log would be a great help.
     
  20. Offline

    reboxer

    @I Al Istannen

    Code:
    16.06 17:36:50 [Server] INFO [AutoRestart] The server is restarting in 1 second.
    16.06 17:36:51 [Server] INFO 2016-06-16T17:36:51 2016-06-16T17:36:51
    16.06 17:36:51 [Server] INFO [AutoRestart] The server is restarting in 0 seconds.
    16.06 17:36:51 [Server] INFO Attempting to restart with ./start.sh
    16.06 17:36:51 [Server] INFO Stopping server
    16.06 17:36:51 [Server] INFO [ColoredTablist] Disabling ColoredTablist v2.1.4
    16.06 17:36:51 [Server] INFO [ChestCommands] Disabling ChestCommands v3.1.4
    16.06 17:36:52 [Server] INFO [Multiverse-Core] Disabling Multiverse-Core v2.4-b527
    
    *i remove a lot of line of plugins*
    
    16.06 17:36:53 [Multicraft] Server shut down (running)
    16.06 17:36:53 [Multicraft] Restarting crashed server in 5 seconds
    16.06 17:36:53 [Multicraft] Server stopped
     
  21. Offline

    I Al Istannen

    @reboxer
    This just means that the server shut down normally and without crash, but multicraft didn't notice. It probably just saw:
    "Oh, server stopped. Must have crashed. I will restart it."
    In this case you can just ignore it. If there is an error in the removed part, this is why multicraft complains. If not, it is probably the above.

    And it seems like it is nothing I could fix without using Multicraft or looking in their things. Which I won't do, if it doesn't cause any harm.
     
    reboxer likes this.
  22. Offline

    tcwolf12

    @reboxer Just to let you know the server implementation that I run doesn't use multicraft.
     
Thread Status:
Not open for further replies.

Share This Page