diff --git a/src/main/java/me/Demon/DemonLevels/data/PlayerData.java b/src/main/java/me/Demon/DemonLevels/data/PlayerData.java index 6d4ed55..68450d1 100644 --- a/src/main/java/me/Demon/DemonLevels/data/PlayerData.java +++ b/src/main/java/me/Demon/DemonLevels/data/PlayerData.java @@ -64,6 +64,7 @@ public class PlayerData { yml.set("exp",this.exp.toString()); yml.set("totalExp",this.totalExp.toString()); saveFile(); + System.out.println("[调试 - 等级保存] level = "+this.level+" exp = "+this.exp+" totalExp = "+this.totalExp); } public void saveFile(){ diff --git a/src/main/java/me/Demon/DemonLevels/listener/JoinEvent.java b/src/main/java/me/Demon/DemonLevels/listener/JoinEvent.java index 7843314..1af4497 100644 --- a/src/main/java/me/Demon/DemonLevels/listener/JoinEvent.java +++ b/src/main/java/me/Demon/DemonLevels/listener/JoinEvent.java @@ -26,9 +26,10 @@ public class JoinEvent implements Listener { public void run() { FileConfiguration yml = Main.plugin.getConfig(); int totalExp = yml.getInt("levelstats."+name+".totalExp"); - if(totalExp > playerData.getTotalExp().intValue()){ - DLevelAPI.setTotalExp(p,new BigInteger(yml.getString("levelstats."+name+".totalExp"))); - System.out.println("[调试 - 修正] 玩家 "+name+" 经验出现错误,已被纠正."); + BigInteger bigInteger = BigInteger.valueOf(totalExp); + if(bigInteger.compareTo(playerData.getTotalExp()) > 0){ + System.out.println("[调试 - 修正] 玩家 "+name+" 经验出现错误,已被纠正. YmlExp = "+bigInteger.toString()+" playerdata = "+playerData.getTotalExp().toString()); + DLevelAPI.setTotalExp(p,bigInteger); } } }.runTaskLater(Main.plugin,100L); @@ -41,5 +42,6 @@ public class JoinEvent implements Listener { String uuid = p.getUniqueId().toString(); PlayerData playerData = Main.serverManage.getPlayerData(uuid); // 读取玩家的等级数据 playerData.savePlayerData(); + Main.serverManage.getDataHashMap().remove(p.getUniqueId().toString()); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c8b36e3..2e72ad6 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: DemonLevels main: me.Demon.DemonLevels.Main -version: 2.1.9 +version: 2.2.0 depend: [DemonTeam] commands: dlevel: \ No newline at end of file