Changed how a few variables were initialized

This commit is contained in:
nossr50 2012-05-05 10:16:41 -07:00
parent baf7ffd441
commit d9b3eff18f
10 changed files with 21 additions and 32 deletions

View File

@ -17,7 +17,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class McremoveCommand implements CommandExecutor { public class McremoveCommand implements CommandExecutor {
private final String location = mcMMO.usersFile; private final String location = mcMMO.p.usersFile;
private final mcMMO plugin; private final mcMMO plugin;
public McremoveCommand (mcMMO plugin) { public McremoveCommand (mcMMO plugin) {

View File

@ -57,7 +57,7 @@ public class PlayerProfile {
HashMap<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>(); HashMap<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
private String playerName; private String playerName;
private String location = mcMMO.usersFile; private String location = mcMMO.p.usersFile;
public PlayerProfile(String name, boolean addNew) { public PlayerProfile(String name, boolean addNew) {
hud = Config.getInstance().defaulthud; hud = Config.getInstance().defaulthud;

View File

@ -52,11 +52,11 @@ public class mcMMO extends JavaPlugin {
public static File mcmmo; public static File mcmmo;
//File Paths //File Paths
public static String mainDirectory; public final String mainDirectory = getDataFolder().getPath() + File.separator;
public static String flatFileDirectory; public final String flatFileDirectory = mainDirectory + "FlatFileStuff" + File.separator;
public static String usersFile; public final String usersFile = flatFileDirectory + "mcmmo.users";
public static String leaderboardDirectory; public final String leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator;
public static String modDirectory; public final String modDirectory = mainDirectory + "ModConfigs" + File.separator;
/** /**
* Things to be run when the plugin is enabled. * Things to be run when the plugin is enabled.
@ -65,12 +65,6 @@ public class mcMMO extends JavaPlugin {
p = this; p = this;
mcmmo = getFile(); 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()) { if (!Config.getInstance().getUseMySQL()) {
Users.loadUsers(); Users.loadUsers();
} }

View File

@ -170,7 +170,7 @@ public class Party {
* @return the list of parties. * @return the list of parties.
*/ */
public ArrayList<String> getParties() { public ArrayList<String> getParties() {
String location = mcMMO.usersFile; String location = mcMMO.p.usersFile;
ArrayList<String> parties = new ArrayList<String>(); ArrayList<String> parties = new ArrayList<String>();
try { try {

View File

@ -17,7 +17,7 @@ public class SQLConversionTask implements Runnable {
@Override @Override
public void run() { public void run() {
String location = mcMMO.usersFile; String location = mcMMO.p.usersFile;
try { try {
FileReader file = new FileReader(location); FileReader file = new FileReader(location);

View File

@ -34,7 +34,7 @@ import com.gmail.nossr50.util.Users;
public class SpoutStuff { public class SpoutStuff {
private static mcMMO plugin = mcMMO.p; 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 hudDirectory = spoutDirectory + "HUD" + File.separator;
public final static String hudStandardDirectory = hudDirectory + "Standard" + File.separator; public final static String hudStandardDirectory = hudDirectory + "Standard" + File.separator;
public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator; public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator;

View File

@ -8,7 +8,6 @@ import java.sql.PreparedStatement;
import java.util.HashMap; import java.util.HashMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.DatabaseUpdate; import com.gmail.nossr50.datatypes.DatabaseUpdate;

View File

@ -14,8 +14,8 @@ import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.Tree; import com.gmail.nossr50.datatypes.Tree;
public class Leaderboard { public class Leaderboard {
private static String leaderboardsDirectory = mcMMO.leaderboardDirectory; private static String leaderboardsDirectory = mcMMO.p.leaderboardDirectory;
private static String location = mcMMO.usersFile; private static String location = mcMMO.p.usersFile;
private static mcMMO plugin = mcMMO.p; private static mcMMO plugin = mcMMO.p;
/** /**

View File

@ -13,19 +13,15 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
public class Users { public class Users {
public static String location = mcMMO.usersFile;
public static String directory = mcMMO.flatFileDirectory;
public static String directoryb = mcMMO.leaderboardDirectory;
public static HashMap<String, PlayerProfile> players = new HashMap<String, PlayerProfile>(); public static HashMap<String, PlayerProfile> players = new HashMap<String, PlayerProfile>();
/** /**
* Load users. * Load users.
*/ */
public static void loadUsers() { public static void loadUsers() {
new File(directory).mkdir(); new File(mcMMO.p.flatFileDirectory).mkdir();
new File(directoryb).mkdir(); new File(mcMMO.p.leaderboardDirectory).mkdir();
File theDir = new File(location); File theDir = new File(mcMMO.p.usersFile);
if (!theDir.exists()) { if (!theDir.exists()) {
try { try {

View File

@ -17,13 +17,13 @@ import com.gmail.nossr50.config.Config;
public class ZipLibrary { 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 BackupDir = new File(BackupDirectory);
private static File FlatFileDirectory = new File(mcMMO.flatFileDirectory); private static File FlatFileDirectory = new File(mcMMO.p.flatFileDirectory);
private static File UsersFile = new File(mcMMO.usersFile); private static File UsersFile = new File(mcMMO.p.usersFile);
private static File ConfigFile = new File(mcMMO.mainDirectory + "config.yml"); private static File ConfigFile = new File(mcMMO.p.mainDirectory + "config.yml");
private static File TreasuresFile = new File(mcMMO.mainDirectory + "treasures.yml"); private static File TreasuresFile = new File(mcMMO.p.mainDirectory + "treasures.yml");
private static File Leaderboards = new File(mcMMO.leaderboardDirectory); private static File Leaderboards = new File(mcMMO.p.leaderboardDirectory);
public static void mcMMObackup() throws IOException { public static void mcMMObackup() throws IOException {
if (Config.getInstance().getUseMySQL()) { if (Config.getInstance().getUseMySQL()) {