lundi 28 novembre 2016

Spring Web Application

I am creating a online browser game (clicking based). I have a general question about how Java works in web applications.

For example I have a class Mining and after a user logs in (using the form in html) in I want to fetch data from database to put that class certain values. And if users session will end the values from Mining will be saved to database and object will be destroyed. Can I make a new Mining object for each user that uses my application?

package application.data.character;

public class Mining implements PlayerStat{

private int level, exp;

public Mining(int level, int exp) {
    super();
    this.level = level;
    this.exp = exp;
}


public void addExp(int amount) {
    exp += amount;
     ExperienceHandler h = new ExperienceHandler();

     level = h.checkForLevel(exp, level);



}




public int getLevel() {
    return level;
}

public void setLevel(int level) {
    this.level = level;
}

public int getExp() {
    return exp;
}

public void setExp(int exp) {
    this.exp = exp;
}








}




Aucun commentaire:

Enregistrer un commentaire