Help formating

Discussion in 'Plugin Development' started by lovis, Aug 13, 2018.

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

    lovis

    int sec = 7200 % 60;
    int min = 7200 / 60;
    int hr = min / 60;
    int day = hr / 24;
    int week = day / 7;
    int year = week / 52;

    That's right?

    Here is conflict

    example:
    2h 120m 0s

    or

    5h 300m 0s

    what he receives from the hours, he receives the minutes too
    Help me please


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 13, 2018
  2. Online

    timtower Administrator Administrator Moderator

    @lovis Please post the full classs.
     
  3. Offline

    lovis

    is this format right?

    int sec = 7200 % 60;
    int min = 7200 / 60;
    int hr = min / 60;
    int day = hr / 24;
    int week = day / 7;
    int year = week / 52;

    if (day == 0 && hr == 0 && min == 0) {
    return "§eWait: §6" + sec + "§es";
    }
    if (day == 0 && hr == 0) {
    return "§eWait: §6" + min + "§em §6" + sec + "§es";
    }
    if (day == 0) {
    return "§eWait: §6" + hr + "§eh §6" + min + "§em §6" + sec + "§es";
    }

    return "§eWait: §6" + day + "§ed §6" + hr + "§eh §6" + min + "§em §6" + sec + "§es";

    }

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 13, 2018
Thread Status:
Not open for further replies.

Share This Page