Java help 25% of time
|January 11, 2014
Posted by forumadmin
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 player who killed you can then pick up the TimeCard and use it.
Currently the plugin is only attempting to get the players years, multiply them by 25% and then issue the command to remove 25 years from the player. (y tells the server to take years not days, weeks, hours)
Here is the code for it:
Integer time = itapi.getPlayerYears(player.getName());
Double remove = Integer.valueOf(time) * 0.25;
String minus = String.valueOf(remove) + 'y' ;
ItemStack book = itapi.createTimeCard("Death of " + player.getName(), minus, 1);
though when a player gets killed this error is thrown:
Caused by: java.lang.NumberFormatException: For input string: "1.25"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.7.0]
at java.lang.Integer.parseInt(Integer.java:492) ~[?:1.7.0]
at java.lang.Integer.parseInt(Integer.java:527) ~[?:1.7.0]
at com.BlackMage.InTime2.InTime2API.removeTime(InTime2API.java:551) ~[?:?]
I am beyond confused on how to resolve these errors and after trying several different things am looking for some advice
More Related Questions
- Converting the left over decminal to weeks, days, hours, min, seconds 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 […]
- 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 […]
- 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 […]
- 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. […]
- 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 […]
- 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 […]
- Collect and sort points of all players I am trying to collect the point values from a configuration file for all players and sort them so I can take the top five to put in a leaderboard. I am having trouble figuring out how to […]