Zrips / CMI

115 stars 97 forks source link

Struggle with setting up an auto restart timer. (Schedules) #3663

Closed QueenAngus closed 4 years ago

QueenAngus commented 4 years ago

Description of issue: I've been trying to setup a schedule for automatic restarts on my server. Here it is: https://pastebin.com/Y1yQqtqx. The placeholder for the schedule worked as desired. However, when I went to test if the schedule worked, commands would run out of sync with the time on the scoreboard as if they'd been triggered beforehand and weren't cancelled when the timer for the schedule was updated or changed. I watched the placeholder for the schedule go down until it reset back to being the next day (22 hours 59 mins later, strangely not 23 hours) but NONE of the commands triggered, there should be a warning message for a 30 minute warning then a 15 minute delay but the 30 minute messages were not sent as the timer clocked over.

I also got really confused by the placeholder because I kept thinking it was a countdown for the final command in the sequence but really it's likely for the first command in the sequence so another placeholder that takes into account all delays in the commands and give a time result for the final command would be really handy. Though, I can't even test if this is currently the way it is as the schedule doesn't work on the timer, only works if i manually trigger it with /cmi schedule.

Further from this, I tried to set the schedule to be on a delay so that when the server restarts it would take a whole day for the event to be triggered so that the server would only ever restart if its been only for over 24 hours. However, when I set this delay like this in the file: https://pastebin.com/hsJpp3Er, it completely breaks and spams the first commands in the sequence, as shown in this video - https://gyazo.com/eed2a340da61deb65a774f913b33f5a8.

Also, when using the delay function, the placeholder for when the schedule will next occur completely blanks out, just doesn't display at all when the schedule will next happen like it does if you use the PerformOn: feature.

Overall I think that schedules need to be changed so that if the timer is updated via the config or that if the event is triggered once then the schedule is changed that the first schedule that was fired cancels because a new one has been sent and fixes to the delay function (unless I am using it wrong).


Cmi Version (using/cmi version): 8.6.20.3 Server Type (Spigot/Paperspigot/etc): Paper Server Version (using /ver): 1.13.2

CloudeLecaw commented 4 years ago

why using a timer? for server restart its recomment to define the real times and days not using the delday timer

QueenAngus commented 4 years ago

why using a timer? for server restart its recomment to define the real times and days not using the delday timer

I did attempt to use the PerformOn function however when the timer ran out the commands didn't trigger for some reason. I tested it multiple times and I couldn't really figure out what was going on. The reason for using the delay timer is so that a restart will only happen if the server has been up for 24 hours.

CloudeLecaw commented 4 years ago
Serverrestart:
  Enabled: true
  PerformOn:
    '1':
      Day: Sunday
      Hour: 23
      Minute: 59
      Second: 30
  Commands:
  - actionbar! &eServer will stop in &630 &esec!
  - delay! 5
  - actionbar! &eServer will stop in &625 &esec!
  - delay! 5
  - actionbar! &eServer will stop in &620 &esec!
  - delay! 5
  - actionbar! &eServer will stop in &615 &esec!
  - delay! 5
  - actionbar! &eServer will stop in &610 &esec!
  - delay! 5
  - actionbar! &eServer will stop in &65 &esec!
  - delay! 1
  - actionbar! &eServer will stop in &64 &esec!
  - delay! 1
  - actionbar! &eServer will stop in &63 &esec!
  - delay! 1
  - actionbar! &eServer will stop in &62 &esec!
  - delay! 1
  - actionbar! &eServer will stop in &61 &esec!
  - delay! 1
  - kickall! &eServer will be back online soon!
  - delay! 1
  - restart

This command would be preformed on sunday each week at 23:59:30 remove the line DAY at preforming if you wanne happen this every day at 23:59:30 its importent to check you servertime too. If your server is in USA and you setup a time like this but have a france server then u have to also aspect the timezone or redefine the servers realtime

QueenAngus commented 4 years ago

I just made that my performon time and it says on the placeholder %cmi_schedule_nextin_ServerRestart% that it will happen in 10 hours but it's Tuesday. There is just something that is out of sync with the actual time its meant to happen and the placeholder. And when you set the schedule to happen manually with the command, the placeholder doesn't get updated either. I can't really figure it out but there is definitely something that is wrong with the schedules and timer functions, if you try my schedule you will probably see it for yourself and if you try use the placeholder. I use it in tabList.yml.

I think that the previous schedules should be cancelled if they're triggered again either by the countdown or manually which doesn't seem to be the case at the moment. I also waited for the schedule to fully count down and clock over to being on the next day and the commands at the start of the schedule did not trigger.

CloudeLecaw commented 4 years ago

may a server in thailand? ;)

QueenAngus commented 4 years ago

Nevertheless, if the countdown timer does work which I haven't seen to be the case there is other underlying issues that cause it to be buggy that I don't know the cause of that I just mentioned above such as when I waited for the schedule to tick over on the placeholder 5 different times, the first commands were not triggered. I dont know if it is because I was manually changing when it was meant to happen by a few minutes in schedules.yml so I could test the schedule or for another reason.

QueenAngus commented 4 years ago

And other things that I mentioned that are more of a feature request such as an additional placeholder for when the event finishes would be really handy for the instance of a server restart schedule or anything else that has a warning. I think also making it so the placeholder worked with delay: would be good for people who want to have delays instead of performOn:

CloudeLecaw commented 4 years ago

hm interesting, we are using many differnt triggers on our server and there was a longer time an issues with the daytime on weeksends but this is fixed allready. Since that we never had issues anymore and all our shedules work fine solong. If u define secounds with the delay isnstead of real tme there can be a problem

  1. u restart the server -> times gets reseted
  2. u have lags -> timer could take longer in this case. but if the timeer is up and you had set repret as true then the cunter should repeat

can u simply post your shedules? :) This may would help more

QueenAngus commented 4 years ago

The schedule is here: https://pastebin.com/Dg7axQEe

Here's the one using the Delay: feature which is completely broken - https://pastebin.com/6GTSyPfy

CloudeLecaw commented 4 years ago

your shedule is brokken ;) wait i correct it for u

QueenAngus commented 4 years ago

What is wrong with it?

CloudeLecaw commented 4 years ago
AutoRestart:
  Enabled: true
  FeedBack: true
  PerformOn:
    '1':
      Day: Friday
      Hour: 3
      Minute: 59
      Second: 30
  Commands:
  - actionbar! &fPrison will restart in &e30 &fmins!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 30 minutes. This restart happens daily and is to prevent lag and improve gameplay.
  - delay! 900
  - actionbar! &fPrison will restart in &e15 &fmins!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 15 minutes. Everyone online will recieve 3x Juice Keys.
  - delay! 300
  - actionbar! &fPrison will restart in &e10 &fmins!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 10 minutes. Everyone online will recieve 3x Juice Keys.
  - delay! 300
  - actionbar! &fPrison will restart in &e5 &fmins!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 5 minutes. Everyone online will recieve 3x Juice Keys.
  - delay! 120
  - actionbar! &fPrison will restart in &e3 &fmins!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 3 minutes. Everyone online will recieve 3x Juice Keys.
  - delay! 120
  - actionbar! &fPrison will restart in &e1 &fminute!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 1 minute. Everyone online will recieve 3x Juice Keys.
  - delay! 15
  - actionbar! &fPrison will restart in &e45 &fseconds!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 45 seconds. Everyone online will recieve 3x Juice Keys.
  - delay! 15
  - actionbar! &fPrison will restart in &e30 &fseconds!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 30 seconds. Everyone online will recieve 3x Juice Keys.
  - delay! 15
  - actionbar! &fPrison will restart in &e15 &fseconds!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 45 seconds. Everyone online will recieve 3x Juice Keys.
  - delay! 5
  - actionbar! &fPrison will restart in &e10 &fseconds!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 10 seconds. Everyone online will recieve 3x Juice Keys.
  - delay! 5
  - actionbar! &fPrison will restart in &e5 &fseconds!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 5 seconds. Everyone online will recieve 3x Juice Keys.
  - save-all
  - delay! 2
  - actionbar! &fPrison will restart in &e3 &fseconds!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 3 seconds. Everyone online will recieve 3x Juice Keys.
  - delay! 1
  - actionbar! &fPrison will restart in &e2 &fseconds!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 2 seconds. Everyone online will recieve 3x Juice Keys.
  - delay! 1
  - cgive * Juice 3
  - actionbar! &fPrison will restart in &e1 &fsecond!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 1 second. Everyone online will recieve 3x Juice Keys.
  - delay! 1
  - restart
QueenAngus commented 4 years ago

What is different?

CloudeLecaw commented 4 years ago

you broke the shedule in all meaassges when you start with a new line with the text

This restart happens daily and is to prevent lag and improve gameplay.
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 30 minutes.
    This restart happens daily and is to prevent lag and improve gameplay.
  - actionbar! &fPrison will restart in &e30 &fmins!
  - delay! 900

and later each time at the

Everyone online will recieve 3x Juice Keys.
  - actionbar! &fPrison will restart in &e15 &fmins!
  - broadcast! &6Restart &e» &fThe server will be automatically restarting in 15 minutes.
    Everyone online will recieve 3x Juice Keys.
  - delay! 300

it need to be one line one command, so 2 broadcasts or one with all.

- broadcast! &6Restart &e» &fThe server will be automatically restarting in 30 minutes. This restart happens daily and is to prevent lag and improve gameplay.

or this

- broadcast! &6Restart &e» &fThe server will be automatically restarting in 30 minutes.
- broadcast! This restart happens daily and is to prevent lag and improve gameplay.
Zrips commented 4 years ago

@QueenAngus There is small bug, will make some adjustments to mitigate it with next update.