Small changes, mostly adding the ability to use /mmoedit and /addxp from console due to request.

This commit is contained in:
nossr50 2011-10-29 15:16:28 -07:00
parent ed0f8d7553
commit ddcfc02924
3 changed files with 98 additions and 52 deletions

View File

@ -1,5 +1,8 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code #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 Version 1.1.16
Added Melons to Herbalism xp tables Added Melons to Herbalism xp tables
Endermen added to Combat skill xp tables Endermen added to Combat skill xp tables

View File

@ -879,69 +879,112 @@ public class Commands
} }
else if(LoadProperties.mmoeditEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(""+LoadProperties.mmoedit)) else if(LoadProperties.mmoeditEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(""+LoadProperties.mmoedit))
{ {
if(sender instanceof Player)
if(!mcPermissions.getInstance().mmoedit(player))
{ {
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); if(!mcPermissions.getInstance().mmoedit(player))
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]))
{ {
int newvalue = Integer.valueOf(split[3]); player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue); return true;
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
} }
} if(split.length < 3)
else if(split.length == 3)
{
if(m.isInt(split[2]) && Skills.isSkill(split[1]))
{ {
int newvalue = Integer.valueOf(split[2]); player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue");
PP.modifyskill(Skills.getSkillType(split[1]), newvalue); return true;
player.sendMessage(ChatColor.RED+split[1]+" has been modified."); }
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 * ADD EXPERIENCE COMMAND
*/ */
else if(LoadProperties.addxpEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.addxp)){ else if(LoadProperties.addxpEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.addxp))
{
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.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]); if(!mcPermissions.getInstance().mmoedit(player)){
Users.getProfile(player).addXP(Skills.getSkillType(split[1]), newvalue); player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.RED+split[1]+" has been modified."); 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 { } 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()) else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP.inParty())

View File

@ -1,6 +1,6 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 1.1.16 version: 1.1.17 ALPHA WIP #1
softdepend: [Spout] softdepend: [Spout]
commands: commands:
mchud: mchud: