diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java index fe591cd0d..79218ed02 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -73,9 +73,25 @@ public class McremoveCommand implements CommandExecutor { System.out.println("User "+playerName+" removed from MySQL DB!"); } else { - + //FlatFile removal + //TODO: Properly remove users from FlatFile, it's going to be a huge bitch with how our FlatFile system works. Let's adopt SQLite support. + if(Bukkit.getServer().getPlayer(playerName) != null) + { + Player targetPlayer = Bukkit.getServer().getPlayer(playerName); + if(targetPlayer.isOnline()) + { + Users.getProfile(targetPlayer).resetAllData(); + } else { + sender.sendMessage("[mcMMO] This command is not fully functional for FlatFile yet, the player needs to be online."); + return true; + } + } else { + sender.sendMessage("[mcMMO] This command is not fully functional for FlatFile yet, the player needs to be online."); + return true; + } } + //Force PlayerProfile stuff to update if(Bukkit.getServer().getPlayer(playerName) != null) { Player targetPlayer = Bukkit.getServer().getPlayer(playerName); diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index 1831572f5..dd76a265a 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -434,6 +434,31 @@ public class PlayerProfile } } } + + public void resetAllData() + { + //This will reset everything to default values and then save the information to FlatFile/MySQL + for(SkillType skillType : SkillType.values()) + { + if(skillType == SkillType.ALL) + continue; + skills.put(skillType, 0); + skillsXp.put(skillType, 0); + } + + for(AbilityType abilityType : AbilityType.values()) + { + skillsDATS.put(abilityType, 0); + } + + //Misc stuff + myspawn = ""; + party = ""; + myspawnworld = ""; + + save(); + } + public void addPlayer() { try {