Fixed all bugs except implementation
This commit is contained in:
parent
baf804ddc0
commit
248f54e3ec
5 changed files with 41 additions and 8 deletions
|
@ -10,7 +10,7 @@ public class InsuranceComponent extends Component {
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
registerCommand(plugin, new getInsurance());
|
registerCommand(plugin, new getInsurance());
|
||||||
registerCommand(plugin, new getInsuranceNugget());
|
registerCommand(plugin, new getInsuranceNugget());
|
||||||
registerCommand(plugin, new getInsuranceBar());
|
registerCommand(plugin, new getInsuranceIngot());
|
||||||
registerCommand(plugin, new getInsuranceBlock());
|
registerCommand(plugin, new getInsuranceBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ public class getInsurance extends ModCommand {
|
||||||
InsuranceType insuranceType = defaultInsuranceType;
|
InsuranceType insuranceType = defaultInsuranceType;
|
||||||
|
|
||||||
switch(args.length){
|
switch(args.length){
|
||||||
case 0:
|
case 0: // no arguments
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // <amount> or <type> argument
|
||||||
if (StringUtils.isNumeric(args[0])){
|
if (StringUtils.isNumeric(args[0])){
|
||||||
amount = Integer.parseInt(args[0]);
|
amount = Integer.parseInt(args[0]);
|
||||||
break;
|
break;
|
||||||
|
@ -25,14 +25,22 @@ public class getInsurance extends ModCommand {
|
||||||
insuranceType = InsuranceType.valueOf(args[0]);
|
insuranceType = InsuranceType.valueOf(args[0]);
|
||||||
break;
|
break;
|
||||||
}else{
|
}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;
|
return false;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
// <amount> <type> argument
|
||||||
if (StringUtils.isNumeric(args[0]) && Insurance.isInsuranceType(args[1])){
|
if (StringUtils.isNumeric(args[0]) && Insurance.isInsuranceType(args[1])){
|
||||||
amount = Integer.parseInt(args[0]);
|
amount = Integer.parseInt(args[0]);
|
||||||
insuranceType = InsuranceType.valueOf(args[0]);
|
insuranceType = InsuranceType.valueOf(args[0]);
|
||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
|
player.sendMessage("Invalid Argument " + args[0] + "|" + args[1]);
|
||||||
|
player.sendMessage("Usage /" + this.GetCommandPath()
|
||||||
|
+ " <amount>"
|
||||||
|
+ " <" + Insurance.InsuranceType.values().toString() + ">");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,20 @@ public class getInsuranceBlock extends ModCommand {
|
||||||
}else{
|
}else{
|
||||||
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block));
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block));
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetCommandPath() {
|
public String GetCommandPath() {
|
||||||
return "insurance getblock";
|
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"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||||
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
|
import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
|
||||||
|
|
||||||
public class getInsuranceBar extends ModCommand {
|
public class getInsuranceIngot extends ModCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
@ -20,6 +20,14 @@ public class getInsuranceBar extends ModCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetCommandPath() {
|
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"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,11 +15,19 @@ public class getInsuranceNugget extends ModCommand {
|
||||||
}else{
|
}else{
|
||||||
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget));
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget));
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String GetCommandPath() {
|
public String GetCommandPath() {
|
||||||
return "insurance getnugget";
|
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"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue