From d9b3eff18f49753cfebbebbbe2ed70242e2c7b05 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 5 May 2012 10:16:41 -0700 Subject: [PATCH] Changed how a few variables were initialized --- .../nossr50/commands/mc/McremoveCommand.java | 2 +- .../gmail/nossr50/datatypes/PlayerProfile.java | 2 +- src/main/java/com/gmail/nossr50/mcMMO.java | 16 +++++----------- src/main/java/com/gmail/nossr50/party/Party.java | 2 +- .../nossr50/runnables/SQLConversionTask.java | 2 +- .../java/com/gmail/nossr50/spout/SpoutStuff.java | 2 +- .../java/com/gmail/nossr50/util/Database.java | 1 - .../java/com/gmail/nossr50/util/Leaderboard.java | 4 ++-- src/main/java/com/gmail/nossr50/util/Users.java | 10 +++------- .../shatteredlands/shatt/backup/ZipLibrary.java | 12 ++++++------ 10 files changed, 21 insertions(+), 32 deletions(-) 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 cbf0c15c4..1c7edbdb3 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -17,7 +17,7 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Users; public class McremoveCommand implements CommandExecutor { - private final String location = mcMMO.usersFile; + private final String location = mcMMO.p.usersFile; private final mcMMO plugin; public McremoveCommand (mcMMO plugin) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index 97a4ff58b..c49ac7971 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -57,7 +57,7 @@ public class PlayerProfile { HashMap toolATS = new HashMap(); private String playerName; - private String location = mcMMO.usersFile; + private String location = mcMMO.p.usersFile; public PlayerProfile(String name, boolean addNew) { hud = Config.getInstance().defaulthud; diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 759952c31..2632b4a4b 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -52,11 +52,11 @@ public class mcMMO extends JavaPlugin { public static File mcmmo; //File Paths - public static String mainDirectory; - public static String flatFileDirectory; - public static String usersFile; - public static String leaderboardDirectory; - public static String modDirectory; + public final String mainDirectory = getDataFolder().getPath() + File.separator; + public final String flatFileDirectory = mainDirectory + "FlatFileStuff" + File.separator; + public final String usersFile = flatFileDirectory + "mcmmo.users"; + public final String leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator; + public final String modDirectory = mainDirectory + "ModConfigs" + File.separator; /** * Things to be run when the plugin is enabled. @@ -65,12 +65,6 @@ public class mcMMO extends JavaPlugin { p = this; mcmmo = getFile(); - mainDirectory = getDataFolder().getPath() + File.separator; - flatFileDirectory = mainDirectory + "FlatFileStuff" + File.separator; - leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator; - modDirectory = mainDirectory + "ModConfigs" + File.separator; - usersFile = flatFileDirectory + "mcmmo.users"; - if (!Config.getInstance().getUseMySQL()) { Users.loadUsers(); } diff --git a/src/main/java/com/gmail/nossr50/party/Party.java b/src/main/java/com/gmail/nossr50/party/Party.java index 7afd24280..d1cb69195 100644 --- a/src/main/java/com/gmail/nossr50/party/Party.java +++ b/src/main/java/com/gmail/nossr50/party/Party.java @@ -170,7 +170,7 @@ public class Party { * @return the list of parties. */ public ArrayList getParties() { - String location = mcMMO.usersFile; + String location = mcMMO.p.usersFile; ArrayList parties = new ArrayList(); try { diff --git a/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java b/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java index 93ab74aa1..1220e20b9 100644 --- a/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java @@ -17,7 +17,7 @@ public class SQLConversionTask implements Runnable { @Override public void run() { - String location = mcMMO.usersFile; + String location = mcMMO.p.usersFile; try { FileReader file = new FileReader(location); diff --git a/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java b/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java index fae36ea19..ad4450a6c 100644 --- a/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java +++ b/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java @@ -34,7 +34,7 @@ import com.gmail.nossr50.util.Users; public class SpoutStuff { private static mcMMO plugin = mcMMO.p; - public final static String spoutDirectory = mcMMO.mainDirectory + "Resources" + File.separator; + public final static String spoutDirectory = mcMMO.p.mainDirectory + "Resources" + File.separator; public final static String hudDirectory = spoutDirectory + "HUD" + File.separator; public final static String hudStandardDirectory = hudDirectory + "Standard" + File.separator; public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator; diff --git a/src/main/java/com/gmail/nossr50/util/Database.java b/src/main/java/com/gmail/nossr50/util/Database.java index d19441748..a8d5ebbbc 100644 --- a/src/main/java/com/gmail/nossr50/util/Database.java +++ b/src/main/java/com/gmail/nossr50/util/Database.java @@ -8,7 +8,6 @@ import java.sql.PreparedStatement; import java.util.HashMap; import java.util.ArrayList; import java.util.Properties; - import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.DatabaseUpdate; diff --git a/src/main/java/com/gmail/nossr50/util/Leaderboard.java b/src/main/java/com/gmail/nossr50/util/Leaderboard.java index b15581b3d..ed8066e10 100644 --- a/src/main/java/com/gmail/nossr50/util/Leaderboard.java +++ b/src/main/java/com/gmail/nossr50/util/Leaderboard.java @@ -14,8 +14,8 @@ import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.Tree; public class Leaderboard { - private static String leaderboardsDirectory = mcMMO.leaderboardDirectory; - private static String location = mcMMO.usersFile; + private static String leaderboardsDirectory = mcMMO.p.leaderboardDirectory; + private static String location = mcMMO.p.usersFile; private static mcMMO plugin = mcMMO.p; /** diff --git a/src/main/java/com/gmail/nossr50/util/Users.java b/src/main/java/com/gmail/nossr50/util/Users.java index 82fe55d5a..0c45233c4 100644 --- a/src/main/java/com/gmail/nossr50/util/Users.java +++ b/src/main/java/com/gmail/nossr50/util/Users.java @@ -13,19 +13,15 @@ import com.gmail.nossr50.datatypes.PlayerProfile; public class Users { - public static String location = mcMMO.usersFile; - public static String directory = mcMMO.flatFileDirectory; - public static String directoryb = mcMMO.leaderboardDirectory; - public static HashMap players = new HashMap(); /** * Load users. */ public static void loadUsers() { - new File(directory).mkdir(); - new File(directoryb).mkdir(); - File theDir = new File(location); + new File(mcMMO.p.flatFileDirectory).mkdir(); + new File(mcMMO.p.leaderboardDirectory).mkdir(); + File theDir = new File(mcMMO.p.usersFile); if (!theDir.exists()) { try { diff --git a/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java b/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java index a13fab814..425152106 100644 --- a/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java +++ b/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java @@ -17,13 +17,13 @@ import com.gmail.nossr50.config.Config; public class ZipLibrary { - private static String BackupDirectory = mcMMO.mainDirectory + "backup"; + private static String BackupDirectory = mcMMO.p.mainDirectory + "backup"; private static File BackupDir = new File(BackupDirectory); - private static File FlatFileDirectory = new File(mcMMO.flatFileDirectory); - private static File UsersFile = new File(mcMMO.usersFile); - private static File ConfigFile = new File(mcMMO.mainDirectory + "config.yml"); - private static File TreasuresFile = new File(mcMMO.mainDirectory + "treasures.yml"); - private static File Leaderboards = new File(mcMMO.leaderboardDirectory); + private static File FlatFileDirectory = new File(mcMMO.p.flatFileDirectory); + private static File UsersFile = new File(mcMMO.p.usersFile); + private static File ConfigFile = new File(mcMMO.p.mainDirectory + "config.yml"); + private static File TreasuresFile = new File(mcMMO.p.mainDirectory + "treasures.yml"); + private static File Leaderboards = new File(mcMMO.p.leaderboardDirectory); public static void mcMMObackup() throws IOException { if (Config.getInstance().getUseMySQL()) {