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){
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"
};
}

View file

@ -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"
};
}

View file

@ -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<String> 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<String> 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;
}
}

View file

@ -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]");
}
}

View file

@ -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)
;
}
}