Solved Creating Scheduled Command, Help!

Discussion in 'Plugin Development' started by Coolgamer54, Aug 30, 2015.

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

    Coolgamer54

    Hello, I an trying to create a plugin that, after 24 ticks, will put the current time back by 23 ticks. the goal of this plugin is to Make a full minecraft cycle last 8 hours in total. The math has been done out the only issue is that i do not know how to make the plugin execute the command in the way i want, I will post what i have as i am completely stumped and am looking for aid.

    http://pastebin.com/q3s73u64
     
    Last edited: Aug 30, 2015
  2. Offline

    mine-care

    @Coolgamer54 So if i understood correctly you want to know how to execute a command, Bukkit#getServer#dispatchCommand(Sender,String)
    Sender is the executor of the command that in your case can be the console sender (Bukkit#getConsoleSender)
    and the String is the command.
     
    Coolgamer54 likes this.
  3. Offline

    au2001

    Note that it's the command without a slash, even for player senders.
     
  4. Offline

    mine-care

    @au2001 yeah exacly.
    Sorry i forgot to mention this :- )
     
  5. Offline

    Coolgamer54

    Thats basically what i want to do however i need a little more...

    the objective of this plugin is to make a mincraft cycle 24 times longer then normal.

    Also, that logger message is only there so that i know the plugin is working, it will be deleted in the final version

    To do this, every 24 ticks, we need time to go back by 23 ticks so that the tick count will be 1, Then next time it will be 2, then 3 ect.

    I just don't know how to do that...
     
    Last edited: Aug 31, 2015
  6. Offline

    caderape

    @Coolgamer54
    #world.setTime(world.getTime() - 23);

    Is it what you asking for ?
     
  7. Offline

    Coolgamer54

    Its very close but i don't want to set it to a certain tick, only 23 ticks back, It will always be a new tick when it happens, if that make any sense.

    EDIT: Oh wait, Let me see

    EDIT: Can you maybe put that into a block of code? i don't know how i would add it to my block of code.
     
  8. Offline

    caderape

    @Coolgamer54

    Code:
    new BukkitRunnable() {
                @Override
                public void run() {
                    for (World world : Bukkit.getWorlds())
                        world.setTime(world.getTime() - 19);
                }
            }.runTaskTimer(this, 20L, 20L);
    If i dun say shit, a day in minecraft it's 14.000 ticks

    If i do that runnable, the day will stay 14.000 seconds
     
  9. Offline

    Coolgamer54

    Thanks! It works perfectly!
     
Thread Status:
Not open for further replies.

Share This Page