From b21ce61d7f0149784e955419111ae5c0775d374c Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 19 Nov 2016 21:14:17 -0500 Subject: [PATCH] Updated potatoes --- src/alisolarflare/components/ModCommand.java | 1 - .../components/PlayerCommand.java | 6 +- .../components/insurance/Insurance.java | 165 +++++++++--------- .../magic/tricks/BoomBowDeathListener.java | 2 - .../magic/tricks/BoomBowListener.java | 3 +- 5 files changed, 89 insertions(+), 88 deletions(-) diff --git a/src/alisolarflare/components/ModCommand.java b/src/alisolarflare/components/ModCommand.java index 3c34e4d..ddc0940 100644 --- a/src/alisolarflare/components/ModCommand.java +++ b/src/alisolarflare/components/ModCommand.java @@ -11,7 +11,6 @@ public abstract class ModCommand extends BaseCommand{ public String[] GetHelpText(String alias){ return new String[] { "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" }; } diff --git a/src/alisolarflare/components/PlayerCommand.java b/src/alisolarflare/components/PlayerCommand.java index 5115c9e..201c275 100644 --- a/src/alisolarflare/components/PlayerCommand.java +++ b/src/alisolarflare/components/PlayerCommand.java @@ -15,9 +15,9 @@ public abstract class PlayerCommand extends BaseCommand{ @Override public String[] GetHelpText(String alias){ return new String[] { - "This command doesn't have help text, ask a mod to ask a ", - "dev to add one using public String[] GetHelpText. ", - "If you're a mod, ask a dev to write the help text.", + "This command doesn't have help text. ", + "If you're a player, ask a mod to write one", + "If you're a mod, ask a dev to write one", "If you're a dev, write the help text you lazy bastard. -Ali" }; } diff --git a/src/alisolarflare/components/insurance/Insurance.java b/src/alisolarflare/components/insurance/Insurance.java index ea909c2..721bc2b 100644 --- a/src/alisolarflare/components/insurance/Insurance.java +++ b/src/alisolarflare/components/insurance/Insurance.java @@ -1,81 +1,84 @@ -package alisolarflare.components.insurance; - -import java.util.Arrays; -import java.util.List; - -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import buttondevteam.lib.DebugPotatoAPI; - -public abstract class Insurance { - public static enum InsuranceType{ - Nugget, Ingot, Block - }; - public static ItemStack getInsurance(InsuranceType insuranceType){ - ItemStack insuranceItem; - List lore; - switch(insuranceType){ - case Nugget: - insuranceItem = new ItemStack(Material.GOLD_NUGGET); - lore = Arrays.asList( - "This insurance nugget will protect ", - "one inventory slot from death! Be careful", - "though, insurance is removed whenever ", - "you die, with each itemslot costing", - "one nugget." - ); - break; - case Ingot: - insuranceItem = new ItemStack(Material.GOLD_INGOT); - lore = Arrays.asList( - "This insurance ingot will protect ", - "nine inventory slots from death! Be ", - "careful though, insurance is removed ", - "whenever you die, with each inventory ", - "row costing one ingot." - ); - break; - case Block: - insuranceItem = new ItemStack(Material.GOLD_BLOCK); - lore = Arrays.asList( - "This insurance block will give your ", - "inventory full protection against death! ", - "Be careful though, this block will split ", - "into ingots, and you'll lose 3 upon ", - "death." - ); - break; - default: - - lore = Arrays.asList( - "The InsuranceType " + insuranceType.toString() + " ", - "is not handled by the Insurance Class in: ", - Insurance.class.getPackage().getName() + ".", - "Contact a developer with a screenshot of this message" - ); - insuranceItem = DebugPotatoAPI.CreateDebugPotato(lore); - } - insuranceItem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); - ItemMeta meta = insuranceItem.getItemMeta(); - meta.setLore(lore); - meta.setDisplayName("Insurance " + insuranceType.toString()); - insuranceItem.setItemMeta(meta); - return insuranceItem; - } - public static ItemStack getInsurance(InsuranceType insuranceType, int amount){ - ItemStack insurance = Insurance.getInsurance(insuranceType); - insurance.setAmount(amount); - return insurance; - } - public static boolean isInsuranceType(String string){ - for (InsuranceType insuranceType : Insurance.InsuranceType.values()){ - if (string.equalsIgnoreCase(insuranceType.toString())){ - return true; - } - } - return false; - } -} +package alisolarflare.components.insurance; + +import java.util.Arrays; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import buttondevteam.lib.DebugPotato; +import buttondevteam.lib.DebugPotatoAPI; + +public abstract class Insurance { + public static enum InsuranceType{ + Nugget, Ingot, Block + }; + public static ItemStack getInsurance(InsuranceType insuranceType){ + ItemStack insuranceItem; + List lore; + switch(insuranceType){ + case Nugget: + insuranceItem = new ItemStack(Material.GOLD_NUGGET); + lore = Arrays.asList( + "This insurance nugget will protect ", + "one inventory slot from death! Be careful", + "though, insurance is removed whenever ", + "you die, with each itemslot costing", + "one nugget." + ); + break; + case Ingot: + insuranceItem = new ItemStack(Material.GOLD_INGOT); + lore = Arrays.asList( + "This insurance ingot will protect ", + "nine inventory slots from death! Be ", + "careful though, insurance is removed ", + "whenever you die, with each inventory ", + "row costing one ingot." + ); + break; + case Block: + insuranceItem = new ItemStack(Material.GOLD_BLOCK); + lore = Arrays.asList( + "This insurance block will give your ", + "inventory full protection against death! ", + "Be careful though, this block will split ", + "into ingots, and you'll lose 3 upon ", + "death." + ); + break; + default: + + lore = Arrays.asList( + "The InsuranceType " + insuranceType.toString() + " ", + "is not handled by the Insurance Class in: ", + Insurance.class.getPackage().getName() + ".", + "Contact a developer with a screenshot of this message" + ); + DebugPotato potato = new DebugPotato(); + potato.setMessage(lore); + insuranceItem = potato.toItemStack(); + } + insuranceItem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); + ItemMeta meta = insuranceItem.getItemMeta(); + meta.setLore(lore); + meta.setDisplayName("Insurance " + insuranceType.toString()); + insuranceItem.setItemMeta(meta); + return insuranceItem; + } + public static ItemStack getInsurance(InsuranceType insuranceType, int amount){ + ItemStack insurance = Insurance.getInsurance(insuranceType); + insurance.setAmount(amount); + return insurance; + } + public static boolean isInsuranceType(String string){ + for (InsuranceType insuranceType : Insurance.InsuranceType.values()){ + if (string.equalsIgnoreCase(insuranceType.toString())){ + return true; + } + } + return false; + } +} diff --git a/src/alisolarflare/components/magic/tricks/BoomBowDeathListener.java b/src/alisolarflare/components/magic/tricks/BoomBowDeathListener.java index 1b55fe4..3d60143 100644 --- a/src/alisolarflare/components/magic/tricks/BoomBowDeathListener.java +++ b/src/alisolarflare/components/magic/tricks/BoomBowDeathListener.java @@ -9,9 +9,7 @@ public class BoomBowDeathListener implements Listener{ @EventHandler public void onBoomBowDeath(PlayerDeathEvent event){ Player player = event.getEntity(); - if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){ - player.sendMessage("42!"); event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]"); } } diff --git a/src/alisolarflare/components/magic/tricks/BoomBowListener.java b/src/alisolarflare/components/magic/tricks/BoomBowListener.java index 5450f06..aee7e22 100644 --- a/src/alisolarflare/components/magic/tricks/BoomBowListener.java +++ b/src/alisolarflare/components/magic/tricks/BoomBowListener.java @@ -99,7 +99,8 @@ public class BoomBowListener implements Listener { boomBow.setDurability((short) (boomBow.getDurability() + 3)); if(boomBow.getDurability() < 0){ player.getInventory().setItemInMainHand(null); - player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0); + player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0) + ; } }