A few changes :3

This commit is contained in:
nossr50 2011-07-16 00:52:15 -07:00
parent 25940bf5cf
commit 8b981cde75
4 changed files with 11 additions and 6 deletions

View File

@ -121,7 +121,8 @@ public class Leaderboard {
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + statName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + statName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
//CHECK IF THE FILE EXISTS //CHECK IF THE FILE EXISTS
File theDir = new File(theLocation); File theDir = new File(theLocation);
if(!theDir.exists()){ if(!theDir.exists())
{
//properties = new PropertiesFile(location); //properties = new PropertiesFile(location);
FileWriter writer = null; FileWriter writer = null;
try { try {

View File

@ -14,6 +14,8 @@ public class Users {
private static volatile Users instance; private static volatile Users instance;
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
String directory = "plugins/mcMMO/FlatFileStuff/";
String directoryb = "plugins/mcMMO/FlatFileStuff/Leaderboards/";
//public static ArrayList<PlayerProfile> players; //public static ArrayList<PlayerProfile> players;
public static HashMap<Player, PlayerProfile> players = new HashMap<Player, PlayerProfile>(); public static HashMap<Player, PlayerProfile> players = new HashMap<Player, PlayerProfile>();
@ -36,14 +38,18 @@ public class Users {
public void loadUsers() public void loadUsers()
{ {
new File(directory).mkdir();
new File(directoryb).mkdir();
File theDir = new File(location); File theDir = new File(location);
if(!theDir.exists()){ if(!theDir.exists())
{
//properties = new PropertiesFile(location); //properties = new PropertiesFile(location);
FileWriter writer = null; FileWriter writer = null;
try { try {
writer = new FileWriter(location); writer = new FileWriter(location);
//writer.write("#Storage place for user information\r\n"); //writer.write("#Storage place for user information\r\n");
} catch (Exception e) { } catch (Exception e)
{
log.log(Level.SEVERE, "Exception while creating " + location, e); log.log(Level.SEVERE, "Exception while creating " + location, e);
} finally { } finally {
try { try {

View File

@ -50,7 +50,7 @@ public class PlayerProfile
//Time to HashMap this shiz //Time to HashMap this shiz
HashMap<String, Integer> stats = new HashMap<String, Integer>(); //Skills and XP HashMap<String, Integer> stats = new HashMap<String, Integer>(); //Skills and XP
String location = "plugins/mcMMO/mcmmo.users"; String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
public PlayerProfile(Player player) public PlayerProfile(Player player)
{ {

View File

@ -116,8 +116,6 @@ public class Skills {
} }
public static void monitorSkills(Player player){ public static void monitorSkills(Player player){
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(PP == null)
Users.addUser(player);
if(PP != null) if(PP != null)
{ {
if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){ if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){