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:
#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

View File

@ -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())

View File

@ -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: