Use proper item names for recipes, don't allow repairing items more than two times
This commit is contained in:
parent
0dd79419eb
commit
e85682d68f
@ -20,26 +20,30 @@ public class Recipes extends MiniPlugin
|
||||
public Recipes(JavaPlugin plugin)
|
||||
{
|
||||
super("Recipes", plugin);
|
||||
|
||||
ShapedRecipe goldAxe = new ShapedRecipe(new ItemStack(Material.GOLD_AXE, 1));
|
||||
|
||||
ItemStack boosterAxe = ItemStackFactory.Instance.CreateStack(Material.GOLD_AXE, (byte) 0, 1, "Booster Axe");
|
||||
ShapedRecipe goldAxe = new ShapedRecipe(boosterAxe);
|
||||
goldAxe.shape("#MM","#SM","#S#");
|
||||
goldAxe.setIngredient('M', Material.GOLD_BLOCK);
|
||||
goldAxe.setIngredient('S', Material.STICK);
|
||||
UtilServer.getServer().addRecipe(goldAxe);
|
||||
|
||||
ShapedRecipe diamondAxe = new ShapedRecipe(new ItemStack(Material.DIAMOND_AXE, 1));
|
||||
ItemStack powerAxe = ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, "Power Axe");
|
||||
ShapedRecipe diamondAxe = new ShapedRecipe(powerAxe);
|
||||
diamondAxe.shape("#MM","#SM","#S#");
|
||||
diamondAxe.setIngredient('M', Material.DIAMOND_BLOCK);
|
||||
diamondAxe.setIngredient('S', Material.STICK);
|
||||
UtilServer.getServer().addRecipe(diamondAxe);
|
||||
|
||||
ShapedRecipe goldSword = new ShapedRecipe(new ItemStack(Material.GOLD_SWORD, 1));
|
||||
ItemStack boosterSword = ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte) 0, 1, "Booster Sword");
|
||||
ShapedRecipe goldSword = new ShapedRecipe(boosterSword);
|
||||
goldSword.shape("M","M","S");
|
||||
goldSword.setIngredient('M', Material.GOLD_BLOCK);
|
||||
goldSword.setIngredient('S', Material.STICK);
|
||||
UtilServer.getServer().addRecipe(goldSword);
|
||||
|
||||
ShapedRecipe diamondSword = new ShapedRecipe(new ItemStack(Material.DIAMOND_SWORD, 1));
|
||||
ItemStack powerSword = ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, "Power Sword");
|
||||
ShapedRecipe diamondSword = new ShapedRecipe(powerSword);
|
||||
diamondSword.shape("M","M","S");
|
||||
diamondSword.setIngredient('M', Material.DIAMOND_BLOCK);
|
||||
diamondSword.setIngredient('S', Material.STICK);
|
||||
|
@ -521,6 +521,21 @@ public class Gameplay extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
int repairs = ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
||||
boolean gold = UtilGear.isGold(item);
|
||||
boolean canRepair = true;
|
||||
|
||||
if (repairs >= 3 && gold)
|
||||
canRepair = false;
|
||||
else if (repairs >= 2 && !gold)
|
||||
canRepair = false;
|
||||
|
||||
if (!canRepair)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Repair", "This item cannot be repaired anymore."));
|
||||
return;
|
||||
}
|
||||
|
||||
String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner");
|
||||
|
||||
if (creator != null)
|
||||
@ -551,9 +566,7 @@ public class Gameplay extends MiniPlugin
|
||||
}
|
||||
|
||||
//Record
|
||||
int repairs = 1 + ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
||||
|
||||
ItemStackFactory.Instance.SetLoreVar(item, "Repaired", "" + repairs);
|
||||
ItemStackFactory.Instance.SetLoreVar(item, "Repaired", "" + repairs + 1);
|
||||
|
||||
//Effect
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, 1f, 1f);
|
||||
|
Loading…
Reference in New Issue
Block a user