Fixed all bugs except implementation

This commit is contained in:
alisolarflare 2016-12-17 03:59:22 -05:00
parent baf804ddc0
commit 248f54e3ec
5 changed files with 41 additions and 8 deletions

View file

@ -10,7 +10,7 @@ public class InsuranceComponent extends Component {
public void register(JavaPlugin plugin) {
registerCommand(plugin, new getInsurance());
registerCommand(plugin, new getInsuranceNugget());
registerCommand(plugin, new getInsuranceBar());
registerCommand(plugin, new getInsuranceIngot());
registerCommand(plugin, new getInsuranceBlock());
}

View file

@ -15,9 +15,9 @@ public class getInsurance extends ModCommand {
InsuranceType insuranceType = defaultInsuranceType;
switch(args.length){
case 0:
case 0: // no arguments
break;
case 1:
case 1: // <amount> or <type> argument
if (StringUtils.isNumeric(args[0])){
amount = Integer.parseInt(args[0]);
break;
@ -25,14 +25,22 @@ public class getInsurance extends ModCommand {
insuranceType = InsuranceType.valueOf(args[0]);
break;
}else{
player.sendMessage("Invalid Argument " + args[0]);
player.sendMessage("Enter a type of insurance or a number as an argument");
player.sendMessage(Insurance.InsuranceType.values().toString());
return false;
}
default:
// <amount> <type> argument
if (StringUtils.isNumeric(args[0]) && Insurance.isInsuranceType(args[1])){
amount = Integer.parseInt(args[0]);
insuranceType = InsuranceType.valueOf(args[0]);
break;
}else{
player.sendMessage("Invalid Argument " + args[0] + "|" + args[1]);
player.sendMessage("Usage /" + this.GetCommandPath()
+ " <amount>"
+ " <" + Insurance.InsuranceType.values().toString() + ">");
return false;
}
}

View file

@ -15,11 +15,20 @@ public class getInsuranceBlock extends ModCommand {
}else{
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block));
}
return false;
return true;
}
@Override
public String GetCommandPath() {
return "insurance getblock";
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /insurance getblock [amount]",
"This command returns an insurance block, which on death,",
"splits into 9 insurance ingot which each saves 1 row of",
"inventory per ingot"
};
}
}

View file

@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
import buttondevteam.alipresents.architecture.commands.ModCommand;
import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
public class getInsuranceBar extends ModCommand {
public class getInsuranceIngot extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
@ -20,6 +20,14 @@ public class getInsuranceBar extends ModCommand {
@Override
public String GetCommandPath() {
return "insurance getBar";
return "insurance getingot";
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /insurance getingot [amount]",
"This command returns an insurance ingot, which on death,",
"saves one row of inventory"
};
}
}

View file

@ -15,11 +15,19 @@ public class getInsuranceNugget extends ModCommand {
}else{
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget));
}
return false;
return true;
}
@Override
public String GetCommandPath() {
return "insurance getnugget";
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /insurance getnugget [amount]",
"This command returns an insurance nugget, which on death,",
"saves one itemslot in the inventory"
};
}
}