Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Void type not allowed here." Error??

807589Oct 21 2008 — edited Oct 21 2008
Hmm.. I have a problem..
I'm trying too make an 'hour reward system', that is coded too add 100k in every players inventory, when they have been online for exactly one hour.
And my compiler says this about my system =( :
.\palidino76\rs2\randoms\randomMoney.java:44: 'void' type not allowed here
if(p.online || sleep(3600000))
^
1 error
Note: .\palidino76\rs2\Quests\Questloader.java uses unchecked or unsafe operatio
ns.
Note: Recompile with -Xlint:unchecked for details.
Tryk på en vilkårlig tast for at fortsætte . . .
And as every noob can see my error is in line 44 in my randomMoney program..
And now...
Here's what inside the program!!!! =)
 
/**
*
*This is a class created to handle the sleep method.
*Also it'll give the players 100k for their every online hour.
*/


package palidino76.rs2.randoms;


/**
 *Class name: randomMoney.
 *
 *Version: 1.0.
 *
 *Tuesday. September 21, 2008.
 *
 * @author Benjamin Dahse.
 */


import palidino76.rs2.players.*;
import palidino76.rs2.io.*;
import palidino76.rs2.*;


public class randomMoney 
{


    /**
 *
 *This method minds a little of the process method that delays something with 600 MS.
 *MS = miliseconds.
 *This is just cooler, as you can decide how many miliseconds it'll count down or delay yourself..
 *It works this way, you just type: sleep(##THE AMOUNT OF MS YOU WANT IT TOO COUNT DOWN OR DELAY SOMETHING.##);
 *Simple as that.. 
 */
    public void sleep(long ms) 
 {
        try { Thread.sleep(ms); } catch(InterruptedException ie){}
    }

 /**
           *This will add 100k too any players inventory, if the sleep method counted down one hour.
           */     
 public void addTimeMoney(Player p)
 {
     if(p.online || sleep(3600000))
 {
     Engine.playerItems.addItem(p, 995, 100000);
 } else if(!p.online)
 {
     Engine.playerItems.addItem(p, 995, 0);
 }
   }
  }   
And just too help all you helpers out there..
Here's line 44 =D
if(p.online || sleep(3600000))
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 18 2008
Added on Oct 21 2008
12 comments
221 views