mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Fix file not found exception and bm01 being spaced oddly in mcmmo command
This commit is contained in:
parent
22169c64db
commit
6f2a2fd9e6
@ -67,32 +67,12 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
p = this;
|
p = this;
|
||||||
mcmmo = getFile();
|
mcmmo = getFile();
|
||||||
versionFile = new File(getDataFolder(), "VERSION");
|
|
||||||
|
|
||||||
mainDirectory = getDataFolder().getPath() + File.separator;
|
mainDirectory = getDataFolder().getPath() + File.separator;
|
||||||
flatFileDirectory = mainDirectory + "FlatFileStuff" + File.separator;
|
flatFileDirectory = mainDirectory + "FlatFileStuff" + File.separator;
|
||||||
leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator;
|
leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator;
|
||||||
usersFile = flatFileDirectory + "mcmmo.users";
|
usersFile = flatFileDirectory + "mcmmo.users";
|
||||||
|
|
||||||
if (!versionFile.exists()) {
|
|
||||||
updateVersion();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
String vnum = readVersion();
|
|
||||||
|
|
||||||
//This will be changed to whatever version preceded when we actually need updater code.
|
|
||||||
//Version 1.0.48 is the first to implement this, no checking before that version can be done.
|
|
||||||
if (vnum.equalsIgnoreCase("1.0.48")) {
|
|
||||||
updateFrom(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Just add in more else if blocks for versions that need updater code. Increment the updateFrom age int as we do so.
|
|
||||||
//Catch all for versions not matching and no specific code being needed
|
|
||||||
else if (!vnum.equalsIgnoreCase(this.getDescription().getVersion())) {
|
|
||||||
updateFrom(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.config = new Config(this);
|
this.config = new Config(this);
|
||||||
this.config.load();
|
this.config.load();
|
||||||
|
|
||||||
@ -335,84 +315,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getCommand("mchud").setExecutor(new MchudCommand(this));
|
getCommand("mchud").setExecutor(new MchudCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update mcMMO from a given version
|
|
||||||
* </p>
|
|
||||||
* It is important to always assume that you are updating from the lowest possible version.
|
|
||||||
* Thus, every block of updater code should be complete and self-contained; finishing all
|
|
||||||
* SQL transactions and closing all file handlers, such that the next block of updater code
|
|
||||||
* if called will handle updating as expected.
|
|
||||||
*
|
|
||||||
* @param age Specifies which updater code to run
|
|
||||||
*/
|
|
||||||
public void updateFrom(int age) {
|
|
||||||
|
|
||||||
//No updater code needed, just update the version.
|
|
||||||
if (age == -1) {
|
|
||||||
updateVersion();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Updater code from age 1 goes here
|
|
||||||
if (age <= 1) {
|
|
||||||
//Since age 1 is an example for now, we will just let it do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
//If we are updating from age 1 but we need more to reach age 2, this will run too.
|
|
||||||
if (age <= 2) {
|
|
||||||
|
|
||||||
}
|
|
||||||
updateVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the version file.
|
|
||||||
*/
|
|
||||||
public void updateVersion() {
|
|
||||||
try {
|
|
||||||
versionFile.createNewFile();
|
|
||||||
BufferedWriter vout = new BufferedWriter(new FileWriter(versionFile));
|
|
||||||
vout.write(this.getDescription().getVersion());
|
|
||||||
vout.close();
|
|
||||||
}
|
|
||||||
catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
catch (SecurityException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current mcMMO version.
|
|
||||||
*
|
|
||||||
* @return a String representing the current mcMMO version
|
|
||||||
*/
|
|
||||||
public String readVersion() {
|
|
||||||
byte[] buffer = new byte[(int) versionFile.length()];
|
|
||||||
BufferedInputStream f = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
f = new BufferedInputStream(new FileInputStream(versionFile));
|
|
||||||
f.read(buffer);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if (f != null) {
|
|
||||||
try {
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
catch (IOException ignored) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new String(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boilerplate Custom Config Stuff
|
* Boilerplate Custom Config Stuff
|
||||||
*/
|
*/
|
||||||
|
@ -363,7 +363,7 @@ Combat.TouchedFuzzy=[[DARK_RED]]Touched Fuzzy. Felt Dizzy.
|
|||||||
|
|
||||||
#COMMANDS
|
#COMMANDS
|
||||||
##generic
|
##generic
|
||||||
mcMMO.Description=[[DARK_AQUA]]About the [[YELLOW]]mcMMO[[DARK_AQUA]] Project:,[[GOLD]]mcMMO is an [[RED]]open source[[GOLD]] RPG mod created in February 2011,[[GOLD]]by [[BLUE]]nossr50[[GOLD]]. The goal is to provide a quality RPG experience.,[[DARK_AQUA]]Tips:,[[GOLD]] - [[GREEN]]Use [[RED]]/mcc[[GREEN]] to see commands,[[GOLD]] - [[GREEN]]Type [[RED]]/SKILLNAME[[GREEN]] to see detailed skill info,[[DARK_AQUA]]Developers:,[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Project Lead),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Senior Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),,[[GOLD]] - [[GREEN]]bm01 [[BLUE]](Developer),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]http://bit.ly/H6XwFb[[GOLD]] Bukkit Forum Thread
|
mcMMO.Description=[[DARK_AQUA]]About the [[YELLOW]]mcMMO[[DARK_AQUA]] Project:,[[GOLD]]mcMMO is an [[RED]]open source[[GOLD]] RPG mod created in February 2011,[[GOLD]]by [[BLUE]]nossr50[[GOLD]]. The goal is to provide a quality RPG experience.,[[DARK_AQUA]]Tips:,[[GOLD]] - [[GREEN]]Use [[RED]]/mcc[[GREEN]] to see commands,[[GOLD]] - [[GREEN]]Type [[RED]]/SKILLNAME[[GREEN]] to see detailed skill info,[[DARK_AQUA]]Developers:,[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Project Lead),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Senior Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]bm01 [[BLUE]](Developer),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]http://bit.ly/H6XwFb[[GOLD]] Bukkit Forum Thread
|
||||||
Commands.Ability.Off=Ability use toggled [[RED]]off
|
Commands.Ability.Off=Ability use toggled [[RED]]off
|
||||||
Commands.Ability.On=Ability use toggled [[GREEN]]on
|
Commands.Ability.On=Ability use toggled [[GREEN]]on
|
||||||
Commands.AdminChat.Off=Admin Chat only [[RED]]Off
|
Commands.AdminChat.Off=Admin Chat only [[RED]]Off
|
||||||
|
Loading…
Reference in New Issue
Block a user