mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-23 09:41:20 +01:00
!More cleanup
This commit is contained in:
parent
c29fe0bc87
commit
b35719869c
@ -31,6 +31,11 @@ public class BlockChatEdition implements Edition {
|
||||
return option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginInventory getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public void enable(String... message) {
|
||||
inv.getPlayer().closeInventory();
|
||||
|
||||
@ -44,19 +49,19 @@ public class BlockChatEdition implements Edition {
|
||||
* text if they are having conflicts with their chat management plugins.
|
||||
*/
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOLib.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
new AnvilGUI(inv, this);
|
||||
new AnvilGUI(this);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* default chat edition feature
|
||||
*/
|
||||
new ChatEdition(inv, this);
|
||||
new ChatEdition(this);
|
||||
MMOLib.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Block Edition", "See chat.", 10, 40, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean output(String input) {
|
||||
public boolean processInput(String input) {
|
||||
return input.equals("cancel") || option.whenInput(inv, input, blockId + "." + option.getConfigPath());
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,36 @@
|
||||
package net.Indyuce.mmoitems.api.edition;
|
||||
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
|
||||
public interface Edition {
|
||||
|
||||
/*
|
||||
* processes the player input; returns true if edition should be closed or
|
||||
* false if it should continue
|
||||
/**
|
||||
* Processes the player input.
|
||||
*
|
||||
* @param input
|
||||
* Current player input
|
||||
* @return If the edition process should be closed, or false if it should
|
||||
* continue listening to player input
|
||||
*/
|
||||
public boolean output(String input);
|
||||
public boolean processInput(String input);
|
||||
|
||||
/**
|
||||
* @return The inventory used to edit some data, which also contains info
|
||||
* about the player currently editing
|
||||
*/
|
||||
public PluginInventory getInventory();
|
||||
|
||||
/**
|
||||
* Called when edition is opened.
|
||||
*
|
||||
* @param message
|
||||
* Message which should be sent to the player
|
||||
*/
|
||||
public void enable(String... message);
|
||||
|
||||
/*
|
||||
* true if after successful edition, the GUI should go back to the
|
||||
* previously opened GUI or if it should just be ignored
|
||||
/**
|
||||
* @return If the previously opened GUI should be opened right after edition
|
||||
* ends or if it should be ignored
|
||||
*/
|
||||
public boolean shouldGoBack();
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.edition.process.AnvilGUI;
|
||||
import net.Indyuce.mmoitems.api.edition.process.ChatEdition;
|
||||
import net.Indyuce.mmoitems.gui.ItemBrowser;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class NewItemEdition implements Edition {
|
||||
@ -22,6 +23,11 @@ public class NewItemEdition implements Edition {
|
||||
this.inv = inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginInventory getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(String... message) {
|
||||
inv.getPlayer().closeInventory();
|
||||
@ -35,26 +41,29 @@ public class NewItemEdition implements Edition {
|
||||
* text if they are having conflicts with their chat management plugins.
|
||||
*/
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOLib.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
new AnvilGUI(inv, this);
|
||||
new AnvilGUI(this);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* default chat edition feature
|
||||
*/
|
||||
new ChatEdition(inv, this);
|
||||
new ChatEdition(this);
|
||||
MMOLib.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Creation", "See chat.", 10, 40, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean output(String input) {
|
||||
public boolean processInput(String input) {
|
||||
if (input.equals("cancel"))
|
||||
return true;
|
||||
|
||||
Bukkit.getScheduler().runTask(MMOItems.plugin, () -> Bukkit.dispatchCommand(inv.getPlayer(), "mmoitems create " + inv.getType().getId() + " " + input.toUpperCase().replace(" ", "_").replace("-", "_")));
|
||||
Bukkit.getScheduler().runTask(MMOItems.plugin, () -> Bukkit.dispatchCommand(inv.getPlayer(),
|
||||
"mmoitems create " + inv.getType().getId() + " " + input.toUpperCase().replace(" ", "_").replace("-", "_")));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldGoBack()
|
||||
{ return false; }
|
||||
|
||||
@Override
|
||||
public boolean shouldGoBack() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.edition.process.AnvilGUI;
|
||||
import net.Indyuce.mmoitems.api.edition.process.ChatEdition;
|
||||
import net.Indyuce.mmoitems.comp.parse.StringInputParser;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
@ -28,6 +29,11 @@ public class StatEdition implements Edition {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginInventory getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public ItemStat getStat() {
|
||||
return stat;
|
||||
}
|
||||
@ -36,6 +42,7 @@ public class StatEdition implements Edition {
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(String... message) {
|
||||
inv.getPlayer().closeInventory();
|
||||
|
||||
@ -49,24 +56,33 @@ public class StatEdition implements Edition {
|
||||
* text if they are having conflicts with their chat management plugins.
|
||||
*/
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOLib.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
new AnvilGUI(inv, this);
|
||||
new AnvilGUI(this);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* default chat edition feature
|
||||
*/
|
||||
new ChatEdition(inv, this);
|
||||
new ChatEdition(this);
|
||||
MMOLib.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Edition", "See chat.", 10, 40, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean output(String input) {
|
||||
public boolean processInput(String input) {
|
||||
|
||||
// apply string input parsers
|
||||
for (StringInputParser parser : MMOItems.plugin.getStringInputParsers())
|
||||
input = parser.parseInput(inv.getPlayer(), input);
|
||||
|
||||
if (input.equals("cancel"))
|
||||
return true;
|
||||
|
||||
try {
|
||||
|
||||
} catch (IllegalArgumentException exception) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return input.equals("cancel")
|
||||
|| stat.whenInput((EditionInventory) inv, ((EditionInventory) inv).getEdited().getType().getConfigFile(), input, info);
|
||||
}
|
||||
|
@ -13,16 +13,16 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.edition.Edition;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class AnvilGUI extends EditionProcess implements Listener {
|
||||
private final int containerId;
|
||||
private final Inventory inventory;
|
||||
|
||||
private boolean open;
|
||||
|
||||
public AnvilGUI(PluginInventory inv, Edition edition) {
|
||||
super(inv, edition);
|
||||
public AnvilGUI(Edition edition) {
|
||||
super(edition);
|
||||
|
||||
ItemStack paper = new ItemStack(Material.PAPER);
|
||||
ItemMeta paperMeta = paper.getItemMeta();
|
||||
@ -72,7 +72,7 @@ public class AnvilGUI extends EditionProcess implements Listener {
|
||||
if (event.getRawSlot() == 2) {
|
||||
ItemStack clicked = inventory.getItem(event.getRawSlot());
|
||||
if (clicked != null && clicked.getType() != Material.AIR)
|
||||
input(clicked.hasItemMeta() ? clicked.getItemMeta().getDisplayName() : clicked.getType().toString());
|
||||
registerInput(clicked.hasItemMeta() ? clicked.getItemMeta().getDisplayName() : clicked.getType().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,10 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.edition.Edition;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
|
||||
public class ChatEdition extends EditionProcess implements Listener {
|
||||
public ChatEdition(PluginInventory inv, Edition edition) {
|
||||
super(inv, edition);
|
||||
public ChatEdition(Edition edition) {
|
||||
super(edition);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, MMOItems.plugin);
|
||||
}
|
||||
@ -28,7 +27,7 @@ public class ChatEdition extends EditionProcess implements Listener {
|
||||
public void a(AsyncPlayerChatEvent event) {
|
||||
if (event.getPlayer().equals(getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
input(event.getMessage());
|
||||
registerInput(event.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package net.Indyuce.mmoitems.api.edition.process;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmoitems.api.edition.Edition;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
|
||||
public abstract class EditionProcess {
|
||||
|
||||
@ -11,28 +10,37 @@ public abstract class EditionProcess {
|
||||
* saves the last inventory opened. it saves the item data, and the last
|
||||
* opened page. allows for a much easier access to this data
|
||||
*/
|
||||
private final PluginInventory inv;
|
||||
private final Edition edition;
|
||||
|
||||
public EditionProcess(PluginInventory inv, Edition edition) {
|
||||
this.inv = inv;
|
||||
/**
|
||||
* Abstract class which lists all possible ways to retrieve player input
|
||||
*
|
||||
* @param inv
|
||||
* @param edition
|
||||
*/
|
||||
public EditionProcess(Edition edition) {
|
||||
this.edition = edition;
|
||||
}
|
||||
|
||||
public void input(String input) {
|
||||
if (edition.output(input)) {
|
||||
if (edition.shouldGoBack())
|
||||
inv.open();
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public PluginInventory getLastOpened() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return inv.getPlayer();
|
||||
return edition.getInventory().getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the player input, closes the edition process if needed and
|
||||
* opens the previously opened GUI if needed. This method is protected
|
||||
* because it should only be ran by edition process classes
|
||||
*
|
||||
* @param input
|
||||
* Player input
|
||||
*/
|
||||
protected void registerInput(String input) {
|
||||
if (!edition.processInput(input))
|
||||
return;
|
||||
|
||||
if (edition.shouldGoBack())
|
||||
edition.getInventory().open();
|
||||
close();
|
||||
}
|
||||
|
||||
public abstract void close();
|
||||
|
@ -1,9 +1,7 @@
|
||||
package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -31,13 +29,6 @@ public class BlockEdition extends PluginInventory {
|
||||
private final ConfigFile config = new ConfigFile("custom-blocks");
|
||||
private final CustomBlock block;
|
||||
|
||||
private static Map<Integer, ConfigOptions> correspondingSlot = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (ConfigOptions configOptions : ConfigOptions.values())
|
||||
correspondingSlot.put(configOptions.getSlot(), configOptions);
|
||||
}
|
||||
|
||||
public BlockEdition(Player player, CustomBlock block) {
|
||||
super(player);
|
||||
|
||||
@ -46,7 +37,7 @@ public class BlockEdition extends PluginInventory {
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
Inventory inv = Bukkit.createInventory(this, 54, ChatColor.UNDERLINE + "Block Edition: ");
|
||||
Inventory inv = Bukkit.createInventory(this, 54, ChatColor.UNDERLINE + "Block Edition: " + block.getId());
|
||||
for (ConfigOptions configOptions : ConfigOptions.values()) {
|
||||
ItemStack blockItem = new ItemStack(configOptions.getItem());
|
||||
ItemMeta meta = blockItem.getItemMeta();
|
||||
@ -63,15 +54,12 @@ public class BlockEdition extends PluginInventory {
|
||||
for (String lore : loreList)
|
||||
eventLore.add(ChatColor.GREEN + new ColorParse('&', lore).toChatColor());
|
||||
} else
|
||||
eventLore
|
||||
.add(ChatColor.GRAY + "Current Value: " + ChatColor.GREEN
|
||||
+ (configOptions.format.equals("int")
|
||||
? config.getConfig().contains(block.getId() + "." + configOptions.path)
|
||||
? ChatColor.GREEN + config.getConfig()
|
||||
.getString(block.getId() + "." + configOptions.path)
|
||||
: ChatColor.RED + "0"
|
||||
: new ColorParse('&', config.getConfig().getString(
|
||||
block.getId() + "." + configOptions.path, ChatColor.RED + "Default")).toChatColor()));
|
||||
eventLore.add(ChatColor.GRAY + "Current Value: " + ChatColor.GREEN + (configOptions.format.equals("int")
|
||||
? config.getConfig().contains(block.getId() + "." + configOptions.path)
|
||||
? ChatColor.GREEN + config.getConfig().getString(block.getId() + "." + configOptions.path)
|
||||
: ChatColor.RED + "0"
|
||||
: new ColorParse('&', config.getConfig().getString(block.getId() + "." + configOptions.path, ChatColor.RED + "Default"))
|
||||
.toChatColor()));
|
||||
|
||||
eventLore.add("");
|
||||
eventLore.add(ChatColor.YELLOW + AltChar.listDash + " Click to change this value.");
|
||||
@ -99,38 +87,37 @@ public class BlockEdition extends PluginInventory {
|
||||
if (event.getSlot() == 40)
|
||||
new BlockBrowser(player).open();
|
||||
|
||||
if (correspondingSlot.containsKey(event.getSlot())) {
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL) {
|
||||
ConfigOptions co = correspondingSlot.get(event.getSlot());
|
||||
new BlockChatEdition(this, co, block.getId()).enable("Write in the chat the " + co.getChatFormat());
|
||||
}
|
||||
ConfigOptions option = ConfigOptions.getBySlot(event.getSlot());
|
||||
if (option == null)
|
||||
return;
|
||||
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
String path = correspondingSlot.get(event.getSlot()).getConfigPath();
|
||||
config.getConfig().set(block.getId() + "." + path, null);
|
||||
config.save();
|
||||
MMOItems.plugin.getCustomBlocks().reload();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new BlockChatEdition(this, option, block.getId()).enable("Write in the chat the " + option.getChatFormat());
|
||||
|
||||
new BlockEdition(player, block).open();
|
||||
player.sendMessage(
|
||||
MMOItems.plugin.getPrefix() + ChatColor.RED + MMOUtils.caseOnWords(path.replace("-", " "))
|
||||
+ " Value" + ChatColor.GRAY + " successfully removed.");
|
||||
}
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
config.getConfig().set(block.getId() + "." + option.getConfigPath(), null);
|
||||
config.save();
|
||||
MMOItems.plugin.getCustomBlocks().reload();
|
||||
|
||||
new BlockEdition(player, block).open();
|
||||
player.sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + MMOUtils.caseOnWords(option.getConfigPath().replace("-", " ")) + " Value"
|
||||
+ ChatColor.GRAY + " successfully removed.");
|
||||
}
|
||||
}
|
||||
|
||||
public enum ConfigOptions {
|
||||
DISPLAY_NAME("display-name", Material.WRITABLE_BOOK, 11, "string"), LORE("lore", Material.MAP, 13, "line"),
|
||||
DISPLAY_NAME("display-name", Material.WRITABLE_BOOK, 11, "string"),
|
||||
LORE("lore", Material.MAP, 13, "line"),
|
||||
REQUIRED_PICKAXE_POWER("required-power", Material.IRON_PICKAXE, 15, "int"),
|
||||
MIN_XP("min-xp", Material.EXPERIENCE_BOTTLE, 21, "int"),
|
||||
MAX_XP("max-xp", Material.EXPERIENCE_BOTTLE, 23, "int"),
|
||||
WORLD_GEN_TEMPLATE("gen-template", Material.GRASS_BLOCK, 31, "string"),;
|
||||
WORLD_GEN_TEMPLATE("gen-template", Material.GRASS_BLOCK, 31, "string");
|
||||
|
||||
private final String path, format;
|
||||
private final Material item;
|
||||
private final int slot;
|
||||
|
||||
ConfigOptions(String path, Material item, int slot, String format) {
|
||||
private ConfigOptions(String path, Material item, int slot, String format) {
|
||||
this.path = path;
|
||||
this.item = item;
|
||||
this.slot = slot;
|
||||
@ -141,10 +128,6 @@ public class BlockEdition extends PluginInventory {
|
||||
return path;
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public Material getItem() {
|
||||
return item;
|
||||
}
|
||||
@ -153,46 +136,52 @@ public class BlockEdition extends PluginInventory {
|
||||
return slot;
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public String getChatFormat() {
|
||||
switch (format) {
|
||||
case "int":
|
||||
return "desired number for this field.";
|
||||
case "line":
|
||||
return "new line to add.";
|
||||
default:
|
||||
return "new value.";
|
||||
case "int":
|
||||
return "desired number for this field.";
|
||||
case "line":
|
||||
return "new line to add.";
|
||||
default:
|
||||
return "new value.";
|
||||
}
|
||||
}
|
||||
|
||||
public static ConfigOptions getBySlot(int slot) {
|
||||
for (ConfigOptions option : values())
|
||||
if (option.getSlot() == slot)
|
||||
return option;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean whenInput(PluginInventory inv, String message, String path) {
|
||||
switch (format) {
|
||||
case "int":
|
||||
int value = 0;
|
||||
try {
|
||||
value = Integer.parseInt(message);
|
||||
} catch (Exception e1) {
|
||||
inv.getPlayer().sendMessage(
|
||||
MMOItems.plugin.getPrefix() + ChatColor.RED + message + " is not a valid number.");
|
||||
return false;
|
||||
}
|
||||
setConfigValue(new ConfigFile("custom-blocks"), path, value);
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + name().replace("_", " ")
|
||||
+ " successfully changed to " + value + ".");
|
||||
break;
|
||||
case "line":
|
||||
ConfigFile config = new ConfigFile("custom-blocks");
|
||||
List<String> lore = config.getConfig().contains(path) ? config.getConfig().getStringList(path)
|
||||
: new ArrayList<>();
|
||||
lore.add(message);
|
||||
setConfigValue(config, path, lore);
|
||||
inv.getPlayer().sendMessage(
|
||||
MMOItems.plugin.getPrefix() + "Successfully added to " + message + " to block lore.");
|
||||
break;
|
||||
default:
|
||||
setConfigValue(new ConfigFile("custom-blocks"), path, message);
|
||||
inv.getPlayer().sendMessage(
|
||||
MMOItems.plugin.getPrefix() + "Successfully changed value to " + message + ".");
|
||||
break;
|
||||
case "int":
|
||||
int value = 0;
|
||||
try {
|
||||
value = Integer.parseInt(message);
|
||||
} catch (Exception e1) {
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + message + " is not a valid number.");
|
||||
return false;
|
||||
}
|
||||
setConfigValue(new ConfigFile("custom-blocks"), path, value);
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + name().replace("_", " ") + " successfully changed to " + value + ".");
|
||||
break;
|
||||
case "line":
|
||||
ConfigFile config = new ConfigFile("custom-blocks");
|
||||
List<String> lore = config.getConfig().contains(path) ? config.getConfig().getStringList(path) : new ArrayList<>();
|
||||
lore.add(message);
|
||||
setConfigValue(config, path, lore);
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully added to " + message + " to block lore.");
|
||||
break;
|
||||
default:
|
||||
setConfigValue(new ConfigFile("custom-blocks"), path, message);
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully changed value to " + message + ".");
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.stat.type.InternalStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
@ -49,7 +50,7 @@ public class ItemEdition extends EditionInventory {
|
||||
* the for loop will just let some slots empty
|
||||
*/
|
||||
List<ItemStat> appliable = new ArrayList<>(getEdited().getType().getAvailableStats()).stream()
|
||||
.filter(stat -> stat.hasValidMaterial(getCachedItem()) && !stat.isInternal()).collect(Collectors.toList());
|
||||
.filter(stat -> stat.hasValidMaterial(getCachedItem()) && !(stat instanceof InternalStat)).collect(Collectors.toList());
|
||||
|
||||
Inventory inv = Bukkit.createInventory(this, 54, ChatColor.UNDERLINE + "Item Edition: " + getEdited().getId());
|
||||
for (int j = min; j < Math.min(appliable.size(), max); j++) {
|
||||
|
@ -97,9 +97,8 @@ public class Abilities extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new AbilityListEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,9 +86,8 @@ public class ArrowParticles extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new ArrowParticlesEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,9 +60,8 @@ public class Commands extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new CommandListEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,7 @@ public class CompatibleTypes extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.COMPATIBLE_TYPES).enable("Write in the chat the name of the type you want to add.");
|
||||
@ -56,18 +56,17 @@ public class CompatibleTypes extends ItemStat {
|
||||
if (config.getConfig().getConfigurationSection(inv.getEdited().getId()).contains("compatible-types")) {
|
||||
List<String> lore = config.getConfig().getStringList(inv.getEdited().getId() + ".compatible-types");
|
||||
if (lore.size() < 1)
|
||||
return true;
|
||||
return;
|
||||
|
||||
String last = lore.get(lore.size() - 1);
|
||||
lore.remove(last);
|
||||
config.getConfig().set(inv.getEdited().getId() + ".compatible-types", lore);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor()
|
||||
+ ChatColor.GRAY + "'.");
|
||||
inv.getPlayer().sendMessage(
|
||||
MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor() + ChatColor.GRAY + "'.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,7 @@ public class Crafting extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new CraftingEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
else if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
@ -45,7 +45,6 @@ public class Crafting extends ItemStat {
|
||||
+ ChatColor.RED + "/mi reload recipes" + ChatColor.GRAY + ".");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +62,7 @@ public class CustomSounds extends ItemStat implements ProperStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new SoundsEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
@ -74,7 +74,6 @@ public class CustomSounds extends ItemStat implements ProperStat {
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Custom Sounds successfully removed.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,7 @@ public class DyeColor extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.DYE_COLOR).enable("Write in the chat the RGB color you want.",
|
||||
@ -54,7 +54,6 @@ public class DyeColor extends ItemStat {
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed Dye Color.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,7 +73,7 @@ public class Effects extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.EFFECTS).enable("Write in the chat the permanent potion effect you want to add.",
|
||||
@ -92,7 +92,6 @@ public class Effects extends ItemStat {
|
||||
+ last.substring(1).toLowerCase() + ChatColor.GRAY + ".");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class Elements extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new ElementsEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
@ -68,7 +68,6 @@ public class Elements extends ItemStat {
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Elements successfully removed.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +58,7 @@ public class Enchants extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.ENCHANTS).enable("Write in the chat the enchant you want to add.",
|
||||
@ -77,7 +77,6 @@ public class Enchants extends ItemStat {
|
||||
+ last.substring(1).toLowerCase().replace("_", " ") + ".");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getName(Enchantment enchant) {
|
||||
|
@ -86,7 +86,7 @@ public class GemSockets extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.GEM_SOCKETS).enable("Write in the chat the COLOR of the gem socket you want to add.");
|
||||
@ -95,18 +95,17 @@ public class GemSockets extends ItemStat {
|
||||
if (config.getConfig().getConfigurationSection(inv.getEdited().getId()).contains(getPath())) {
|
||||
List<String> lore = config.getConfig().getStringList(inv.getEdited().getId() + "." + getPath());
|
||||
if (lore.size() < 1)
|
||||
return true;
|
||||
return;
|
||||
|
||||
String last = lore.get(lore.size() - 1);
|
||||
lore.remove(last);
|
||||
config.getConfig().set(inv.getEdited().getId() + "." + getPath(), lore);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor()
|
||||
+ ChatColor.GRAY + "'.");
|
||||
inv.getPlayer().sendMessage(
|
||||
MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor() + ChatColor.GRAY + "'.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,9 +36,8 @@ public class ItemParticles extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new ParticlesEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,7 @@ public class ItemTypeRestriction extends StringStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
@ -63,7 +63,7 @@ public class ItemTypeRestriction extends StringStat {
|
||||
if (config.getConfig().getConfigurationSection(inv.getEdited().getId()).contains(getPath())) {
|
||||
List<String> list = config.getConfig().getStringList(inv.getEdited().getId() + "." + getPath());
|
||||
if (list.size() < 1)
|
||||
return true;
|
||||
return;
|
||||
|
||||
String last = list.get(list.size() - 1);
|
||||
list.remove(last);
|
||||
@ -72,7 +72,6 @@ public class ItemTypeRestriction extends StringStat {
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed " + last + ".");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,7 @@ public class Lore extends ItemStat implements ProperStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.LORE).enable("Write in the chat the lore line you want to add.");
|
||||
@ -56,18 +56,17 @@ public class Lore extends ItemStat implements ProperStat {
|
||||
if (config.getConfig().getConfigurationSection(inv.getEdited().getId()).contains("lore")) {
|
||||
List<String> lore = config.getConfig().getStringList(inv.getEdited().getId() + ".lore");
|
||||
if (lore.size() < 1)
|
||||
return true;
|
||||
return;
|
||||
|
||||
String last = lore.get(lore.size() - 1);
|
||||
lore.remove(last);
|
||||
config.getConfig().set(inv.getEdited().getId() + ".lore", lore);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor()
|
||||
+ ChatColor.GRAY + "'.");
|
||||
inv.getPlayer().sendMessage(
|
||||
MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor() + ChatColor.GRAY + "'.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,18 +30,17 @@ public class LuteAttackEffectStat extends StringStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
config.getConfig().set(inv.getEdited().getId() + ".lute-attack-effect", null);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed the lute attack effect.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
new StatEdition(inv, this).enable("Write in the chat the text you want.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,9 +41,8 @@ public class MaterialStat extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new StatEdition(inv, ItemStat.MATERIAL).enable("Write in the chat the material you want.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +46,7 @@ public class NBTTags extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.NBT_TAGS).enable("Write in the chat the NBT tag you want to add.",
|
||||
@ -56,18 +56,17 @@ public class NBTTags extends ItemStat {
|
||||
if (config.getConfig().getConfigurationSection(inv.getEdited().getId()).contains("custom-nbt")) {
|
||||
List<String> nbtTags = config.getConfig().getStringList(inv.getEdited().getId() + ".custom-nbt");
|
||||
if (nbtTags.size() < 1)
|
||||
return true;
|
||||
return;
|
||||
|
||||
String last = nbtTags.get(nbtTags.size() - 1);
|
||||
nbtTags.remove(last);
|
||||
config.getConfig().set(inv.getEdited().getId() + ".custom-nbt", nbtTags);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor()
|
||||
+ ChatColor.GRAY + "'.");
|
||||
inv.getPlayer().sendMessage(
|
||||
MMOItems.plugin.getPrefix() + "Successfully removed '" + new ColorParse('&', last).toChatColor() + ChatColor.GRAY + "'.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -121,19 +120,22 @@ public class NBTTags extends ItemStat {
|
||||
mmoitem.setData(ItemStat.NBT_TAGS,
|
||||
new StringListData(new JsonParser().parse(mmoitem.getNBT().getString("MMOITEMS_NBTTAGS")).getAsJsonArray()));
|
||||
}
|
||||
|
||||
|
||||
public Object calculateObjectType(String input) {
|
||||
if(input.equalsIgnoreCase("true")) return (Boolean) true;
|
||||
if(input.equalsIgnoreCase("false")) return (Boolean) false;
|
||||
if (input.equalsIgnoreCase("true"))
|
||||
return (Boolean) true;
|
||||
if (input.equalsIgnoreCase("false"))
|
||||
return (Boolean) false;
|
||||
try {
|
||||
int value = Integer.parseInt(input);
|
||||
return (Integer) value;
|
||||
} catch(NumberFormatException e) {}
|
||||
if(input.contains("[") && input.contains("]")) {
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
if (input.contains("[") && input.contains("]")) {
|
||||
List<String> entries = new ArrayList<>();
|
||||
for(String s : input.replace("[", "").replace("]", "").split("\\,"))
|
||||
for (String s : input.replace("[", "").replace("]", "").split("\\,"))
|
||||
entries.add(s.replace("\"", ""));
|
||||
return (List<?>) entries;
|
||||
return (List<?>) entries;
|
||||
}
|
||||
return (String) input;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class PermanentEffects extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.PERM_EFFECTS).enable("Write in the chat the permanent potion effect you want to add.",
|
||||
@ -93,7 +93,6 @@ public class PermanentEffects extends ItemStat {
|
||||
+ last.substring(1).toLowerCase() + "<EFBFBD>7.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class Permission extends ItemStat implements ItemRestriction, ProperStat
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.PERMISSION).enable("Write in the chat the permission you want your item to require.");
|
||||
@ -59,7 +59,8 @@ public class Permission extends ItemStat implements ItemRestriction, ProperStat
|
||||
if (config.getConfig().getConfigurationSection(inv.getEdited().getId()).contains("permission")) {
|
||||
List<String> requiredPerms = config.getConfig().getStringList(inv.getEdited().getId() + ".permission");
|
||||
if (requiredPerms.size() < 1)
|
||||
return true;
|
||||
return;
|
||||
|
||||
String last = requiredPerms.get(requiredPerms.size() - 1);
|
||||
requiredPerms.remove(last);
|
||||
config.getConfig().set(inv.getEdited().getId() + ".permission", requiredPerms.size() == 0 ? null : requiredPerms);
|
||||
@ -68,7 +69,6 @@ public class Permission extends ItemStat implements ItemRestriction, ProperStat
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed " + last + ".");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,7 @@ public class PotionColor extends StringStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.POTION_COLOR).enable("Write in the chat the RGB color you want.",
|
||||
@ -42,7 +42,6 @@ public class PotionColor extends StringStat {
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed Potion Color.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,7 +69,7 @@ public class PotionEffects extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.POTION_EFFECTS).enable("Write in the chat the potion effect you want to add.",
|
||||
@ -88,7 +88,6 @@ public class PotionEffects extends ItemStat {
|
||||
+ last.substring(1).toLowerCase() + ChatColor.GRAY + ".");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,6 @@ import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.StringStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
|
||||
@ -20,12 +19,13 @@ public class RepairMaterial extends StringStat {
|
||||
super("REPAIR_MATERIAL", new ItemStack(Material.ANVIL), "Repair Material",
|
||||
new String[] { "The material to be used when", "repairing this item in an anvil.", "", "Currently serves no purpose!" },
|
||||
new String[] { "all" });
|
||||
|
||||
disable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new StatEdition(inv, ItemStat.MATERIAL).enable("Write in the chat the material you want.");
|
||||
return true;
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new StatEdition(inv, this).enable("Write in the chat the material you want.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,16 +50,16 @@ public class RequiredClass extends ItemStat implements ItemRestriction, ProperSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.REQUIRED_CLASS).enable("Write in the chat the class you want your item to support.");
|
||||
new StatEdition(inv, this).enable("Write in the chat the class you want your item to support.");
|
||||
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
if (config.getConfig().getConfigurationSection(inv.getEdited().getId()).getKeys(false).contains("required-class")) {
|
||||
List<String> supportedClasses = config.getConfig().getStringList(inv.getEdited().getId() + ".required-class");
|
||||
if (supportedClasses.size() < 1)
|
||||
return true;
|
||||
return;
|
||||
|
||||
String last = supportedClasses.get(supportedClasses.size() - 1);
|
||||
supportedClasses.remove(last);
|
||||
@ -69,7 +69,6 @@ public class RequiredClass extends ItemStat implements ItemRestriction, ProperSt
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed " + last + ".");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,10 +44,9 @@ public class Restore extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
new StatEdition(inv, ItemStat.RESTORE).enable("Write in the chat the values you want.",
|
||||
ChatColor.AQUA + "Format: [HEALTH] [FOOD] [SATURATION]");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,7 +74,7 @@ public class ShieldPatternStat extends StringStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStat.SHIELD_PATTERN, 0).enable("Write in the chat the color of your shield.");
|
||||
@ -92,19 +92,18 @@ public class ShieldPatternStat extends StringStat {
|
||||
|
||||
if (event.getAction() == InventoryAction.DROP_ONE_SLOT) {
|
||||
if (!config.getConfig().getConfigurationSection(inv.getEdited().getId()).contains("shield-pattern"))
|
||||
return false;
|
||||
return;
|
||||
|
||||
Set<String> set = config.getConfig().getConfigurationSection(inv.getEdited().getId() + ".shield-pattern").getKeys(false);
|
||||
String last = new ArrayList<String>(set).get(set.size() - 1);
|
||||
if (last.equalsIgnoreCase("color"))
|
||||
return false;
|
||||
return;
|
||||
|
||||
config.getConfig().set(inv.getEdited().getId() + ".shield-pattern." + last, null);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed the last pattern.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ public class UpgradeStat extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new UpgradingEdition(inv.getPlayer(), inv.getEdited()).open(inv.getPage());
|
||||
|
||||
@ -64,7 +64,6 @@ public class UpgradeStat extends ItemStat {
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully reset the upgrading setup.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,12 +40,11 @@ public class BooleanStat extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
config.getConfig().set(inv.getEdited().getId() + "." + getPath(), !config.getConfig().getBoolean(inv.getEdited().getId() + "." + getPath()));
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,18 +60,17 @@ public class DoubleStat extends ItemStat implements Upgradable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
config.getConfig().set(inv.getEdited().getId() + "." + getPath(), null);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed " + getName() + ChatColor.GRAY + ".");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
new StatEdition(inv, this).enable("Write in the chat the numeric value you want.",
|
||||
"Or write [MIN-VALUE]=[MAX-VALUE] to make the stat random.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,9 +36,8 @@ public abstract class InternalStat extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
// not supported
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,7 +3,6 @@ package net.Indyuce.mmoitems.stat.type;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -15,236 +14,245 @@ import net.Indyuce.mmoitems.api.item.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.api.itemgen.RandomStatData;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.Abilities;
|
||||
import net.Indyuce.mmoitems.stat.Armor;
|
||||
import net.Indyuce.mmoitems.stat.ArmorToughness;
|
||||
import net.Indyuce.mmoitems.stat.ArrowParticles;
|
||||
import net.Indyuce.mmoitems.stat.AttackDamage;
|
||||
import net.Indyuce.mmoitems.stat.AttackSpeed;
|
||||
import net.Indyuce.mmoitems.stat.Commands;
|
||||
import net.Indyuce.mmoitems.stat.CompatibleTypes;
|
||||
import net.Indyuce.mmoitems.stat.Crafting;
|
||||
import net.Indyuce.mmoitems.stat.CraftingPermission;
|
||||
import net.Indyuce.mmoitems.stat.CustomModelData;
|
||||
import net.Indyuce.mmoitems.stat.CustomSounds;
|
||||
import net.Indyuce.mmoitems.stat.DefaultDurability;
|
||||
import net.Indyuce.mmoitems.stat.DisableAdvancedEnchantments;
|
||||
import net.Indyuce.mmoitems.stat.DisplayName;
|
||||
import net.Indyuce.mmoitems.stat.DyeColor;
|
||||
import net.Indyuce.mmoitems.stat.Effects;
|
||||
import net.Indyuce.mmoitems.stat.Elements;
|
||||
import net.Indyuce.mmoitems.stat.Enchants;
|
||||
import net.Indyuce.mmoitems.stat.GemColor;
|
||||
import net.Indyuce.mmoitems.stat.GemSockets;
|
||||
import net.Indyuce.mmoitems.stat.HideEnchants;
|
||||
import net.Indyuce.mmoitems.stat.HidePotionEffects;
|
||||
import net.Indyuce.mmoitems.stat.Inedible;
|
||||
import net.Indyuce.mmoitems.stat.ItemParticles;
|
||||
import net.Indyuce.mmoitems.stat.ItemSetStat;
|
||||
import net.Indyuce.mmoitems.stat.ItemTierStat;
|
||||
import net.Indyuce.mmoitems.stat.ItemTypeRestriction;
|
||||
import net.Indyuce.mmoitems.stat.KnockbackResistance;
|
||||
import net.Indyuce.mmoitems.stat.LegacyDurability;
|
||||
import net.Indyuce.mmoitems.stat.Lore;
|
||||
import net.Indyuce.mmoitems.stat.LostWhenBroken;
|
||||
import net.Indyuce.mmoitems.stat.LuteAttackEffectStat;
|
||||
import net.Indyuce.mmoitems.stat.LuteAttackSoundStat;
|
||||
import net.Indyuce.mmoitems.stat.MaterialStat;
|
||||
import net.Indyuce.mmoitems.stat.MaxHealth;
|
||||
import net.Indyuce.mmoitems.stat.MaximumDurability;
|
||||
import net.Indyuce.mmoitems.stat.MovementSpeed;
|
||||
import net.Indyuce.mmoitems.stat.NBTTags;
|
||||
import net.Indyuce.mmoitems.stat.PermanentEffects;
|
||||
import net.Indyuce.mmoitems.stat.Permission;
|
||||
import net.Indyuce.mmoitems.stat.PickaxePower;
|
||||
import net.Indyuce.mmoitems.stat.PotionColor;
|
||||
import net.Indyuce.mmoitems.stat.PotionEffects;
|
||||
import net.Indyuce.mmoitems.stat.RequiredClass;
|
||||
import net.Indyuce.mmoitems.stat.RequiredLevel;
|
||||
import net.Indyuce.mmoitems.stat.Restore;
|
||||
import net.Indyuce.mmoitems.stat.ShieldPatternStat;
|
||||
import net.Indyuce.mmoitems.stat.SkullTextureStat;
|
||||
import net.Indyuce.mmoitems.stat.Soulbound;
|
||||
import net.Indyuce.mmoitems.stat.SoulboundLevel;
|
||||
import net.Indyuce.mmoitems.stat.StaffSpiritStat;
|
||||
import net.Indyuce.mmoitems.stat.StoredTags;
|
||||
import net.Indyuce.mmoitems.stat.SuccessRate;
|
||||
import net.Indyuce.mmoitems.stat.Unbreakable;
|
||||
import net.Indyuce.mmoitems.stat.Unstackable;
|
||||
import net.Indyuce.mmoitems.stat.UpgradeStat;
|
||||
import net.Indyuce.mmoitems.stat.VanillaEatingAnimation;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public abstract class ItemStat {
|
||||
public static final ItemStat MATERIAL = new MaterialStat(),
|
||||
DURABILITY = MMOLib.plugin.getVersion().isBelowOrEqual(1, 12) ? new LegacyDurability()
|
||||
: new DefaultDurability(),
|
||||
CUSTOM_MODEL_DATA = new CustomModelData(), MAX_DURABILITY = new MaximumDurability(),
|
||||
WILL_BREAK = new LostWhenBroken();
|
||||
DURABILITY = MMOLib.plugin.getVersion().isBelowOrEqual(1, 12) ? new LegacyDurability() : new DefaultDurability(),
|
||||
CUSTOM_MODEL_DATA = new CustomModelData(), MAX_DURABILITY = new MaximumDurability(), WILL_BREAK = new LostWhenBroken();
|
||||
public static final ItemStat NAME = new DisplayName(), LORE = new Lore(), NBT_TAGS = new NBTTags();
|
||||
|
||||
public static final ItemStat DISPLAYED_TYPE = new StringStat("DISPLAYED_TYPE", VersionMaterial.OAK_SIGN.toItem(),
|
||||
"Displayed Type", new String[] { "This option will only affect the", "type displayed on the item lore." },
|
||||
new String[] { "all" });
|
||||
public static final ItemStat ENCHANTS = new Enchants(), HIDE_ENCHANTS = new HideEnchants(),
|
||||
PERMISSION = new Permission(), ITEM_PARTICLES = new ItemParticles(), ARROW_PARTICLES = new ArrowParticles();
|
||||
public static final ItemStat DISABLE_INTERACTION = new DisableStat("INTERACTION",
|
||||
VersionMaterial.GRASS_BLOCK.toMaterial(), "Disable Interaction", "Disable any unwanted interaction:",
|
||||
"block placement, item use...");
|
||||
public static final ItemStat DISABLE_CRAFTING = new DisableStat("CRAFTING",
|
||||
VersionMaterial.CRAFTING_TABLE.toMaterial(), "Disable Crafting",
|
||||
public static final ItemStat DISPLAYED_TYPE = new StringStat("DISPLAYED_TYPE", VersionMaterial.OAK_SIGN.toItem(), "Displayed Type",
|
||||
new String[] { "This option will only affect the", "type displayed on the item lore." }, new String[] { "all" });
|
||||
public static final ItemStat ENCHANTS = new Enchants(), HIDE_ENCHANTS = new HideEnchants(), PERMISSION = new Permission(),
|
||||
ITEM_PARTICLES = new ItemParticles(), ARROW_PARTICLES = new ArrowParticles();
|
||||
public static final ItemStat DISABLE_INTERACTION = new DisableStat("INTERACTION", VersionMaterial.GRASS_BLOCK.toMaterial(), "Disable Interaction",
|
||||
"Disable any unwanted interaction:", "block placement, item use...");
|
||||
public static final ItemStat DISABLE_CRAFTING = new DisableStat("CRAFTING", VersionMaterial.CRAFTING_TABLE.toMaterial(), "Disable Crafting",
|
||||
"Players can't use this item while crafting.");
|
||||
public static final ItemStat DISABLE_SMELTING = new DisableStat("SMELTING", Material.FURNACE, "Disable Smelting",
|
||||
"Players can't use this item in furnaces.");
|
||||
public static final ItemStat DISABLE_SMITHING = new DisableStat("SMITHING", Material.DAMAGED_ANVIL,
|
||||
"Disable Smithing", "Players can't smith this item in smithing tables.");
|
||||
public static final ItemStat DISABLE_ENCHANTING = new DisableStat("ENCHANTING",
|
||||
VersionMaterial.ENCHANTING_TABLE.toMaterial(), "Disable Enchanting", "Players can't enchant this item."),
|
||||
DISABLE_ADVANCED_ENCHANTS = new DisableAdvancedEnchantments();
|
||||
public static final ItemStat DISABLE_SMITHING = new DisableStat("SMITHING", Material.DAMAGED_ANVIL, "Disable Smithing",
|
||||
"Players can't smith this item in smithing tables.");
|
||||
public static final ItemStat DISABLE_ENCHANTING = new DisableStat("ENCHANTING", VersionMaterial.ENCHANTING_TABLE.toMaterial(),
|
||||
"Disable Enchanting", "Players can't enchant this item."), DISABLE_ADVANCED_ENCHANTS = new DisableAdvancedEnchantments();
|
||||
public static final ItemStat DISABLE_REPAIRING = new DisableStat("REPAIRING", Material.ANVIL, "Disable Repairing",
|
||||
"Players can't use this item in anvils.");
|
||||
public static final ItemStat DISABLE_ARROW_SHOOTING = new DisableStat("ARROW_SHOOTING", Material.ARROW,
|
||||
"Disable Arrow Shooting", new Material[] { Material.ARROW }, "Players can't shoot this",
|
||||
"item using a bow.");
|
||||
public static final ItemStat DISABLE_ATTACK_PASSIVE = new DisableStat("ATTACK_PASSIVE", Material.BARRIER,
|
||||
"Disable Attack Passive", new String[] { "piercing", "slashing", "blunt" },
|
||||
"Disables the blunt/slashing/piercing", "passive effects on attacks.");
|
||||
public static final ItemStat DISABLE_RIGHT_CLICK_CONSUME = new DisableStat("RIGHT_CLICK_CONSUME", Material.BARRIER,
|
||||
"Disable Right Click Consume", new String[] { "consumable" }, "This item will not be consumed",
|
||||
"when eaten by players.");
|
||||
public static final ItemStat DISABLE_ARROW_SHOOTING = new DisableStat("ARROW_SHOOTING", Material.ARROW, "Disable Arrow Shooting",
|
||||
new Material[] { Material.ARROW }, "Players can't shoot this", "item using a bow.");
|
||||
public static final ItemStat DISABLE_ATTACK_PASSIVE = new DisableStat("ATTACK_PASSIVE", Material.BARRIER, "Disable Attack Passive",
|
||||
new String[] { "piercing", "slashing", "blunt" }, "Disables the blunt/slashing/piercing", "passive effects on attacks.");
|
||||
public static final ItemStat DISABLE_RIGHT_CLICK_CONSUME = new DisableStat("RIGHT_CLICK_CONSUME", Material.BARRIER, "Disable Right Click Consume",
|
||||
new String[] { "consumable" }, "This item will not be consumed", "when eaten by players.");
|
||||
|
||||
public static final ItemStat REQUIRED_LEVEL = new RequiredLevel(), REQUIRED_CLASS = new RequiredClass(),
|
||||
ATTACK_DAMAGE = new AttackDamage(), ATTACK_SPEED = new AttackSpeed();
|
||||
public static final ItemStat CRITICAL_STRIKE_CHANCE = new DoubleStat("CRITICAL_STRIKE_CHANCE",
|
||||
new ItemStack(Material.NETHER_STAR), "Critical Strike Chance",
|
||||
new String[] { "Critical Strikes deal more damage.", "In % chance." },
|
||||
public static final ItemStat REQUIRED_LEVEL = new RequiredLevel(), REQUIRED_CLASS = new RequiredClass(), ATTACK_DAMAGE = new AttackDamage(),
|
||||
ATTACK_SPEED = new AttackSpeed();
|
||||
public static final ItemStat CRITICAL_STRIKE_CHANCE = new DoubleStat("CRITICAL_STRIKE_CHANCE", new ItemStack(Material.NETHER_STAR),
|
||||
"Critical Strike Chance", new String[] { "Critical Strikes deal more damage.", "In % chance." },
|
||||
new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat CRITICAL_STRIKE_POWER = new DoubleStat("CRITICAL_STRIKE_POWER",
|
||||
new ItemStack(Material.NETHER_STAR), "Critical Strike Power",
|
||||
new String[] { "The extra damage weapon crits deals.", "(Stacks with default value)", "In %." },
|
||||
public static final ItemStat CRITICAL_STRIKE_POWER = new DoubleStat("CRITICAL_STRIKE_POWER", new ItemStack(Material.NETHER_STAR),
|
||||
"Critical Strike Power", new String[] { "The extra damage weapon crits deals.", "(Stacks with default value)", "In %." },
|
||||
new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat BLOCK_POWER = new DoubleStat("BLOCK_POWER", new ItemStack(Material.IRON_HELMET),
|
||||
"Block Power", new String[] { "The % of the damage your", "armor/shield can block.", "Default: 25%" },
|
||||
new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat BLOCK_RATING = new DoubleStat("BLOCK_RATING", new ItemStack(Material.IRON_HELMET),
|
||||
"Block Rating", new String[] { "The chance your piece of armor", "has to block any entity attack." },
|
||||
new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat BLOCK_COOLDOWN_REDUCTION = new DoubleStat("BLOCK_COOLDOWN_REDUCTION",
|
||||
new ItemStack(Material.IRON_HELMET), "Block Cooldown Reduction",
|
||||
new String[] { "Reduces the blocking cooldown (%)." }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat DODGE_RATING = new DoubleStat("DODGE_RATING", new ItemStack(Material.FEATHER),
|
||||
"Dodge Rating",
|
||||
public static final ItemStat BLOCK_POWER = new DoubleStat("BLOCK_POWER", new ItemStack(Material.IRON_HELMET), "Block Power",
|
||||
new String[] { "The % of the damage your", "armor/shield can block.", "Default: 25%" }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat BLOCK_RATING = new DoubleStat("BLOCK_RATING", new ItemStack(Material.IRON_HELMET), "Block Rating",
|
||||
new String[] { "The chance your piece of armor", "has to block any entity attack." }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat BLOCK_COOLDOWN_REDUCTION = new DoubleStat("BLOCK_COOLDOWN_REDUCTION", new ItemStack(Material.IRON_HELMET),
|
||||
"Block Cooldown Reduction", new String[] { "Reduces the blocking cooldown (%)." }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat DODGE_RATING = new DoubleStat("DODGE_RATING", new ItemStack(Material.FEATHER), "Dodge Rating",
|
||||
new String[] { "The chance to dodge an attack.", "Dodging completely negates", "the attack damage." },
|
||||
new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat DODGE_COOLDOWN_REDUCTION = new DoubleStat("DODGE_COOLDOWN_REDUCTION",
|
||||
new ItemStack(Material.FEATHER), "Dodge Cooldown Reduction",
|
||||
new String[] { "Reduces the dodging cooldown (%)." }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat PARRY_RATING = new DoubleStat(
|
||||
"PARRY_RATING", new ItemStack(Material.BUCKET), "Parry Rating", new String[] {
|
||||
"The chance to parry an attack.", "Parrying negates the damage", "and knocks the attacker back." },
|
||||
public static final ItemStat DODGE_COOLDOWN_REDUCTION = new DoubleStat("DODGE_COOLDOWN_REDUCTION", new ItemStack(Material.FEATHER),
|
||||
"Dodge Cooldown Reduction", new String[] { "Reduces the dodging cooldown (%)." }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat PARRY_RATING = new DoubleStat("PARRY_RATING", new ItemStack(Material.BUCKET), "Parry Rating",
|
||||
new String[] { "The chance to parry an attack.", "Parrying negates the damage", "and knocks the attacker back." },
|
||||
new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat PARRY_COOLDOWN_REDUCTION = new DoubleStat("PARRY_COOLDOWN_REDUCTION",
|
||||
new ItemStack(Material.BUCKET), "Parry Cooldown Reduction",
|
||||
new String[] { "Reduces the parrying cooldown (%)." }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat COOLDOWN_REDUCTION = new DoubleStat("COOLDOWN_REDUCTION", new ItemStack(Material.BOOK),
|
||||
"Cooldown Reduction", new String[] { "Reduces cooldowns of item skills (%)." });
|
||||
public static final ItemStat PARRY_COOLDOWN_REDUCTION = new DoubleStat("PARRY_COOLDOWN_REDUCTION", new ItemStack(Material.BUCKET),
|
||||
"Parry Cooldown Reduction", new String[] { "Reduces the parrying cooldown (%)." }, new String[] { "!miscellaneous", "all" });
|
||||
public static final ItemStat COOLDOWN_REDUCTION = new DoubleStat("COOLDOWN_REDUCTION", new ItemStack(Material.BOOK), "Cooldown Reduction",
|
||||
new String[] { "Reduces cooldowns of item skills (%)." });
|
||||
public static final ItemStat RANGE = new DoubleStat("RANGE", new ItemStack(Material.STICK), "Range",
|
||||
new String[] { "The range of your item attacks." }, new String[] { "staff", "whip", "wand", "musket" });
|
||||
public static final ItemStat MANA_COST = new DoubleStat("MANA_COST", VersionMaterial.LAPIS_LAZULI.toItem(),
|
||||
"Mana Cost", new String[] { "Mana spent by your weapon to be used." },
|
||||
new String[] { "piercing", "slashing", "blunt", "range" });
|
||||
public static final ItemStat STAMINA_COST = new DoubleStat("STAMINA_COST", VersionMaterial.LIGHT_GRAY_DYE.toItem(),
|
||||
"Stamina Cost", new String[] { "Stamina spent by your weapon to be used." },
|
||||
new String[] { "piercing", "slashing", "blunt", "range" });
|
||||
public static final ItemStat ARROW_VELOCITY = new DoubleStat("ARROW_VELOCITY", new ItemStack(Material.ARROW),
|
||||
"Arrow Velocity", new String[] { "Determins how far your", "crossbow can shoot.", "Default: 1.0" },
|
||||
new String[] { "bow", "crossbow" });
|
||||
public static final ItemStat PVE_DAMAGE = new DoubleStat("PVE_DAMAGE", VersionMaterial.PORKCHOP.toItem(),
|
||||
"PvE Damage", new String[] { "Additional damage against", "non human entities in %." }, new String[] {
|
||||
"piercing", "slashing", "blunt", "offhand", "range", "tool", "armor", "gem_stone", "accessory" });
|
||||
public static final ItemStat PVP_DAMAGE = new DoubleStat("PVP_DAMAGE", VersionMaterial.SKELETON_SKULL.toItem(),
|
||||
"PvP Damage", new String[] { "Additional damage", "against players in %." }, new String[] { "piercing",
|
||||
"slashing", "blunt", "offhand", "range", "tool", "armor", "gem_stone", "accessory" });
|
||||
public static final ItemStat BLUNT_POWER = new DoubleStat("BLUNT_POWER", new ItemStack(Material.IRON_AXE),
|
||||
"Blunt Power", new String[] { "The radius of the AoE attack.", "If set to 2.0, enemies within 2 blocks",
|
||||
"around your target will take damage." },
|
||||
public static final ItemStat MANA_COST = new DoubleStat("MANA_COST", VersionMaterial.LAPIS_LAZULI.toItem(), "Mana Cost",
|
||||
new String[] { "Mana spent by your weapon to be used." }, new String[] { "piercing", "slashing", "blunt", "range" });
|
||||
public static final ItemStat STAMINA_COST = new DoubleStat("STAMINA_COST", VersionMaterial.LIGHT_GRAY_DYE.toItem(), "Stamina Cost",
|
||||
new String[] { "Stamina spent by your weapon to be used." }, new String[] { "piercing", "slashing", "blunt", "range" });
|
||||
public static final ItemStat ARROW_VELOCITY = new DoubleStat("ARROW_VELOCITY", new ItemStack(Material.ARROW), "Arrow Velocity",
|
||||
new String[] { "Determins how far your", "crossbow can shoot.", "Default: 1.0" }, new String[] { "bow", "crossbow" });
|
||||
public static final ItemStat PVE_DAMAGE = new DoubleStat("PVE_DAMAGE", VersionMaterial.PORKCHOP.toItem(), "PvE Damage",
|
||||
new String[] { "Additional damage against", "non human entities in %." },
|
||||
new String[] { "piercing", "slashing", "blunt", "offhand", "range", "tool", "armor", "gem_stone", "accessory" });
|
||||
public static final ItemStat PVP_DAMAGE = new DoubleStat("PVP_DAMAGE", VersionMaterial.SKELETON_SKULL.toItem(), "PvP Damage",
|
||||
new String[] { "Additional damage", "against players in %." },
|
||||
new String[] { "piercing", "slashing", "blunt", "offhand", "range", "tool", "armor", "gem_stone", "accessory" });
|
||||
public static final ItemStat BLUNT_POWER = new DoubleStat("BLUNT_POWER", new ItemStack(Material.IRON_AXE), "Blunt Power",
|
||||
new String[] { "The radius of the AoE attack.", "If set to 2.0, enemies within 2 blocks", "around your target will take damage." },
|
||||
new String[] { "blunt", "gem_stone" });
|
||||
public static final ItemStat BLUNT_RATING = new DoubleStat("BLUNT_RATING", new ItemStack(Material.BRICK),
|
||||
"Blunt Rating", new String[] { "The force of the blunt attack.", "If set to 50%, enemies hit by the attack",
|
||||
"will take 50% of the initial damage." },
|
||||
public static final ItemStat BLUNT_RATING = new DoubleStat("BLUNT_RATING", new ItemStack(Material.BRICK), "Blunt Rating",
|
||||
new String[] { "The force of the blunt attack.", "If set to 50%, enemies hit by the attack", "will take 50% of the initial damage." },
|
||||
new String[] { "blunt", "gem_stone" });
|
||||
public static final ItemStat WEAPON_DAMAGE = new DoubleStat("WEAPON_DAMAGE", new ItemStack(Material.IRON_SWORD),
|
||||
"Weapon Damage", new String[] { "Additional on-hit weapon damage in %." });
|
||||
public static final ItemStat SKILL_DAMAGE = new DoubleStat("SKILL_DAMAGE", new ItemStack(Material.BOOK),
|
||||
"Skill Damage", new String[] { "Additional ability damage in %." });
|
||||
public static final ItemStat PROJECTILE_DAMAGE = new DoubleStat("PROJECTILE_DAMAGE", new ItemStack(Material.ARROW),
|
||||
"Projectile Damage", new String[] { "Additional skill/weapon projectile damage." });
|
||||
public static final ItemStat MAGIC_DAMAGE = new DoubleStat("MAGIC_DAMAGE", new ItemStack(Material.MAGMA_CREAM),
|
||||
"Magic Damage", new String[] { "Additional magic skill damage in %." });
|
||||
public static final ItemStat PHYSICAL_DAMAGE = new DoubleStat("PHYSICAL_DAMAGE", new ItemStack(Material.IRON_AXE),
|
||||
"Physical Damage", new String[] { "Additional skill/weapon physical damage." });
|
||||
public static final ItemStat DEFENSE = new DoubleStat("DEFENSE",
|
||||
new ItemStack(Material.SHIELD), "Defense",
|
||||
public static final ItemStat WEAPON_DAMAGE = new DoubleStat("WEAPON_DAMAGE", new ItemStack(Material.IRON_SWORD), "Weapon Damage",
|
||||
new String[] { "Additional on-hit weapon damage in %." });
|
||||
public static final ItemStat SKILL_DAMAGE = new DoubleStat("SKILL_DAMAGE", new ItemStack(Material.BOOK), "Skill Damage",
|
||||
new String[] { "Additional ability damage in %." });
|
||||
public static final ItemStat PROJECTILE_DAMAGE = new DoubleStat("PROJECTILE_DAMAGE", new ItemStack(Material.ARROW), "Projectile Damage",
|
||||
new String[] { "Additional skill/weapon projectile damage." });
|
||||
public static final ItemStat MAGIC_DAMAGE = new DoubleStat("MAGIC_DAMAGE", new ItemStack(Material.MAGMA_CREAM), "Magic Damage",
|
||||
new String[] { "Additional magic skill damage in %." });
|
||||
public static final ItemStat PHYSICAL_DAMAGE = new DoubleStat("PHYSICAL_DAMAGE", new ItemStack(Material.IRON_AXE), "Physical Damage",
|
||||
new String[] { "Additional skill/weapon physical damage." });
|
||||
public static final ItemStat DEFENSE = new DoubleStat("DEFENSE", new ItemStack(Material.SHIELD), "Defense",
|
||||
new String[] { "Reduces damage from any source.", "Formula can be set in MMOLib Config." });
|
||||
public static final ItemStat DAMAGE_REDUCTION = new DoubleStat("DAMAGE_REDUCTION",
|
||||
new ItemStack(Material.IRON_CHESTPLATE), "Damage Reduction",
|
||||
public static final ItemStat DAMAGE_REDUCTION = new DoubleStat("DAMAGE_REDUCTION", new ItemStack(Material.IRON_CHESTPLATE), "Damage Reduction",
|
||||
new String[] { "Reduces damage from any source.", "In %." });
|
||||
public static final ItemStat FALL_DAMAGE_REDUCTION = new DoubleStat("FALL_DAMAGE_REDUCTION",
|
||||
new ItemStack(Material.FEATHER), "Fall Damage Reduction", new String[] { "Reduces fall damage.", "In %." });
|
||||
public static final ItemStat PROJECTILE_DAMAGE_REDUCTION = new DoubleStat("PROJECTILE_DAMAGE_REDUCTION",
|
||||
VersionMaterial.SNOWBALL.toItem(), "Projectile Damage Reduction",
|
||||
new String[] { "Reduces projectile damage.", "In %." });
|
||||
public static final ItemStat PHYSICAL_DAMAGE_REDUCTION = new DoubleStat("PHYSICAL_DAMAGE_REDUCTION",
|
||||
new ItemStack(Material.LEATHER_CHESTPLATE), "Physical Damage Reduction",
|
||||
new String[] { "Reduces physical damage.", "In %." });
|
||||
public static final ItemStat FIRE_DAMAGE_REDUCTION = new DoubleStat("FIRE_DAMAGE_REDUCTION",
|
||||
new ItemStack(Material.BLAZE_POWDER), "Fire Damage Reduction",
|
||||
new String[] { "Reduces fire damage.", "In %." });
|
||||
public static final ItemStat MAGIC_DAMAGE_REDUCTION = new DoubleStat("MAGIC_DAMAGE_REDUCTION",
|
||||
new ItemStack(Material.POTION), "Magic Damage Reduction",
|
||||
new String[] { "Reduce magic damage dealt by potions.", "In %." });
|
||||
public static final ItemStat PVE_DAMAGE_REDUCTION = new DoubleStat("PVE_DAMAGE_REDUCTION",
|
||||
VersionMaterial.PORKCHOP.toItem(), "PvE Damage Reduction",
|
||||
new String[] { "Reduces damage dealt by mobs.", "In %." });
|
||||
public static final ItemStat PVP_DAMAGE_REDUCTION = new DoubleStat("PVP_DAMAGE_REDUCTION",
|
||||
VersionMaterial.SKELETON_SKULL.toItem(), "PvP Damage Reduction",
|
||||
new String[] { "Reduces damage dealt by players", "In %." });
|
||||
public static final ItemStat UNDEAD_DAMAGE = new DoubleStat("UNDEAD_DAMAGE",
|
||||
VersionMaterial.SKELETON_SKULL.toItem(), "Undead Damage",
|
||||
public static final ItemStat FALL_DAMAGE_REDUCTION = new DoubleStat("FALL_DAMAGE_REDUCTION", new ItemStack(Material.FEATHER),
|
||||
"Fall Damage Reduction", new String[] { "Reduces fall damage.", "In %." });
|
||||
public static final ItemStat PROJECTILE_DAMAGE_REDUCTION = new DoubleStat("PROJECTILE_DAMAGE_REDUCTION", VersionMaterial.SNOWBALL.toItem(),
|
||||
"Projectile Damage Reduction", new String[] { "Reduces projectile damage.", "In %." });
|
||||
public static final ItemStat PHYSICAL_DAMAGE_REDUCTION = new DoubleStat("PHYSICAL_DAMAGE_REDUCTION", new ItemStack(Material.LEATHER_CHESTPLATE),
|
||||
"Physical Damage Reduction", new String[] { "Reduces physical damage.", "In %." });
|
||||
public static final ItemStat FIRE_DAMAGE_REDUCTION = new DoubleStat("FIRE_DAMAGE_REDUCTION", new ItemStack(Material.BLAZE_POWDER),
|
||||
"Fire Damage Reduction", new String[] { "Reduces fire damage.", "In %." });
|
||||
public static final ItemStat MAGIC_DAMAGE_REDUCTION = new DoubleStat("MAGIC_DAMAGE_REDUCTION", new ItemStack(Material.POTION),
|
||||
"Magic Damage Reduction", new String[] { "Reduce magic damage dealt by potions.", "In %." });
|
||||
public static final ItemStat PVE_DAMAGE_REDUCTION = new DoubleStat("PVE_DAMAGE_REDUCTION", VersionMaterial.PORKCHOP.toItem(),
|
||||
"PvE Damage Reduction", new String[] { "Reduces damage dealt by mobs.", "In %." });
|
||||
public static final ItemStat PVP_DAMAGE_REDUCTION = new DoubleStat("PVP_DAMAGE_REDUCTION", VersionMaterial.SKELETON_SKULL.toItem(),
|
||||
"PvP Damage Reduction", new String[] { "Reduces damage dealt by players", "In %." });
|
||||
public static final ItemStat UNDEAD_DAMAGE = new DoubleStat("UNDEAD_DAMAGE", VersionMaterial.SKELETON_SKULL.toItem(), "Undead Damage",
|
||||
new String[] { "Deals additional damage to undead.", "In %." });
|
||||
public static final ItemStat UNBREAKABLE = new Unbreakable(), TIER = new ItemTierStat(), SET = new ItemSetStat(),
|
||||
ARMOR = new Armor(), ARMOR_TOUGHNESS = new ArmorToughness(), MAX_HEALTH = new MaxHealth(), UNSTACKABLE = new Unstackable();
|
||||
public static final ItemStat MAX_MANA = new DoubleStat("MAX_MANA", VersionMaterial.LAPIS_LAZULI.toItem(),
|
||||
"Max Mana", new String[] { "Adds mana to your max mana bar." });
|
||||
public static final ItemStat UNBREAKABLE = new Unbreakable(), TIER = new ItemTierStat(), SET = new ItemSetStat(), ARMOR = new Armor(),
|
||||
ARMOR_TOUGHNESS = new ArmorToughness(), MAX_HEALTH = new MaxHealth(), UNSTACKABLE = new Unstackable();
|
||||
public static final ItemStat MAX_MANA = new DoubleStat("MAX_MANA", VersionMaterial.LAPIS_LAZULI.toItem(), "Max Mana",
|
||||
new String[] { "Adds mana to your max mana bar." });
|
||||
public static final ItemStat KNOCKBACK_RESISTANCE = new KnockbackResistance(), MOVEMENT_SPEED = new MovementSpeed();
|
||||
|
||||
public static final ItemStat TWO_HANDED = new BooleanStat("TWO_HANDED", new ItemStack(Material.IRON_INGOT),
|
||||
"Two Handed",
|
||||
new String[] { "If set to true, a player will be", "significantly slower if holding two",
|
||||
"items, one being Two Handed." },
|
||||
public static final ItemStat TWO_HANDED = new BooleanStat("TWO_HANDED", new ItemStack(Material.IRON_INGOT), "Two Handed",
|
||||
new String[] { "If set to true, a player will be", "significantly slower if holding two", "items, one being Two Handed." },
|
||||
new String[] { "piercing", "slashing", "blunt", "offhand", "range", "tool" });
|
||||
|
||||
public static final ItemStat RESTORE = new Restore();
|
||||
public static final ItemStat RESTORE_MANA = new DoubleStat("RESTORE_MANA", VersionMaterial.LAPIS_LAZULI.toItem(),
|
||||
"Restore Mana", new String[] { "The amount of mana", "your consumable restores." },
|
||||
new String[] { "consumable" });
|
||||
public static final ItemStat RESTORE_STAMINA = new DoubleStat("RESTORE_STAMINA",
|
||||
VersionMaterial.LIGHT_GRAY_DYE.toItem(), "Restore Stamina",
|
||||
public static final ItemStat RESTORE_MANA = new DoubleStat("RESTORE_MANA", VersionMaterial.LAPIS_LAZULI.toItem(), "Restore Mana",
|
||||
new String[] { "The amount of mana", "your consumable restores." }, new String[] { "consumable" });
|
||||
public static final ItemStat RESTORE_STAMINA = new DoubleStat("RESTORE_STAMINA", VersionMaterial.LIGHT_GRAY_DYE.toItem(), "Restore Stamina",
|
||||
new String[] { "The amount of stamina/power", "your consumable restores." }, new String[] { "consumable" });
|
||||
public static final ItemStat CAN_IDENTIFY = new BooleanStat("CAN_IDENTIFY", new ItemStack(Material.PAPER),
|
||||
"Can Identify?", new String[] { "Players can identify & make their", "item usable using this consumable." },
|
||||
new String[] { "consumable" });
|
||||
public static final ItemStat CAN_DECONSTRUCT = new BooleanStat(
|
||||
"CAN_DECONSTRUCT", new ItemStack(Material.PAPER), "Can Deconstruct?", new String[] {
|
||||
"Players can deconstruct their item", "using this consumable, creating", "another random item." },
|
||||
public static final ItemStat CAN_IDENTIFY = new BooleanStat("CAN_IDENTIFY", new ItemStack(Material.PAPER), "Can Identify?",
|
||||
new String[] { "Players can identify & make their", "item usable using this consumable." }, new String[] { "consumable" });
|
||||
public static final ItemStat CAN_DECONSTRUCT = new BooleanStat("CAN_DECONSTRUCT", new ItemStack(Material.PAPER), "Can Deconstruct?",
|
||||
new String[] { "Players can deconstruct their item", "using this consumable, creating", "another random item." },
|
||||
new String[] { "consumable" });
|
||||
public static final ItemStat EFFECTS = new Effects(), PERM_EFFECTS = new PermanentEffects();
|
||||
public static final ItemStat SOULBINDING_CHANCE = new DoubleStat("SOULBINDING_CHANCE",
|
||||
VersionMaterial.ENDER_EYE.toItem(), "Soulbinding Chance",
|
||||
new String[] { "Defines the chance your item has to", "link another item to your soul,",
|
||||
"preventing other players from using it." },
|
||||
public static final ItemStat SOULBINDING_CHANCE = new DoubleStat("SOULBINDING_CHANCE", VersionMaterial.ENDER_EYE.toItem(), "Soulbinding Chance",
|
||||
new String[] { "Defines the chance your item has to", "link another item to your soul,", "preventing other players from using it." },
|
||||
new String[] { "consumable" });
|
||||
public static final ItemStat SOULBOUND_BREAK_CHANCE = new DoubleStat("SOULBOUND_BREAK_CHANCE",
|
||||
VersionMaterial.ENDER_EYE.toItem(), "Soulbound Break Chance",
|
||||
new String[] { "The chance of breaking an item's", "soulbound when drag & drop'd on it.",
|
||||
"This chance is lowered depending", "on the soulbound's level." },
|
||||
public static final ItemStat SOULBOUND_BREAK_CHANCE = new DoubleStat(
|
||||
"SOULBOUND_BREAK_CHANCE", VersionMaterial.ENDER_EYE.toItem(), "Soulbound Break Chance", new String[] { "The chance of breaking an item's",
|
||||
"soulbound when drag & drop'd on it.", "This chance is lowered depending", "on the soulbound's level." },
|
||||
new String[] { "consumable" });
|
||||
public static final ItemStat SOULBOUND_LEVEL = new SoulboundLevel();
|
||||
public static final ItemStat ITEM_COOLDOWN = new DoubleStat("ITEM_COOLDOWN", new ItemStack(Material.COOKED_CHICKEN),
|
||||
"Item Cooldown", new String[] { "This cooldown applies for consumables", "as well as for item commands." },
|
||||
public static final ItemStat ITEM_COOLDOWN = new DoubleStat("ITEM_COOLDOWN", new ItemStack(Material.COOKED_CHICKEN), "Item Cooldown",
|
||||
new String[] { "This cooldown applies for consumables", "as well as for item commands." },
|
||||
new String[] { "!armor", "!gem_stone", "all" });
|
||||
public static final ItemStat VANILLA_EATING_ANIMATION = new VanillaEatingAnimation(), INEDIBLE = new Inedible(),
|
||||
GEM_COLOR = new GemColor(), ITEM_TYPE_RESTRICTION = new ItemTypeRestriction();
|
||||
public static final ItemStat MAX_CONSUME = new DoubleStat("MAX_CONSUME", new ItemStack(Material.BLAZE_POWDER),
|
||||
"Max Consume", new String[] { "Max amount of usage before", "item disappears." },
|
||||
new String[] { "consumable" });
|
||||
public static final ItemStat VANILLA_EATING_ANIMATION = new VanillaEatingAnimation(), INEDIBLE = new Inedible(), GEM_COLOR = new GemColor(),
|
||||
ITEM_TYPE_RESTRICTION = new ItemTypeRestriction();
|
||||
public static final ItemStat MAX_CONSUME = new DoubleStat("MAX_CONSUME", new ItemStack(Material.BLAZE_POWDER), "Max Consume",
|
||||
new String[] { "Max amount of usage before", "item disappears." }, new String[] { "consumable" });
|
||||
|
||||
public static final ItemStat SUCCESS_RATE = new SuccessRate();
|
||||
public static final ItemStat COMPATIBLE_TYPES = new CompatibleTypes();
|
||||
|
||||
public static final ItemStat CRAFTING = new Crafting(), CRAFT_PERMISSION = new CraftingPermission(),
|
||||
CRAFT_AMOUNT = new DoubleStat("CRAFTED_AMOUNT", new ItemStack(Material.WOODEN_AXE), "Crafted Amount",
|
||||
new String[] { "The stack count for", "this item when crafted." }, new String[] { "all" });
|
||||
new String[] { "The stack count for", "this item when crafted." }, new String[] { "all" });
|
||||
public static final ItemStat AUTOSMELT = new BooleanStat("AUTOSMELT", new ItemStack(Material.COAL), "Autosmelt",
|
||||
new String[] { "If set to true, your tool will", "automaticaly smelt mined ores." },
|
||||
new String[] { "tool" });
|
||||
public static final ItemStat BOUNCING_CRACK = new BooleanStat("BOUNCING_CRACK",
|
||||
VersionMaterial.COBBLESTONE_WALL.toItem(), "Bouncing Crack",
|
||||
new String[] { "If set to true, your tool will", "automaticaly smelt mined ores." }, new String[] { "tool" });
|
||||
public static final ItemStat BOUNCING_CRACK = new BooleanStat("BOUNCING_CRACK", VersionMaterial.COBBLESTONE_WALL.toItem(), "Bouncing Crack",
|
||||
new String[] { "If set to true, your tool will", "also break nearby blocks." }, new String[] { "tool" });
|
||||
public static final ItemStat PICKAXE_POWER = new PickaxePower();
|
||||
public static final ItemStat CUSTOM_SOUNDS = new CustomSounds();
|
||||
public static final ItemStat ELEMENTS = new Elements();
|
||||
public static final ItemStat COMMANDS = new Commands(), STAFF_SPIRIT = new StaffSpiritStat(),
|
||||
LUTE_ATTACK_SOUND = new LuteAttackSoundStat(), LUTE_ATTACK_EFFECT = new LuteAttackEffectStat();
|
||||
public static final ItemStat NOTE_WEIGHT = new DoubleStat("NOTE_WEIGHT", VersionMaterial.MUSIC_DISC_MALL.toItem(),
|
||||
"Note Weight", new String[] { "Defines how the projectile cast", "by your lute tilts downwards." },
|
||||
new String[] { "lute" });
|
||||
public static final ItemStat REMOVE_ON_CRAFT = new BooleanStat("REMOVE_ON_CRAFT",
|
||||
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." },
|
||||
new String[] { "all" }, Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION,
|
||||
Material.MILK_BUCKET, Material.LAVA_BUCKET, Material.WATER_BUCKET);
|
||||
public static final ItemStat COMMANDS = new Commands(), STAFF_SPIRIT = new StaffSpiritStat(), LUTE_ATTACK_SOUND = new LuteAttackSoundStat(),
|
||||
LUTE_ATTACK_EFFECT = new LuteAttackEffectStat();
|
||||
public static final ItemStat NOTE_WEIGHT = new DoubleStat("NOTE_WEIGHT", VersionMaterial.MUSIC_DISC_MALL.toItem(), "Note Weight",
|
||||
new String[] { "Defines how the projectile cast", "by your lute tilts downwards." }, new String[] { "lute" });
|
||||
public static final ItemStat REMOVE_ON_CRAFT = new BooleanStat("REMOVE_ON_CRAFT", 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." },
|
||||
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 GemSockets();
|
||||
public static final ItemStat REPAIR = new DoubleStat("REPAIR", new ItemStack(Material.ANVIL), "Repair",
|
||||
new String[] { "The amount of durability your item", "can repair when set an item." },
|
||||
new String[] { "consumable" });
|
||||
new String[] { "The amount of durability your item", "can repair when set an item." }, new String[] { "consumable" });
|
||||
// public static final ItemStat REPAIR_MATERIAL = new RepairMaterial();
|
||||
|
||||
public static final ItemStat KNOCKBACK = new DoubleStat("KNOCKBACK", VersionMaterial.IRON_HORSE_ARMOR.toItem(),
|
||||
"Knockback", new String[] { "Using this musket will knock", "the user back if positive." },
|
||||
new String[] { "musket" });
|
||||
public static final ItemStat KNOCKBACK = new DoubleStat("KNOCKBACK", VersionMaterial.IRON_HORSE_ARMOR.toItem(), "Knockback",
|
||||
new String[] { "Using this musket will knock", "the user back if positive." }, new String[] { "musket" });
|
||||
public static final ItemStat RECOIL = new DoubleStat("RECOIL", VersionMaterial.IRON_HORSE_ARMOR.toItem(), "Recoil",
|
||||
new String[] { "Corresponds to the shooting innacuracy." }, new String[] { "musket" });
|
||||
|
||||
public static final ItemStat ABILITIES = new Abilities(), UPGRADE = new UpgradeStat();
|
||||
public static final ItemStat SKULL_TEXTURE = new SkullTextureStat(), DYE_COLOR = new DyeColor(),
|
||||
POTION_EFFECTS = new PotionEffects(), POTION_COLOR = new PotionColor(),
|
||||
SHIELD_PATTERN = new ShieldPatternStat(), HIDE_POTION_EFFECTS = new HidePotionEffects();
|
||||
public static final ItemStat SKULL_TEXTURE = new SkullTextureStat(), DYE_COLOR = new DyeColor(), POTION_EFFECTS = new PotionEffects(),
|
||||
POTION_COLOR = new PotionColor(), SHIELD_PATTERN = new ShieldPatternStat(), HIDE_POTION_EFFECTS = new HidePotionEffects();
|
||||
|
||||
/*
|
||||
* internal stats
|
||||
@ -259,11 +267,30 @@ public abstract class ItemStat {
|
||||
private final List<Material> compatibleMaterials;
|
||||
|
||||
/*
|
||||
* the stat can be enabled or not, depending on the server version to prevent
|
||||
* from displaying useless editable stats in the edition menu.
|
||||
* the stat can be enabled or not, depending on the server version to
|
||||
* prevent from displaying useless editable stats in the edition menu.
|
||||
*/
|
||||
private boolean enabled = true;
|
||||
|
||||
/**
|
||||
* Initializes an item stat
|
||||
*
|
||||
* @param id
|
||||
* The item stat ID, used internally. Also determines the lower
|
||||
* case path for config files
|
||||
* @param item
|
||||
* The itemStack used to display the stat in the item edition GUI
|
||||
* @param name
|
||||
* The stat name which has a translation in the language files
|
||||
* @param lore
|
||||
* The stat description used in the edition GUI
|
||||
* @param types
|
||||
* Compatible types. Use 'all' to support all item types or
|
||||
* !{type-name} to blacklist an item type
|
||||
* @param materials
|
||||
* Materials compatible with the item stat (eg Shield Pattern),
|
||||
* any if empty
|
||||
*/
|
||||
public ItemStat(String id, ItemStack item, String name, String[] lore, String[] types, Material... materials) {
|
||||
this.id = id;
|
||||
this.item = item;
|
||||
@ -273,41 +300,79 @@ public abstract class ItemStat {
|
||||
this.compatibleMaterials = Arrays.asList(materials);
|
||||
}
|
||||
|
||||
/*
|
||||
* reads stat data from a configuration section and applies it to the item stack
|
||||
* after having generated the corresponding stat data class instance
|
||||
/**
|
||||
* When stat data is being read from a /item config file
|
||||
*
|
||||
* @param object
|
||||
* Could be a config section, a string, a string list, etc.
|
||||
* @return Stat data read from config, or throws an IAE
|
||||
*/
|
||||
public abstract StatData whenInitialized(Object object);
|
||||
|
||||
/*
|
||||
* any item stat which can be used in the item generator. this method reads from
|
||||
* a config file stat data which is cached to later generate a random item
|
||||
/**
|
||||
* When random stat data is being read from a config file
|
||||
*
|
||||
* @param object
|
||||
* Could be a config section, a string, a string list, etc.
|
||||
* @return Random stat data read from config, or throws an IAE
|
||||
*/
|
||||
public abstract RandomStatData whenInitializedGeneration(Object object);
|
||||
|
||||
/*
|
||||
* applies a stat onto an mmoitem builder instance
|
||||
/**
|
||||
* Called when applying a stat onto an mmoitem builder instance. Applies
|
||||
* item tags, adds required lines to the item lore, etc.
|
||||
*
|
||||
* @param item
|
||||
* MMOItem builder which must be completed
|
||||
* @param data
|
||||
* Stat data being applied
|
||||
*/
|
||||
public abstract void whenApplied(MMOItemBuilder item, StatData data);
|
||||
|
||||
/*
|
||||
* when the stat item is clicked in the item edition menu
|
||||
/**
|
||||
* Called when the stat item is clicked in the item edition menu
|
||||
*
|
||||
* @param inv
|
||||
* Inventory clicked
|
||||
* @param event
|
||||
* Click event
|
||||
* @return Returned value is not used by MMOItems
|
||||
*/
|
||||
public abstract boolean whenClicked(EditionInventory inv, InventoryClickEvent event);
|
||||
public abstract void whenClicked(EditionInventory inv, InventoryClickEvent event);
|
||||
|
||||
/*
|
||||
* when entering input using the chat edition feature from the item edition menu
|
||||
/**
|
||||
* When inputing data using chat or anvil input in order to edit the edit in
|
||||
* the GUI editor
|
||||
*
|
||||
* @param inv
|
||||
* Previously opened edition menu
|
||||
* @param config
|
||||
* Config file about to be edited
|
||||
* @param message
|
||||
* Player input
|
||||
* @param info
|
||||
* Extra information given by the stat when instanciating
|
||||
* StatEdition given to this method to identify what is being
|
||||
* edited
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean whenInput(EditionInventory inv, ConfigFile config, String message, Object... info);
|
||||
|
||||
/*
|
||||
* when loading mmoitem data from an ItemStack
|
||||
/**
|
||||
* Called when stat data is read from an ItemStack in a player inventory
|
||||
*
|
||||
* @param mmoitem
|
||||
* NBTItem being read and transformed into a MMOItem instance
|
||||
*/
|
||||
public abstract void whenLoaded(ReadMMOItem mmoitem);
|
||||
|
||||
/*
|
||||
* displays the current stat state/value in the item edition GUI, the lore
|
||||
* corresponds to the GUI stat item
|
||||
/**
|
||||
* Called when stat data is displayed in the edition GUI
|
||||
*
|
||||
* @param lore
|
||||
* Current item lore which must be completed
|
||||
* @param mmoitem
|
||||
* MMOItem being read
|
||||
*/
|
||||
public abstract void whenDisplayed(List<String> lore, MMOItem mmoitem);
|
||||
|
||||
@ -340,10 +405,6 @@ public abstract class ItemStat {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public boolean isInternal() {
|
||||
return this instanceof InternalStat;
|
||||
}
|
||||
|
||||
public String[] getLore() {
|
||||
return lore;
|
||||
}
|
||||
|
@ -39,17 +39,16 @@ public class StringStat extends ItemStat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
public void whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||
ConfigFile config = inv.getEdited().getType().getConfigFile();
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
config.getConfig().set(inv.getEdited().getId() + "." + getPath(), null);
|
||||
inv.registerItemEdition(config);
|
||||
inv.open();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed " + getName() + ".");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
new StatEdition(inv, this).enable("Write in the chat the text you want.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user