Probably fixed Insurance IllegalArgumentException

This commit is contained in:
alisolarflare 2016-12-17 07:22:56 -05:00
parent 812dd89ee0
commit 5801eaaddd
5 changed files with 12 additions and 12 deletions

View file

@ -12,13 +12,13 @@ import buttondevteam.lib.DebugPotato;
public abstract class Insurance {
public static enum InsuranceType{
Nugget, Ingot, Block
nugget, ingot, block
};
public static ItemStack getInsurance(InsuranceType insuranceType){
ItemStack insuranceItem;
List<String> lore;
switch(insuranceType){
case Nugget:
case nugget:
insuranceItem = new ItemStack(Material.GOLD_NUGGET);
lore = Arrays.asList(
"This insurance nugget will protect ",
@ -28,7 +28,7 @@ public abstract class Insurance {
"one nugget."
);
break;
case Ingot:
case ingot:
insuranceItem = new ItemStack(Material.GOLD_INGOT);
lore = Arrays.asList(
"This insurance ingot will protect ",
@ -38,7 +38,7 @@ public abstract class Insurance {
"row costing one ingot."
);
break;
case Block:
case block:
insuranceItem = new ItemStack(Material.GOLD_BLOCK);
lore = Arrays.asList(
"This insurance block will give your ",
@ -74,7 +74,7 @@ public abstract class Insurance {
}
public static boolean isInsuranceType(String string){
for (InsuranceType insuranceType : Insurance.InsuranceType.values()){
if (string.equalsIgnoreCase(insuranceType.toString())){
if (string.equals(insuranceType.toString())){
return true;
}
}

View file

@ -8,7 +8,7 @@ import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
public class getInsurance extends ModCommand {
private final int defaultAmount = 1;
private final InsuranceType defaultInsuranceType = InsuranceType.Block;
private final InsuranceType defaultInsuranceType = InsuranceType.block;
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
int amount = defaultAmount;

View file

@ -11,9 +11,9 @@ public class getInsuranceBlock extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length > 0 && StringUtils.isNumeric(args[0])){
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block, Integer.parseInt(args[0])));
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.block, Integer.parseInt(args[0])));
}else{
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block));
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.block));
}
return true;
}

View file

@ -11,9 +11,9 @@ public class getInsuranceIngot extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length > 0 && StringUtils.isNumeric(args[0])){
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot, Integer.parseInt(args[0])));
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.ingot, Integer.parseInt(args[0])));
}else{
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot));
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.ingot));
}
return true;
}

View file

@ -11,9 +11,9 @@ public class getInsuranceNugget extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length > 0 && StringUtils.isNumeric(args[0])){
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget, Integer.parseInt(args[0])));
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.nugget, Integer.parseInt(args[0])));
}else{
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget));
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.nugget));
}
return true;
}