ability to specify a single file with /f reload (i.e. /f reload conf), so you don't have to reload all 4 of them
also a trivial typo fix
This commit is contained in:
parent
6f0dcf4b29
commit
35e17f3ec5
@ -67,7 +67,7 @@ public class FCommandHelp extends FBaseCommand {
|
||||
pageLines.add( "Create a faction using these two commands:" );
|
||||
pageLines.add( new FCommandCreate().getUseageTemplate() );
|
||||
pageLines.add( new FCommandDescription().getUseageTemplate() );
|
||||
pageLines.add( "You might wan't to close it and use invitations:" );
|
||||
pageLines.add( "You might want to close it and use invitations:" );
|
||||
pageLines.add( new FCommandOpen().getUseageTemplate() );
|
||||
pageLines.add( new FCommandInvite().getUseageTemplate() );
|
||||
pageLines.add( new FCommandDeinvite().getUseageTemplate() );
|
||||
|
@ -12,7 +12,9 @@ public class FCommandReload extends FBaseCommand {
|
||||
public FCommandReload() {
|
||||
aliases.add("reload");
|
||||
|
||||
helpDescription = "reloads the config";
|
||||
optionalParameters.add("file");
|
||||
|
||||
helpDescription = "reloads all json files, or a specific one";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -23,16 +25,49 @@ public class FCommandReload extends FBaseCommand {
|
||||
public void perform() {
|
||||
Factions.log("=== RELOAD START ===");
|
||||
long timeInitStart = System.currentTimeMillis();
|
||||
String fileName = "s";
|
||||
|
||||
Conf.load();
|
||||
FPlayer.load();
|
||||
Faction.load();
|
||||
Board.load();
|
||||
// Was a single file specified?
|
||||
if (parameters.size() > 0) {
|
||||
String file = parameters.get(0);
|
||||
if (file.equalsIgnoreCase("conf") || file.equalsIgnoreCase("conf.json")) {
|
||||
Factions.log("RELOADING CONF.JSON");
|
||||
Conf.load();
|
||||
fileName = " conf.json";
|
||||
}
|
||||
else if (file.equalsIgnoreCase("board") || file.equalsIgnoreCase("board.json")) {
|
||||
Factions.log("RELOADING BOARD.JSON");
|
||||
Board.load();
|
||||
fileName = " board.json";
|
||||
}
|
||||
else if (file.equalsIgnoreCase("factions") || file.equalsIgnoreCase("factions.json")) {
|
||||
Factions.log("RELOADING FACTIONS.JSON");
|
||||
Faction.load();
|
||||
fileName = " factions.json";
|
||||
}
|
||||
else if (file.equalsIgnoreCase("players") || file.equalsIgnoreCase("players.json")) {
|
||||
Factions.log("RELOADING PLAYERS.JSON");
|
||||
FPlayer.load();
|
||||
fileName = " players.json";
|
||||
}
|
||||
else {
|
||||
Factions.log("RELOAD CANCELLED - SPECIFIED FILE INVALID");
|
||||
me.sendMessage("Invalid file specified. Valid files: conf, board, factions, players.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Factions.log("RELOADING ALL FILES");
|
||||
Conf.load();
|
||||
FPlayer.load();
|
||||
Faction.load();
|
||||
Board.load();
|
||||
}
|
||||
|
||||
long timeReload = (System.currentTimeMillis()-timeInitStart);
|
||||
Factions.log("=== RELOAD DONE (Took "+timeReload+"ms) ===");
|
||||
|
||||
me.sendMessage("FACTIONS RELOAD DONE IN " + timeReload + "ms");
|
||||
me.sendMessage("Factions file" + fileName + " reloaded from disk, took " + timeReload + "ms");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user