diff --git a/src/Changelog.txt b/src/Changelog.txt index 423c7d378..95a2f0283 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -1,5 +1,8 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code +Version 1.1.17 +/mmoedit and /addxp are useable from the console now + Version 1.1.16 Added Melons to Herbalism xp tables Endermen added to Combat skill xp tables diff --git a/src/com/gmail/nossr50/command/Commands.java b/src/com/gmail/nossr50/command/Commands.java index 4d8361e5c..4383f437b 100644 --- a/src/com/gmail/nossr50/command/Commands.java +++ b/src/com/gmail/nossr50/command/Commands.java @@ -879,69 +879,112 @@ public class Commands } else if(LoadProperties.mmoeditEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(""+LoadProperties.mmoedit)) { - - if(!mcPermissions.getInstance().mmoedit(player)) + if(sender instanceof Player) { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(split.length < 3) - { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); - return true; - } - if(split.length == 4) - { - if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) + if(!mcPermissions.getInstance().mmoedit(player)) { - int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue); - player.sendMessage(ChatColor.RED+split[2]+" has been modified."); + player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); + return true; } - } - else if(split.length == 3) - { - if(m.isInt(split[2]) && Skills.isSkill(split[1])) + if(split.length < 3) { - int newvalue = Integer.valueOf(split[2]); - PP.modifyskill(Skills.getSkillType(split[1]), newvalue); - player.sendMessage(ChatColor.RED+split[1]+" has been modified."); + player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); + return true; + } + if(split.length == 4) + { + if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) + { + int newvalue = Integer.valueOf(split[3]); + Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue); + player.sendMessage(ChatColor.RED+split[2]+" has been modified."); + } + } + else if(split.length == 3) + { + if(m.isInt(split[2]) && Skills.isSkill(split[1])) + { + int newvalue = Integer.valueOf(split[2]); + PP.modifyskill(Skills.getSkillType(split[1]), newvalue); + player.sendMessage(ChatColor.RED+split[1]+" has been modified."); + } + } else + { + player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); + } + } else { + //If they do it wrong, inform them + if(split.length < 3) + { + System.out.println("Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); + return true; + } + else if(split.length == 4) + { + if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) + { + int newvalue = Integer.valueOf(split[3]); + Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue); + System.out.println(split[2]+" has been modified for "+getPlayer(split[1]).getName()+"."); + } + } + else + { + System.out.println("Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); } - } else - { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); } } /* * ADD EXPERIENCE COMMAND */ - else if(LoadProperties.addxpEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.addxp)){ - - if(!mcPermissions.getInstance().mmoedit(player)){ - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(split.length < 3){ - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp"); - return true; - } - if(split.length == 4){ - if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) - { - int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).addXP(Skills.getSkillType(split[2]), newvalue); - getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); - player.sendMessage(ChatColor.RED+split[2]+" has been modified."); - Skills.XpCheckAll(getPlayer(split[1])); - } - } - else if(split.length == 3 && m.isInt(split[2]) && Skills.isSkill(split[1])) + else if(LoadProperties.addxpEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.addxp)) + { + if(sender instanceof Player) { - int newvalue = Integer.valueOf(split[2]); - Users.getProfile(player).addXP(Skills.getSkillType(split[1]), newvalue); - player.sendMessage(ChatColor.RED+split[1]+" has been modified."); + if(!mcPermissions.getInstance().mmoedit(player)){ + player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + if(split.length < 3){ + player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp"); + return true; + } + if(split.length == 4){ + if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) + { + int newvalue = Integer.valueOf(split[3]); + Users.getProfile(getPlayer(split[1])).addXP(Skills.getSkillType(split[2]), newvalue); + getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); + player.sendMessage(ChatColor.RED+split[2]+" has been modified."); + Skills.XpCheckAll(getPlayer(split[1])); + } + } + else if(split.length == 3 && m.isInt(split[2]) && Skills.isSkill(split[1])) + { + int newvalue = Integer.valueOf(split[2]); + Users.getProfile(player).addXP(Skills.getSkillType(split[1]), newvalue); + player.sendMessage(ChatColor.RED+split[1]+" has been modified."); + } else { + player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp"); + } } else { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp"); + if(split.length < 3) + { + System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp"); + return true; + } else if(split.length == 4) + { + if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) + { + int newvalue = Integer.valueOf(split[3]); + Users.getProfile(getPlayer(split[1])).addXP(Skills.getSkillType(split[2]), newvalue); + getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); + System.out.println(split[2]+" has been modified for "+getPlayer(split[1]).getName()+"."); + Skills.XpCheckAll(getPlayer(split[1])); + } + } else { + System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp"); + } } } else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP.inParty()) diff --git a/src/plugin.yml b/src/plugin.yml index 363db92d6..720965541 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 1.1.16 +version: 1.1.17 ALPHA WIP #1 softdepend: [Spout] commands: mchud: