This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..
Question
Helperis
Hello,
I have problem while setting aio for player. Today is 30th month day and if I set aio for 1 day some how end date is december 31(i think it is because november does not have 31 day). But if I set aio for 2 days its end time is december 1. How I can fix it? l2jfrozen rev 1132.
P.S. when it was november 25 and I set aio for 1 day it worked perfectly.
Adding code:
EDIT adding aioendtime code:
public void setEndTime(final String process, int val) { if (val > 0) { long end_day; final Calendar calendar = Calendar.getInstance(); if (val >= 30) { while (val >= 30) { if (calendar.get(Calendar.MONTH) == 11) calendar.roll(Calendar.YEAR, true); calendar.roll(Calendar.MONTH, true); val -= 30; } } if (val < 30 && val > 0) { while (val > 0) { if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1) calendar.roll(Calendar.MONTH, true); if (calendar.get(Calendar.DATE) == 30) { if (calendar.get(Calendar.MONTH) == 11) calendar.roll(Calendar.YEAR, true); calendar.roll(Calendar.MONTH, true); } calendar.roll(Calendar.DATE, true); val--; } } end_day = calendar.getTimeInMillis(); if (process.equals("aio")) _aio_endTime = end_day; else { LOGGER.info("process " + process + "no Known while try set end date"); return; } final Date dt = new Date(end_day); LOGGER.info("" + process + " end time for player " + getName() + " is " + dt); } else { if (process.equals("aio")) _aio_endTime = 0; else { LOGGER.info("process " + process + "no Known while try set end date"); return; } } } /** * Gets the aio end time. * @return the aio end time */ public long getAioEndTime() { return _aio_endTime; }Edited by Helperis2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now