Clean up on all of our commands. Abstracted experience commands and

hardcore commands. Moved lots of duplicated code to functions in
CommandUtils.java. Split /ptp into individual commands, just like /party.
Used ternary logic to simplify some of our /skillname stat displays. Fixed
skill guide to not allow for negative pages. Simplified logic for many
/skillname data calculations. Use permission checks to prevent calculating
data that will never be displayed. Made the skill guide into its own
command.
This commit is contained in:
GJ
2013-03-12 16:25:42 -04:00
parent dcfdfa0e62
commit 2838a52e0c
64 changed files with 1550 additions and 1861 deletions

View File

@ -10,17 +10,13 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.database.DatabaseUpdateType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.runnables.database.SQLReconnectTask;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.spout.SpoutUtils;
import com.gmail.nossr50.util.Misc;
public final class DatabaseManager {
private static String connectionString;
@ -502,7 +498,7 @@ public final class DatabaseManager {
continue;
}
profileCleanup(playerName);
Misc.profileCleanup(playerName);
purgedUsers++;
}
@ -524,36 +520,13 @@ public final class DatabaseManager {
continue;
}
profileCleanup(playerName);
Misc.profileCleanup(playerName);
purgedUsers++;
}
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
}
public static void profileCleanup(String playerName) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
if (mcMMOPlayer != null) {
Player player = mcMMOPlayer.getPlayer();
McMMOHud spoutHud = mcMMOPlayer.getProfile().getSpoutHud();
if (spoutHud != null) {
spoutHud.removeWidgets();
}
UserManager.remove(playerName);
if (player.isOnline()) {
UserManager.addUser(player);
if (mcMMO.spoutEnabled) {
SpoutUtils.reloadSpoutPlayer(player);
}
}
}
}
/**
* Check database structure for missing values.
*