mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-25 15:11:20 +01:00
Fixed bug with creating furnace recipes
This commit is contained in:
parent
89b32bf127
commit
ba72d2d5ef
@ -79,7 +79,7 @@ public class CraftingEdition extends EditionInventory {
|
||||
if (event.getSlot() == 21 || event.getSlot() == 22)
|
||||
new RecipeEdition(player, type, id, event.getSlot() == 22).open(getPreviousPage());
|
||||
else
|
||||
new StatEdition(this, ItemStat.CRAFTING, "item", corresponding.name().toLowerCase()).enable("Write in the chat the item you want.", "Format: '[MATERIAL]' or '[MATERIAL]:[DURABILITY]' or '[TYPE].[ID]'");
|
||||
new StatEdition(this, ItemStat.CRAFTING, "item", corresponding.name().toLowerCase()).enable("Write in the chat the item, tickspeed and exp you want.", "Format: '[ITEM] [TICKS] [EXP]'", "[ITEM] = '[MATERIAL]' or '[MATERIAL]:[DURABILITY]' or '[TYPE].[ID]'");
|
||||
}
|
||||
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
|
@ -2,7 +2,6 @@ package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -15,7 +14,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.api.util.AltChar;
|
||||
@ -76,30 +74,30 @@ public class Crafting extends ItemStat {
|
||||
}
|
||||
}
|
||||
} else if (type.equals("item")) {
|
||||
if (validate(inv.getPlayer(), message))
|
||||
Bukkit.getScheduler().runTask(MMOItems.plugin, () -> new StatEdition(inv, ItemStat.CRAFTING, "time", info[1], message).enable("Write in the chat the cooktime (in ticks) for your recipe.", "Format: '[INTEGER]'"));
|
||||
|
||||
} else if (type.equals("time")) {
|
||||
String[] args = message.split("\\ ");
|
||||
if (args.length != 3) {
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Invalid format.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!validate(inv.getPlayer(), args[0])) return false;
|
||||
int time;
|
||||
try {
|
||||
time = Integer.parseInt(message);
|
||||
time = Integer.parseInt(args[1]);
|
||||
} catch (Exception e1) {
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + message + " is not a valid number.");
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + args[1] + " is not a valid number.");
|
||||
return false;
|
||||
}
|
||||
Bukkit.getScheduler().runTask(MMOItems.plugin, () -> new StatEdition(inv, ItemStat.CRAFTING, "exp", info[1], time, info[2]).enable("Write in the chat the experience given for your recipe.", "Format: '[FLOAT]'"));
|
||||
|
||||
} else if (type.equals("exp")) {
|
||||
double exp;
|
||||
try {
|
||||
exp = Double.parseDouble(message);
|
||||
exp = Double.parseDouble(args[2]);
|
||||
} catch (Exception e1) {
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + message + " is not a valid number.");
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + args[2] + " is not a valid number.");
|
||||
return false;
|
||||
}
|
||||
|
||||
config.getConfig().set(inv.getItemId() + ".crafting." + info[1] + ".1.item", info[3]);
|
||||
config.getConfig().set(inv.getItemId() + ".crafting." + info[1] + ".1.time", (int) info[2]);
|
||||
config.getConfig().set(inv.getItemId() + ".crafting." + info[1] + ".1.item", args[0]);
|
||||
config.getConfig().set(inv.getItemId() + ".crafting." + info[1] + ".1.time", time);
|
||||
config.getConfig().set(inv.getItemId() + ".crafting." + info[1] + ".1.experience", exp);
|
||||
inv.registerItemEdition(config);
|
||||
} else
|
||||
|
@ -154,6 +154,7 @@ public abstract class ItemStat {
|
||||
public static final ItemStat ELEMENTS = new Elements();
|
||||
public static final ItemStat COMMANDS = new Commands(), STAFF_SPIRIT = new Staff_Spirit(), LUTE_ATTACK_SOUND = new Lute_Attack_Sound(), LUTE_ATTACK_EFFECT = new Lute_Attack_Effect();
|
||||
public static final ItemStat NOTE_WEIGHT = new DoubleStat(new ItemStack(VersionMaterial.MUSIC_DISC_MALL.toMaterial()), "Note Weight", new String[] { "Defines how the projectile cast", "by your lute tilts downwards." }, "note-weight", new String[] { "lute" });
|
||||
public static final ItemStat REMOVE_ON_CRAFT = new BooleanStat(new ItemStack(Material.GLASS_BOTTLE), "Remove on Craft", new String[] { "If the item should be completely", "removed when used in a recipe,", "or if it should become an", "empty bottle or bucket." }, "remove-on-craft", new String[] { "all" }, Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION, Material.MILK_BUCKET, Material.LAVA_BUCKET, Material.WATER_BUCKET);
|
||||
public static final ItemStat GEM_SOCKETS = new Gem_Sockets();
|
||||
public static final ItemStat REPAIR = new DoubleStat(new ItemStack(Material.ANVIL), "Repair", new String[] { "The amount of durability your item", "can repair when set an item." }, "repair", new String[] { "consumable" });
|
||||
public static final ItemStat REPAIR_MATERIAL = new Repair_Material();
|
||||
|
Loading…
Reference in New Issue
Block a user