From 248f54e3ec6e8b64b4d653612ad80d5969b21185 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 17 Dec 2016 03:59:22 -0500 Subject: [PATCH] Fixed all bugs except implementation --- .../components/insurance/InsuranceComponent.java | 2 +- .../components/insurance/getInsurance.java | 14 +++++++++++--- .../components/insurance/getInsuranceBlock.java | 11 ++++++++++- ...getInsuranceBar.java => getInsuranceIngot.java} | 12 ++++++++++-- .../components/insurance/getInsuranceNugget.java | 10 +++++++++- 5 files changed, 41 insertions(+), 8 deletions(-) rename src/buttondevteam/alipresents/components/insurance/{getInsuranceBar.java => getInsuranceIngot.java} (69%) diff --git a/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java b/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java index 1099605..ee053f6 100644 --- a/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java +++ b/src/buttondevteam/alipresents/components/insurance/InsuranceComponent.java @@ -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()); } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsurance.java b/src/buttondevteam/alipresents/components/insurance/getInsurance.java index 6a687ea..aba87bb 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsurance.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsurance.java @@ -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: // or 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: + default: + // 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() + + " " + + " <" + Insurance.InsuranceType.values().toString() + ">"); return false; } } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java index f671c12..cfbc15d 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceBlock.java @@ -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" + }; + } } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java similarity index 69% rename from src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java rename to src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java index 13f3339..bfd71dc 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceBar.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceIngot.java @@ -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" + }; } } diff --git a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java index 5ccaa03..42e2c62 100644 --- a/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java +++ b/src/buttondevteam/alipresents/components/insurance/getInsuranceNugget.java @@ -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" + }; + } }