Adjusted Meta setting
This commit is contained in:
parent
f31e183153
commit
a400bb9acb
5 changed files with 13 additions and 6 deletions
|
@ -8,14 +8,17 @@ import org.bukkit.Sound;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public abstract class BaseCommand extends TBMCCommandBase{
|
public abstract class BaseCommand extends TBMCCommandBase{
|
||||||
public static ItemStack CreateDebugPotato(List<String> message){
|
public static ItemStack CreateDebugPotato(List<String> message){
|
||||||
ItemStack potato = new ItemStack(Material.BAKED_POTATO);
|
ItemStack potato = new ItemStack(Material.BAKED_POTATO);
|
||||||
potato.getItemMeta().setDisplayName("Spicy Debug Potato");
|
ItemMeta meta = potato.getItemMeta();
|
||||||
potato.getItemMeta().setLore(message);
|
meta.setDisplayName("Spicy Debug Potato");
|
||||||
|
meta.setLore(message);
|
||||||
|
potato.setItemMeta(meta);
|
||||||
potato.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10);
|
potato.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10);
|
||||||
return potato;
|
return potato;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ 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 alisolarflare.components.BaseCommand;
|
import alisolarflare.components.BaseCommand;
|
||||||
|
|
||||||
|
@ -51,7 +52,10 @@ public abstract class Insurance {
|
||||||
insuranceItem = BaseCommand.CreateDebugPotato(lore);
|
insuranceItem = BaseCommand.CreateDebugPotato(lore);
|
||||||
}
|
}
|
||||||
insuranceItem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
insuranceItem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||||
insuranceItem.getItemMeta().setLore(lore);
|
ItemMeta meta = insuranceItem.getItemMeta();
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName("Insurance " + insuranceType.toString());
|
||||||
|
insuranceItem.setItemMeta(meta);
|
||||||
return insuranceItem;
|
return insuranceItem;
|
||||||
}
|
}
|
||||||
public static ItemStack getInsurance(InsuranceType insuranceType, int amount){
|
public static ItemStack getInsurance(InsuranceType insuranceType, int amount){
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class getInsuranceBar extends ModCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (args.length > 0 || StringUtils.isNumeric(args[0])){
|
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{
|
}else{
|
||||||
//player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot));
|
//player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot));
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class getInsuranceBlock extends ModCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (args.length > 0 || StringUtils.isNumeric(args[0])){
|
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{
|
}else{
|
||||||
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block));
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Block));
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class getInsuranceNugget extends ModCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (args.length > 0 || StringUtils.isNumeric(args[0])){
|
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{
|
}else{
|
||||||
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget));
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Nugget));
|
||||||
|
|
Loading…
Reference in a new issue