Skip to content

Commit

Permalink
Improve output Messages
Browse files Browse the repository at this point in the history
change to v 0.8
  • Loading branch information
GarethNZ committed Oct 4, 2011
1 parent 84042cc commit dc25b5a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
26 changes: 14 additions & 12 deletions src/com/shawlyne/mc/MenuMetaMod/MenuMetaMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void onEnable() {
try {
yml.createNewFile();
log.info("Created an empty file " + getDataFolder() +"/config.yml, please edit it!");
config.setProperty("toughblocks", null);
config.setProperty("debug", false);
config.save();
} catch (IOException ex){
log.warning(getDescription().getName() + ": could not generate config.yml. Are the file permissions OK?");
Expand All @@ -70,12 +70,11 @@ public void onEnable() {

if( config != null )
{
// TODO:
/*if( config.getKeys("debug") != null && config.getKeys("debug").size() > 0 )
debug = config.getBoolean("debug",false);
if( debug )
{
debug = true;
log.info("Debug mode enabled");
}*/
log.log(Level.CONFIG, "[MenuMetaMod] Debug mode enabled");
}
// Load in the values from the configuration file
List <String> menukeys = config.getKeys("menus");
if( menukeys != null )
Expand All @@ -96,7 +95,8 @@ public void onEnable() {
{
String optionCommand = menudata.getString("options."+option);
optionCommand = optionCommand.replaceAll("(;?)\\s*/", "$1"); // remove starting '/' (from potentially multiple commands
System.out.println("MenuItem: " + option + " - " + optionCommand);
if( debug )
System.out.println("[MenuMetaMod] MenuItem: " + option + " - " + optionCommand);
commands.add(optionCommand);
}
String[] opts = new String[1];
Expand All @@ -108,19 +108,21 @@ public void onEnable() {
MetaModMenu menu = new MetaModMenu(title, opts, comms);
if( quickMenu == null ) quickMenu = menu;
configuredMenus.put(command, menu);
log.log(Level.INFO, "Menu " + title + " added, it will respond to the command '/qm "+ command+"'");
if( debug )
log.log(Level.INFO, "[MenuMetaMod] Menu " + title + " added, it will respond to the command '/qm "+ command+"'");
}
else if( type.equalsIgnoreCase("ValueMenu") )
{
String question = menudata.getString("question");
MetaModValueMenu menu = new MetaModValueMenu(title, opts, comms, question);
if( quickMenu == null ) quickMenu = menu;
configuredMenus.put(command, menu);
log.log(Level.INFO, "Menu " + title + " added, it will respond to the command '/qm "+ command+"'");
if( debug )
log.log(Level.INFO, "[MenuMetaMod] Menu " + title + " added, it will respond to the command '/qm "+ command+"'");
}
else
{
log.log(Level.WARNING, "Unknown menu type: " + type +". Menu " + title + " not added");
log.log(Level.WARNING, "[MenuMetaMod] Unknown menu type: " + type +". Menu " + title + " not added");
}
// TODO: Investigate programatically adding more commands to listen to
// PluginDescriptionFile wangleDescription = new PluginDescriptionFile("MenuMetaMod", "0.4", "com.shawlyne.mc.MenuMetaMod.MenuMetaMod");
Expand All @@ -132,7 +134,7 @@ else if( type.equalsIgnoreCase("ValueMenu") )

}
else
log.log(Level.WARNING, "Error accessing Config");
log.log(Level.WARNING, "[MenuMetaMod] Error accessing Config");



Expand Down Expand Up @@ -166,7 +168,7 @@ public boolean onCommand(CommandSender sender, Command command,
MetaModMenu menu = configuredMenus.get(args[0]);
if( menu == null )
{
System.out.println("Error no menu configured for : \""+ args[0]+"\"");
System.out.println("[MenuMetaMod] Error no menu configured for : \""+ args[0]+"\"");
return false;
}
MenuMetaModPlayerManager.sendMenu(player, menu);
Expand Down
5 changes: 1 addition & 4 deletions src/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ name: MenuMetaMod

main: com.shawlyne.mc.MenuMetaMod.MenuMetaMod

version: 0.7
version: 0.8

commands:
menu:
description: Player specific menu response commands
usage: /menu
qm:
description: Quick launch config specified menus
usage: /qm [Menu.command from config file]

0 comments on commit dc25b5a

Please sign in to comment.