mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
We already have a task for Profile saving
This commit is contained in:
parent
d0a5454333
commit
09373c45f3
@ -307,13 +307,11 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
save(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save(boolean override) {
|
|
||||||
Long timestamp = System.currentTimeMillis();
|
Long timestamp = System.currentTimeMillis();
|
||||||
if (timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override)
|
|
||||||
|
if (timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If we are using mysql save to database
|
// If we are using mysql save to database
|
||||||
if (Config.getInstance().getUseMySQL()) {
|
if (Config.getInstance().getUseMySQL()) {
|
||||||
@ -944,12 +942,10 @@ public class PlayerProfile {
|
|||||||
|
|
||||||
public void setSkillXpLevel(SkillType skillType, int newValue) {
|
public void setSkillXpLevel(SkillType skillType, int newValue) {
|
||||||
skillsXp.put(skillType, newValue);
|
skillsXp.put(skillType, newValue);
|
||||||
save(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void skillUp(SkillType skillType, int newValue) {
|
public void skillUp(SkillType skillType, int newValue) {
|
||||||
skills.put(skillType, skills.get(skillType) + newValue);
|
skills.put(skillType, skills.get(skillType) + newValue);
|
||||||
save(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
@ -1069,7 +1065,6 @@ public class PlayerProfile {
|
|||||||
else {
|
else {
|
||||||
skillsXp.put(skillType, skillsXp.get(skillType) - xp);
|
skillsXp.put(skillType, skillsXp.get(skillType) - xp);
|
||||||
}
|
}
|
||||||
save(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1097,7 +1092,6 @@ public class PlayerProfile {
|
|||||||
skills.put(skillType, newValue);
|
skills.put(skillType, newValue);
|
||||||
skillsXp.put(skillType, 0);
|
skillsXp.put(skillType, 0);
|
||||||
}
|
}
|
||||||
save(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1125,7 +1119,6 @@ public class PlayerProfile {
|
|||||||
skills.put(skillType, skills.get(skillType) + levels);
|
skills.put(skillType, skills.get(skillType) + levels);
|
||||||
skillsXp.put(skillType, 0);
|
skillsXp.put(skillType, 0);
|
||||||
}
|
}
|
||||||
save(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1204,7 +1197,6 @@ public class PlayerProfile {
|
|||||||
|
|
||||||
public void setParty(Party party) {
|
public void setParty(Party party) {
|
||||||
this.party = party;
|
this.party = party;
|
||||||
save(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Party getParty() {
|
public Party getParty() {
|
||||||
@ -1221,7 +1213,6 @@ public class PlayerProfile {
|
|||||||
|
|
||||||
public void removeParty() {
|
public void removeParty() {
|
||||||
party = null;
|
party = null;
|
||||||
save(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeInvite() {
|
public void removeInvite() {
|
||||||
|
Loading…
Reference in New Issue
Block a user