测试版

This commit is contained in:
yaohunya 2024-08-03 11:24:31 +08:00
parent 1e4e9a5e52
commit ddbd2b4d4c
3 changed files with 7 additions and 4 deletions

View File

@ -64,6 +64,7 @@ public class PlayerData {
yml.set("exp",this.exp.toString()); yml.set("exp",this.exp.toString());
yml.set("totalExp",this.totalExp.toString()); yml.set("totalExp",this.totalExp.toString());
saveFile(); saveFile();
System.out.println("[调试 - 等级保存] level = "+this.level+" exp = "+this.exp+" totalExp = "+this.totalExp);
} }
public void saveFile(){ public void saveFile(){

View File

@ -26,9 +26,10 @@ public class JoinEvent implements Listener {
public void run() { public void run() {
FileConfiguration yml = Main.plugin.getConfig(); FileConfiguration yml = Main.plugin.getConfig();
int totalExp = yml.getInt("levelstats."+name+".totalExp"); int totalExp = yml.getInt("levelstats."+name+".totalExp");
if(totalExp > playerData.getTotalExp().intValue()){ BigInteger bigInteger = BigInteger.valueOf(totalExp);
DLevelAPI.setTotalExp(p,new BigInteger(yml.getString("levelstats."+name+".totalExp"))); if(bigInteger.compareTo(playerData.getTotalExp()) > 0){
System.out.println("[调试 - 修正] 玩家 "+name+" 经验出现错误,已被纠正."); System.out.println("[调试 - 修正] 玩家 "+name+" 经验出现错误,已被纠正. YmlExp = "+bigInteger.toString()+" playerdata = "+playerData.getTotalExp().toString());
DLevelAPI.setTotalExp(p,bigInteger);
} }
} }
}.runTaskLater(Main.plugin,100L); }.runTaskLater(Main.plugin,100L);
@ -41,5 +42,6 @@ public class JoinEvent implements Listener {
String uuid = p.getUniqueId().toString(); String uuid = p.getUniqueId().toString();
PlayerData playerData = Main.serverManage.getPlayerData(uuid); // 读取玩家的等级数据 PlayerData playerData = Main.serverManage.getPlayerData(uuid); // 读取玩家的等级数据
playerData.savePlayerData(); playerData.savePlayerData();
Main.serverManage.getDataHashMap().remove(p.getUniqueId().toString());
} }
} }

View File

@ -1,6 +1,6 @@
name: DemonLevels name: DemonLevels
main: me.Demon.DemonLevels.Main main: me.Demon.DemonLevels.Main
version: 2.1.9 version: 2.2.0
depend: [DemonTeam] depend: [DemonTeam]
commands: commands:
dlevel: dlevel: