» Converting the left over decminal to weeks, days, hours, min, seconds
Converting the left over decminal to weeks, days, hours, min, seconds
|January 11, 2014
Posted by forumadmin
Right now I am finding out 25% of a persons years and for example if you had 5 years 25% is 1.25. Though the plugin im making cant remove 1.25 years from you the .25 needs to be converted to weeks and then any leftovers to days and so on. Though I dont know how I would convert these times.
Integer y = itapi.getPlayerYears(player.getName());
Double yremove = Integer.valueOf(y) * 0.25;
Integer w = itapi.getPlayerWeeks(player.getName());
Double wremove = Integer.valueOf(w) * 0.25;
Integer d = itapi.getPlayerDays(player.getName());
Double dremove = Integer.valueOf(d) * 0.25;
Integer h = itapi.getPlayerHours(player.getName());
Double hremove = Integer.valueOf(h) * 0.25;
Integer m = itapi.getPlayerMinutes(player.getName());
Double mremove = Integer.valueOf(m) * 0.25;
Integer s = itapi.getPlayerSeconds(player.getName());
Double sremove = Integer.valueOf(s) * 0.25;
String yminus = String.valueOf(yremove) + 'y';
String wminus = String.valueOf(wremove) + 'w';
String dminus = String.valueOf(dremove) + 'd';
String hminus = String.valueOf(hremove) + 'h';
String mminus = String.valueOf(mremove) + 'm';
String sminus = String.valueOf(sremove) + 's';
ItemStack book = itapi.createTimeCard("Death of " + player.getName(), yminus + wminus + dminus + hminus + mminus + sminus, 1);
itapi.removeTime(player.getName(), yminus + wminus + dminus + hminus + mminus + sminus );
Would it be possible to work the conversion out or would it be better to convert all time to seconds then take 25% and convert it back?
More Related Questions
- Java help 25% of time I am working on developing a minecraft plugin based on the Movie InTime. When a player kills you you are susposed to lose 25% of your time and drop it in the form of a TimeCard (Book). The […]
- Java Multiplying I am creating a minecraft plugin based on the movie InTime and am trying to create code that on death of the player the player will lose 25% of their time.
Current code is:
String minus […]
- Is there a more efficient way to write to files? I'm writing a Bukkit (for those that don't know: "Mod and plugins that simplify running and managing Minecraft servers. Includes forums and documentation.") plugin that stores user's […]
- Minecraft Framerate Drop after 5 minutes I installed 13.10 last night on a Dell Precision M6500 and I was amazed that I could get ~50 FPS, but then after about 5 minutes, it took a sudden drop to about 2 FPS. This happens every […]
- Why doesnt Location.add(0, 1, 0) set a new location one block above? I want to, if the player breaks a block, break the block above, too, but this code will just drop the original block (brokenBlock) and not even break the block above...
What did I do […]
- Minecraft Black Screen Ubunutu 12.10 using Java 7 I get these errors when trying to run minecraft.
ian@ian-Beast:~$ cd ~/.minecraft
ian@ian-Beast:~/.minecraft$ cd /.bin
bash: cd: /.bin: No such file or […]
- Accessing a process after closing the consol Basically I am using Ubuntu to run a minecraft server via a VPS and I’m using putty to control it.
once I have started my server and everything is running, I’m in control of the server […]
- Cant Execute .desktop File I'm new to ubuntu and linux...
I'm trying to make a minecraft launcher .desktop file, and when I execute it, it says me:
"There was an error launching the application"
My code […]
- Java cant launch minecraft, these errors happen. Using Java Oracle These errors happen when I launch minecraft, First error happens when I launch the login menu ( It still boots up ). Second when I actually launch the game. […]
- How to allocate more ram to minecraft? Minecraft lags badly in my linux than windows! in windows i dont find trouble playing it!
My system specs :
processor : AMD Athlon x2 260 3.2ghz dual core