Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Get Date from command

Comments in 'Plugin Development' started by CraftYourBukkit, Nov 7, 2015.

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Hey there!
    I have a command called /date <time>. For example: /date 5h
    I want to get the date from now to the time typed, which would be now in 5 hours. And I want to check, if the date is "over", means when the date is yesterday, it's over. How can I do that?
  2. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
  4. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    Can i help you but i don't understand what are you tring to do , can you explain better ?
  5. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    It would be the same as a tempban plugin. When I do /date 5h, it calculates the new date, which would be now + 5 h(hours).
  6. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    well, convert 5h in seconds then add these seconds to the current time()
    ex.
    PHP:
    $h5 5*60*60;
    date('H:i', (time()+$h5));
  7. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Well somehow you can use time() and add the amount of seconds to it, and every time the temp-banned player joins you can check if the time is greater. Sorry if I'm not clear enough.
  8. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Gamecrafter likes this.
  9. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    I though it was a command to get dates. For a dating Minecraft PE server.
    Gamecrafter and Legoboy0215 like this.
  10. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Whoa... @aliuly, did you just wake up or what???

Share This Page

Advertisement