Updated potatoes

This commit is contained in:
alisolarflare 2016-11-19 21:14:17 -05:00
parent c4e79bd449
commit b21ce61d7f
5 changed files with 89 additions and 88 deletions

View file

@ -11,7 +11,6 @@ public abstract class ModCommand extends BaseCommand{
public String[] GetHelpText(String alias){ public String[] GetHelpText(String alias){
return new String[] { return new String[] {
"This command doesn't have help text, ask a dev to add one", "This command doesn't have help text, ask a dev to add one",
" using public String[] GetHelpText. ",
"If you're a dev, write the help text you lazy bastard. -Ali" "If you're a dev, write the help text you lazy bastard. -Ali"
}; };
} }

View file

@ -15,9 +15,9 @@ public abstract class PlayerCommand extends BaseCommand{
@Override @Override
public String[] GetHelpText(String alias){ public String[] GetHelpText(String alias){
return new String[] { return new String[] {
"This command doesn't have help text, ask a mod to ask a ", "This command doesn't have help text. ",
"dev to add one using public String[] GetHelpText. ", "If you're a player, ask a mod to write one",
"If you're a mod, ask a dev to write the help text.", "If you're a mod, ask a dev to write one",
"If you're a dev, write the help text you lazy bastard. -Ali" "If you're a dev, write the help text you lazy bastard. -Ali"
}; };
} }

View file

@ -1,81 +1,84 @@
package alisolarflare.components.insurance; package alisolarflare.components.insurance;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import buttondevteam.lib.DebugPotatoAPI; import buttondevteam.lib.DebugPotato;
import buttondevteam.lib.DebugPotatoAPI;
public abstract class Insurance {
public static enum InsuranceType{ public abstract class Insurance {
Nugget, Ingot, Block public static enum InsuranceType{
}; Nugget, Ingot, Block
public static ItemStack getInsurance(InsuranceType insuranceType){ };
ItemStack insuranceItem; public static ItemStack getInsurance(InsuranceType insuranceType){
List<String> lore; ItemStack insuranceItem;
switch(insuranceType){ List<String> lore;
case Nugget: switch(insuranceType){
insuranceItem = new ItemStack(Material.GOLD_NUGGET); case Nugget:
lore = Arrays.asList( insuranceItem = new ItemStack(Material.GOLD_NUGGET);
"This insurance nugget will protect ", lore = Arrays.asList(
"one inventory slot from death! Be careful", "This insurance nugget will protect ",
"though, insurance is removed whenever ", "one inventory slot from death! Be careful",
"you die, with each itemslot costing", "though, insurance is removed whenever ",
"one nugget." "you die, with each itemslot costing",
); "one nugget."
break; );
case Ingot: break;
insuranceItem = new ItemStack(Material.GOLD_INGOT); case Ingot:
lore = Arrays.asList( insuranceItem = new ItemStack(Material.GOLD_INGOT);
"This insurance ingot will protect ", lore = Arrays.asList(
"nine inventory slots from death! Be ", "This insurance ingot will protect ",
"careful though, insurance is removed ", "nine inventory slots from death! Be ",
"whenever you die, with each inventory ", "careful though, insurance is removed ",
"row costing one ingot." "whenever you die, with each inventory ",
); "row costing one ingot."
break; );
case Block: break;
insuranceItem = new ItemStack(Material.GOLD_BLOCK); case Block:
lore = Arrays.asList( insuranceItem = new ItemStack(Material.GOLD_BLOCK);
"This insurance block will give your ", lore = Arrays.asList(
"inventory full protection against death! ", "This insurance block will give your ",
"Be careful though, this block will split ", "inventory full protection against death! ",
"into ingots, and you'll lose 3 upon ", "Be careful though, this block will split ",
"death." "into ingots, and you'll lose 3 upon ",
); "death."
break; );
default: break;
default:
lore = Arrays.asList(
"The InsuranceType " + insuranceType.toString() + " ", lore = Arrays.asList(
"is not handled by the Insurance Class in: ", "The InsuranceType " + insuranceType.toString() + " ",
Insurance.class.getPackage().getName() + ".", "is not handled by the Insurance Class in: ",
"Contact a developer with a screenshot of this message" Insurance.class.getPackage().getName() + ".",
); "Contact a developer with a screenshot of this message"
insuranceItem = DebugPotatoAPI.CreateDebugPotato(lore); );
} DebugPotato potato = new DebugPotato();
insuranceItem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); potato.setMessage(lore);
ItemMeta meta = insuranceItem.getItemMeta(); insuranceItem = potato.toItemStack();
meta.setLore(lore); }
meta.setDisplayName("Insurance " + insuranceType.toString()); insuranceItem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
insuranceItem.setItemMeta(meta); ItemMeta meta = insuranceItem.getItemMeta();
return insuranceItem; meta.setLore(lore);
} meta.setDisplayName("Insurance " + insuranceType.toString());
public static ItemStack getInsurance(InsuranceType insuranceType, int amount){ insuranceItem.setItemMeta(meta);
ItemStack insurance = Insurance.getInsurance(insuranceType); return insuranceItem;
insurance.setAmount(amount); }
return insurance; public static ItemStack getInsurance(InsuranceType insuranceType, int amount){
} ItemStack insurance = Insurance.getInsurance(insuranceType);
public static boolean isInsuranceType(String string){ insurance.setAmount(amount);
for (InsuranceType insuranceType : Insurance.InsuranceType.values()){ return insurance;
if (string.equalsIgnoreCase(insuranceType.toString())){ }
return true; public static boolean isInsuranceType(String string){
} for (InsuranceType insuranceType : Insurance.InsuranceType.values()){
} if (string.equalsIgnoreCase(insuranceType.toString())){
return false; return true;
} }
} }
return false;
}
}

View file

@ -9,9 +9,7 @@ public class BoomBowDeathListener implements Listener{
@EventHandler @EventHandler
public void onBoomBowDeath(PlayerDeathEvent event){ public void onBoomBowDeath(PlayerDeathEvent event){
Player player = event.getEntity(); Player player = event.getEntity();
if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){ if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){
player.sendMessage("42!");
event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]"); event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]");
} }
} }

View file

@ -99,7 +99,8 @@ public class BoomBowListener implements Listener {
boomBow.setDurability((short) (boomBow.getDurability() + 3)); boomBow.setDurability((short) (boomBow.getDurability() + 3));
if(boomBow.getDurability() < 0){ if(boomBow.getDurability() < 0){
player.getInventory().setItemInMainHand(null); player.getInventory().setItemInMainHand(null);
player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0); player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0)
;
} }
} }