Made mcremove work for FlatFile (sort of).

This commit is contained in:
nossr50 2012-02-28 12:33:57 -08:00
parent 6cc22a3b63
commit 7aa7de75a2
2 changed files with 42 additions and 1 deletions

View File

@ -73,9 +73,25 @@ public class McremoveCommand implements CommandExecutor {
System.out.println("User "+playerName+" removed from MySQL DB!"); System.out.println("User "+playerName+" removed from MySQL DB!");
} else { } 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) if(Bukkit.getServer().getPlayer(playerName) != null)
{ {
Player targetPlayer = Bukkit.getServer().getPlayer(playerName); Player targetPlayer = Bukkit.getServer().getPlayer(playerName);

View File

@ -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() public void addPlayer()
{ {
try { try {