mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
!this is the custom block merge
This commit is contained in:
parent
c9738bfbc0
commit
2dd32507fa
@ -1,16 +1,15 @@
|
||||
package net.Indyuce.mmoitems.api;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
|
||||
public class ConfigFile {
|
||||
private final Plugin plugin;
|
||||
private final String path, name;
|
||||
@ -54,8 +53,9 @@ public class ConfigFile {
|
||||
if (!new File(plugin.getDataFolder() + path).exists())
|
||||
new File(plugin.getDataFolder() + path).mkdir();
|
||||
|
||||
if (!new File(plugin.getDataFolder() + path, name + ".yml").exists())
|
||||
if (!new File(plugin.getDataFolder() + path, name + ".yml").exists()) {
|
||||
new File(plugin.getDataFolder() + path, name + ".yml").createNewFile();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
MMOItems.plugin.getLogger().log(Level.SEVERE, "Could not generate " + name + ".yml");
|
||||
}
|
||||
|
@ -1,18 +1,17 @@
|
||||
package net.Indyuce.mmoitems.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.plugin.identify.UnidentifiedItem;
|
||||
import net.Indyuce.mmoitems.manager.TypeManager;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Type {
|
||||
|
||||
@ -50,8 +49,9 @@ public class Type {
|
||||
public static final Type GEM_STONE = new Type(TypeSet.EXTRA, "GEM_STONE", false, false, true, EquipmentSlot.OTHER);
|
||||
public static final Type SKIN = new Type(TypeSet.EXTRA, "SKIN", false, false, true, EquipmentSlot.OTHER);
|
||||
public static final Type ACCESSORY = new Type(TypeSet.EXTRA, "ACCESSORY", false, false, true, EquipmentSlot.ACCESSORY);
|
||||
public static final Type BLOCK = new Type(TypeSet.EXTRA, "BLOCK", false, false, false, EquipmentSlot.OTHER);
|
||||
|
||||
private final String id;
|
||||
private final String id;
|
||||
private String name;
|
||||
private final TypeSet set;
|
||||
|
||||
@ -68,7 +68,7 @@ public class Type {
|
||||
|
||||
/*
|
||||
* used to display the item in the item explorer and in the item recipes
|
||||
* list in the advanved workbench. can also be edited using the config
|
||||
* list in the advanced workbench. can also be edited using the config
|
||||
* files.
|
||||
*/
|
||||
private ItemStack item;
|
||||
|
@ -1,53 +1,38 @@
|
||||
package net.Indyuce.mmoitems.api.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.util.MushroomState;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CustomBlock {
|
||||
private final int id;
|
||||
private final MushroomState state;
|
||||
|
||||
private final String blockName;
|
||||
private final MMOItem mmoitem;
|
||||
|
||||
private final WorldGenTemplate template;
|
||||
private final List<String> lore = new ArrayList<>();
|
||||
private final int minExp, maxExp, requiredPower;
|
||||
|
||||
public CustomBlock(MushroomState state, ConfigurationSection config) {
|
||||
this.id = Integer.valueOf(config.getName());
|
||||
public CustomBlock(MushroomState state, MMOItem mmoitem) {
|
||||
this.mmoitem = mmoitem;
|
||||
|
||||
this.id = (mmoitem.hasData(ItemStat.BLOCK_ID)) ? (int) ((DoubleData) mmoitem.getData(ItemStat.BLOCK_ID)).generateNewValue() : 0;
|
||||
this.state = state;
|
||||
|
||||
Validate.notNull(config, "Could not read custom block config");
|
||||
this.minExp = (mmoitem.hasData(ItemStat.MIN_XP)) ? (int) ((DoubleData) mmoitem.getData(ItemStat.MIN_XP)).generateNewValue() : 0;
|
||||
this.maxExp = (mmoitem.hasData(ItemStat.MAX_XP)) ? (int) ((DoubleData) mmoitem.getData(ItemStat.MAX_XP)).generateNewValue() : 0;
|
||||
this.requiredPower = (mmoitem.hasData(ItemStat.REQUIRED_POWER)) ? (int) ((DoubleData) mmoitem.getData(ItemStat.REQUIRED_POWER)).generateNewValue() : 0;
|
||||
|
||||
blockName = MMOLib.plugin.parseColors(config.getString("display-name", "Custom Block"));
|
||||
if (config.contains("lore"))
|
||||
for (String s : config.getStringList("lore"))
|
||||
lore.add(MMOLib.plugin.parseColors(s));
|
||||
minExp = config.getInt("min-xp", 0);
|
||||
maxExp = config.getInt("max-xp", 0);
|
||||
requiredPower = config.getInt("required-power", 0);
|
||||
template = config.contains("gen-template") ? MMOItems.plugin.getWorldGen().getOrThrow(config.get("gen-template").toString()) : null;
|
||||
this.template = (mmoitem.hasData(ItemStat.GEN_TEMPLATE)) ? MMOItems.plugin.getWorldGen().getOrThrow((mmoitem.getData(ItemStat.GEN_TEMPLATE)).toString()) : null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return blockName;
|
||||
}
|
||||
|
||||
public MushroomState getState() {
|
||||
return state;
|
||||
@ -61,10 +46,6 @@ public class CustomBlock {
|
||||
return template;
|
||||
}
|
||||
|
||||
public List<String> getLore() {
|
||||
return lore;
|
||||
}
|
||||
|
||||
public int getMinExpDrop() {
|
||||
return minExp;
|
||||
}
|
||||
@ -77,24 +58,7 @@ public class CustomBlock {
|
||||
return requiredPower;
|
||||
}
|
||||
|
||||
// Convert block data into Item
|
||||
public ItemStack getItem() {
|
||||
ItemStack item = new ItemStack(Material.CLAY_BALL);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(blockName);
|
||||
meta.setLore(lore);
|
||||
meta.setUnbreakable(true);
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
|
||||
if (MMOLib.plugin.getVersion().isBelowOrEqual(1, 13))
|
||||
((Damageable) meta).setDamage(id);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return MMOLib.plugin.getVersion().getWrapper().getNBTItem(item)
|
||||
.addTag(new ItemTag("MMOITEMS_DISABLE_CRAFTING", true), new ItemTag("MMOITEMS_DISABLE_SMITHING", true),
|
||||
new ItemTag("MMOITEMS_DISABLE_ENCHANTING", true), new ItemTag("MMOITEMS_DISABLE_REPAIRING", true),
|
||||
new ItemTag("MMOITEMS_BLOCK_ID", id), new ItemTag("CustomModelData", id + 1000))
|
||||
.toItem();
|
||||
return mmoitem.newBuilder().getItemStack();
|
||||
}
|
||||
}
|
||||
|
@ -1,72 +0,0 @@
|
||||
package net.Indyuce.mmoitems.api.edition;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
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.PluginInventory;
|
||||
import net.Indyuce.mmoitems.gui.edition.BlockEdition.ConfigOptions;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class BlockChatEdition implements Edition {
|
||||
|
||||
/*
|
||||
* saves the data about the edited data so the plugin can edit the
|
||||
* corresponding stat. some stats have complex chat formats, so the object
|
||||
* array allow to save more complex edition info
|
||||
*/
|
||||
private final PluginInventory inv;
|
||||
private final ConfigOptions option;
|
||||
private final int blockId;
|
||||
|
||||
public BlockChatEdition(PluginInventory inv, ConfigOptions co, int id) {
|
||||
this.inv = inv;
|
||||
this.option = co;
|
||||
this.blockId = id;
|
||||
}
|
||||
|
||||
public ConfigOptions getConfigOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginInventory getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public void enable(String... message) {
|
||||
inv.getPlayer().closeInventory();
|
||||
|
||||
inv.getPlayer().sendMessage(ChatColor.YELLOW + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
|
||||
for (String line : message)
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + line);
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Type 'cancel' to abort editing.");
|
||||
|
||||
/*
|
||||
* anvil text input feature. enables players to use an anvil to input
|
||||
* 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(this);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* default chat edition feature
|
||||
*/
|
||||
new ChatEdition(this);
|
||||
MMOLib.plugin.getVersion().getWrapper().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Block Edition", "See chat.", 10,
|
||||
40, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processInput(String input) {
|
||||
return input.equals("cancel") || option.whenInput(inv, input, blockId + "." + option.getConfigPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGoBack() {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,29 +1,5 @@
|
||||
package net.Indyuce.mmoitems.command;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
@ -45,7 +21,6 @@ import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.RandomAmount;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.gui.BlockBrowser;
|
||||
import net.Indyuce.mmoitems.gui.CraftingStationView;
|
||||
import net.Indyuce.mmoitems.gui.ItemBrowser;
|
||||
import net.Indyuce.mmoitems.gui.edition.ItemEdition;
|
||||
@ -58,6 +33,25 @@ import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.util.SmartGive;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class MMOItemsCommand implements CommandExecutor {
|
||||
private static final Random random = new Random();
|
||||
@ -175,13 +169,6 @@ public class MMOItemsCommand implements CommandExecutor {
|
||||
new ItemBrowser((Player) sender).open();
|
||||
return true;
|
||||
}
|
||||
if (args[1].equalsIgnoreCase("blocks")) {
|
||||
if (MMOLib.plugin.getVersion().isStrictlyHigher(1, 12))
|
||||
new BlockBrowser((Player) sender).open();
|
||||
else
|
||||
sender.sendMessage(ChatColor.RED + "Blocks are only for 1.13+.");
|
||||
return true;
|
||||
}
|
||||
if (!Type.isValid(args[1])) {
|
||||
sender.sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + "Please specify a valid item type.");
|
||||
return true;
|
||||
|
@ -1,22 +1,21 @@
|
||||
package net.Indyuce.mmoitems.comp.mmocore.stat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.AddonMessage;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.MMOCoreHook.MMOCoreRPGPlayer;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class Required_Attribute extends DoubleStat implements ItemRestriction {
|
||||
private final PlayerAttribute attribute;
|
||||
|
||||
public Required_Attribute(PlayerAttribute attribute) {
|
||||
super("REQUIRED_" + attribute.getId().toUpperCase().replace("-", "_"), VersionMaterial.GRAY_DYE.toItem(), attribute.getName() + " Requirement (MMOCore)", new String[] { "Amount of " + attribute.getName() + " points the", "player needs to use the item." });
|
||||
super("REQUIRED_" + attribute.getId().toUpperCase().replace("-", "_"), VersionMaterial.GRAY_DYE.toItem(), attribute.getName() + " Requirement (MMOCore)", new String[] { "Amount of " + attribute.getName() + " points the", "player needs to use the item." }, new String[] { "!block", "all" });
|
||||
|
||||
this.attribute = attribute;
|
||||
}
|
||||
|
@ -1,10 +1,5 @@
|
||||
package net.Indyuce.mmoitems.comp.mmocore.stat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmocore.api.experience.Profession;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.AddonMessage;
|
||||
@ -12,12 +7,16 @@ import net.Indyuce.mmoitems.comp.mmocore.MMOCoreHook;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Required_Profession extends DoubleStat implements ItemRestriction {
|
||||
private final Profession profession;
|
||||
|
||||
public Required_Profession(Profession profession) {
|
||||
super("PROFESSION_" + profession.getId().toUpperCase().replace("-", "_"), new ItemStack(Material.PINK_DYE), profession.getName() + " Requirement (MMOCore)", new String[] { "Amount of " + profession.getName() + " levels the", "player needs to use the item." });
|
||||
super("PROFESSION_" + profession.getId().toUpperCase().replace("-", "_"), new ItemStack(Material.PINK_DYE), profession.getName() + " Requirement (MMOCore)", new String[] { "Amount of " + profession.getName() + " levels the", "player needs to use the item." }, new String[] { "!block", "all" });
|
||||
this.profession = profession;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class FactionDamage extends DoubleStat {
|
||||
|
||||
public FactionDamage(String faction) {
|
||||
super("FACTION_DAMAGE_" + faction.toUpperCase(), new ItemStack(Material.RED_DYE), faction + " Faction Damage", new String[] { "Deals additional damage to mobs", "from the " + faction + " faction in %." }, new String[] { "all" });
|
||||
super("FACTION_DAMAGE_" + faction.toUpperCase(), new ItemStack(Material.RED_DYE), faction + " Faction Damage", new String[] { "Deals additional damage to mobs", "from the " + faction + " faction in %." }, new String[] { "!block", "all" });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,169 +0,0 @@
|
||||
package net.Indyuce.mmoitems.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.block.CustomBlock;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.gui.edition.BlockEdition;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class BlockBrowser extends PluginInventory {
|
||||
private Map<CustomBlock, ItemStack> cached = new HashMap<>();
|
||||
|
||||
private static final int[] slots = { 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34 };
|
||||
|
||||
public BlockBrowser(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
int min = (page - 1) * slots.length;
|
||||
int max = page * slots.length;
|
||||
int n = 0;
|
||||
|
||||
ItemStack error = VersionMaterial.RED_STAINED_GLASS_PANE.toItem();
|
||||
ItemMeta errorMeta = error.getItemMeta();
|
||||
errorMeta.setDisplayName(ChatColor.RED + "- Error -");
|
||||
List<String> errorLore = new ArrayList<>();
|
||||
errorLore.add(ChatColor.GRAY + "" + ChatColor.ITALIC + "An error occured while");
|
||||
errorLore.add(ChatColor.GRAY + "" + ChatColor.ITALIC + "trying to generate that block.");
|
||||
errorMeta.setLore(errorLore);
|
||||
error.setItemMeta(errorMeta);
|
||||
|
||||
List<CustomBlock> blocks = new ArrayList<>(MMOItems.plugin.getCustomBlocks().getAll());
|
||||
|
||||
/*
|
||||
* displays every item in a specific type. items are cached inside the
|
||||
* map at the top to reduce performance impact and are directly rendered
|
||||
*/
|
||||
Inventory inv = Bukkit.createInventory(this, 54, ChatColor.UNDERLINE + "Block Explorer");
|
||||
for (int j = min; j < Math.min(max, blocks.size()); j++) {
|
||||
CustomBlock block = blocks.get(j);
|
||||
if (!cached.containsKey(block)) {
|
||||
ItemStack item = block.getItem();
|
||||
if (item == null || item.getType() == Material.AIR) {
|
||||
cached.put(block, error);
|
||||
inv.setItem(slots[n++], error);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
lore.add("");
|
||||
lore.add(ChatColor.YELLOW + AltChar.smallListDash + " Left click to obtain this block.");
|
||||
lore.add(ChatColor.YELLOW + AltChar.smallListDash + " Right click to edit this block.");
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
cached.put(block, item);
|
||||
}
|
||||
|
||||
inv.setItem(slots[n++], cached.get(block));
|
||||
}
|
||||
|
||||
ItemStack noItem = VersionMaterial.GRAY_STAINED_GLASS_PANE.toItem();
|
||||
ItemMeta noItemMeta = noItem.getItemMeta();
|
||||
noItemMeta.setDisplayName(ChatColor.RED + "- No Block -");
|
||||
noItem.setItemMeta(noItemMeta);
|
||||
|
||||
ItemStack next = new ItemStack(Material.ARROW);
|
||||
ItemMeta nextMeta = next.getItemMeta();
|
||||
nextMeta.setDisplayName(ChatColor.GREEN + "Next Page");
|
||||
next.setItemMeta(nextMeta);
|
||||
|
||||
ItemStack previous = new ItemStack(Material.ARROW);
|
||||
ItemMeta previousMeta = previous.getItemMeta();
|
||||
previousMeta.setDisplayName(ChatColor.GREEN + "Previous Page");
|
||||
previous.setItemMeta(previousMeta);
|
||||
|
||||
ItemStack switchBrowse = new ItemStack(Material.IRON_SWORD);
|
||||
ItemMeta switchMeta = switchBrowse.getItemMeta();
|
||||
switchMeta.addItemFlags(ItemFlag.values());
|
||||
switchMeta.setDisplayName(ChatColor.GREEN + "Switch to Item Explorer");
|
||||
switchBrowse.setItemMeta(switchMeta);
|
||||
|
||||
ItemStack downloadPack = new ItemStack(Material.HOPPER);
|
||||
ItemMeta downloadMeta = downloadPack.getItemMeta();
|
||||
downloadMeta.setDisplayName(ChatColor.GREEN + "Download Default Resourcepack");
|
||||
downloadMeta.setLore(Arrays.asList(ChatColor.LIGHT_PURPLE + "Only seeing clay balls?", "", ChatColor.RED + "By downloading the default resourcepack you can", ChatColor.RED + "edit the blocks however you want.", ChatColor.RED + "You will still have to add it to your server!"));
|
||||
downloadPack.setItemMeta(downloadMeta);
|
||||
|
||||
while (n < slots.length)
|
||||
inv.setItem(slots[n++], noItem);
|
||||
inv.setItem(18, page > 1 ? previous : null);
|
||||
inv.setItem(26, max >= blocks.size() ? null : next);
|
||||
|
||||
inv.setItem(45, downloadPack);
|
||||
inv.setItem(53, switchBrowse);
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenClicked(InventoryClickEvent event) {
|
||||
event.setCancelled(true);
|
||||
if (event.getInventory() != event.getClickedInventory())
|
||||
return;
|
||||
|
||||
ItemStack item = event.getCurrentItem();
|
||||
if (item == null) return;
|
||||
if (MMOUtils.isMetaItem(item, false)) {
|
||||
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Next Page")) {
|
||||
page++; open(); return;
|
||||
}
|
||||
|
||||
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Previous Page")) {
|
||||
page--; open(); return;
|
||||
}
|
||||
|
||||
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Switch to Item Explorer")) {
|
||||
new ItemBrowser(player).open(); return;
|
||||
}
|
||||
|
||||
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Download Default Resourcepack")) {
|
||||
MMOLib.plugin.getVersion().getWrapper().sendJson(player, "[{\"text\":\"Click to download!\",\"color\":\"green\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://mythiccraft.io/resources/MICustomBlockPack.zip\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":[\"\",{\"text\":\"https://mythiccraft.io/resources/MICustomBlockPack.zip\",\"italic\":true,\"color\":\"white\"}]}}]");
|
||||
player.closeInventory();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(item.getType() == Material.CLAY_BALL) {
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL) {
|
||||
player.getInventory().addItem(removeLastLoreLines(item, 3));
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
|
||||
}
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF)
|
||||
new BlockEdition(player, MMOItems.plugin.getCustomBlocks().getBlock(NBTItem.get(item).getInteger("MMOITEMS_BLOCK_ID"))).open();
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack removeLastLoreLines(ItemStack item, int amount) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = meta.getLore();
|
||||
meta.setLore(lore.subList(0, lore.size() - amount));
|
||||
|
||||
ItemStack item1 = item.clone();
|
||||
item1.setItemMeta(meta);
|
||||
return item1;
|
||||
}
|
||||
}
|
@ -24,10 +24,7 @@ import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemBrowser extends PluginInventory {
|
||||
private final Map<String, ItemStack> cached = new HashMap<>();
|
||||
@ -121,7 +118,7 @@ public class ItemBrowser extends PluginInventory {
|
||||
ItemMeta errorMeta = error.getItemMeta();
|
||||
errorMeta.setDisplayName(ChatColor.RED + "- Error -");
|
||||
List<String> errorLore = new ArrayList<>();
|
||||
errorLore.add(ChatColor.GRAY + "" + ChatColor.ITALIC + "An error occured while");
|
||||
errorLore.add(ChatColor.GRAY + "" + ChatColor.ITALIC + "An error occurred while");
|
||||
errorLore.add(ChatColor.GRAY + "" + ChatColor.ITALIC + "trying to generate that item.");
|
||||
errorMeta.setLore(errorLore);
|
||||
error.setItemMeta(errorMeta);
|
||||
@ -193,6 +190,15 @@ public class ItemBrowser extends PluginInventory {
|
||||
previousMeta.setDisplayName(ChatColor.GREEN + "Previous Page");
|
||||
previous.setItemMeta(previousMeta);
|
||||
|
||||
if (type == Type.BLOCK) {
|
||||
ItemStack downloadPack = new ItemStack(Material.HOPPER);
|
||||
ItemMeta downloadMeta = downloadPack.getItemMeta();
|
||||
downloadMeta.setDisplayName(ChatColor.GREEN + "Download Default Resourcepack");
|
||||
downloadMeta.setLore(Arrays.asList(ChatColor.LIGHT_PURPLE + "Only seeing stone blocks?", "", ChatColor.RED + "By downloading the default resourcepack you can", ChatColor.RED + "edit the blocks however you want.", ChatColor.RED + "You will still have to add it to your server!"));
|
||||
downloadPack.setItemMeta(downloadMeta);
|
||||
inv.setItem(45, downloadPack);
|
||||
}
|
||||
|
||||
while (n < slots.length)
|
||||
inv.setItem(slots[n++], noItem);
|
||||
if (!deleteMode)
|
||||
@ -233,7 +239,7 @@ public class ItemBrowser extends PluginInventory {
|
||||
|
||||
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Switch to Block Explorer")) {
|
||||
if (MMOLib.plugin.getVersion().isStrictlyHigher(1, 12))
|
||||
new BlockBrowser(player).open();
|
||||
new ItemBrowser(player, Type.BLOCK).open();
|
||||
else
|
||||
player.sendMessage(ChatColor.RED + "Blocks are only for 1.13+.");
|
||||
return;
|
||||
@ -252,8 +258,19 @@ public class ItemBrowser extends PluginInventory {
|
||||
open();
|
||||
}
|
||||
|
||||
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Download Default Resourcepack")) {
|
||||
MMOLib.plugin.getNMS().sendJson(player, "[{\"text\":\"Click to download!\",\"color\":\"green\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://mythiccraft.io/resources/MICustomBlockPack.zip\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":[\"\",{\"text\":\"https://drive.google.com/uc?id=1FjV7y-2cn8qzSiktZ2CUXmkdjepXdj5N\",\"italic\":true,\"color\":\"white\"}]}}]");
|
||||
player.closeInventory();
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == null && !item.getItemMeta().getDisplayName().equals(ChatColor.RED + "- No type -")) {
|
||||
Type type = MMOItems.plugin.getTypes().get(NBTItem.get(item).getString("typeId"));
|
||||
if (type == Type.BLOCK && !MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) {
|
||||
player.sendMessage(ChatColor.RED + "Blocks are only for 1.13+.");
|
||||
return;
|
||||
}
|
||||
|
||||
new ItemBrowser(player, type).open();
|
||||
}
|
||||
}
|
||||
|
@ -1,200 +0,0 @@
|
||||
package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.block.CustomBlock;
|
||||
import net.Indyuce.mmoitems.api.edition.BlockChatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.plugin.ConfigItem;
|
||||
import net.Indyuce.mmoitems.gui.BlockBrowser;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
|
||||
public class BlockEdition extends PluginInventory {
|
||||
private final ConfigFile config = new ConfigFile("custom-blocks");
|
||||
private final CustomBlock block;
|
||||
|
||||
public BlockEdition(Player player, CustomBlock block) {
|
||||
super(player);
|
||||
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
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();
|
||||
meta.setDisplayName(ChatColor.GREEN + configOptions.name().replace("_", " "));
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
List<String> eventLore = new ArrayList<>();
|
||||
eventLore.add("");
|
||||
if (configOptions.path.equals("lore")) {
|
||||
eventLore.add(ChatColor.GRAY + "- Current Value:");
|
||||
|
||||
List<String> loreList = config.getConfig().getStringList(block.getId() + ".lore");
|
||||
if (loreList.isEmpty())
|
||||
eventLore.add(ChatColor.RED + "No lore.");
|
||||
for (String lore : loreList)
|
||||
eventLore.add(ChatColor.GREEN + MMOLib.plugin.parseColors(lore));
|
||||
} 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"
|
||||
: MMOLib.plugin.parseColors(
|
||||
config.getConfig().getString(block.getId() + "." + configOptions.path, ChatColor.RED + "Default"))));
|
||||
|
||||
eventLore.add("");
|
||||
eventLore.add(ChatColor.YELLOW + AltChar.listDash + " Click to change this value.");
|
||||
eventLore.add(ChatColor.YELLOW + AltChar.listDash + " Right click to remove this value.");
|
||||
meta.setLore(eventLore);
|
||||
blockItem.setItemMeta(meta);
|
||||
|
||||
inv.setItem(configOptions.slot, blockItem);
|
||||
}
|
||||
|
||||
ItemStack back = ConfigItem.BACK.getItem();
|
||||
inv.setItem(40, back);
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenClicked(InventoryClickEvent event) {
|
||||
ItemStack item = event.getCurrentItem();
|
||||
|
||||
event.setCancelled(true);
|
||||
if (event.getInventory() != event.getClickedInventory() || !MMOUtils.isMetaItem(item, false))
|
||||
return;
|
||||
|
||||
if (event.getSlot() == 40)
|
||||
new BlockBrowser(player).open();
|
||||
|
||||
ConfigOptions option = ConfigOptions.getBySlot(event.getSlot());
|
||||
if (option == null)
|
||||
return;
|
||||
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new BlockChatEdition(this, option, block.getId()).enable("Write in the chat the " + option.getChatFormat());
|
||||
|
||||
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"),
|
||||
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");
|
||||
|
||||
private final String path, format;
|
||||
private final Material item;
|
||||
private final int slot;
|
||||
|
||||
private ConfigOptions(String path, Material item, int slot, String format) {
|
||||
this.path = path;
|
||||
this.item = item;
|
||||
this.slot = slot;
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public String getConfigPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public Material getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
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.";
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/*
|
||||
* handles config save and custom block manager reloading
|
||||
*/
|
||||
public void setConfigValue(ConfigFile config, String path, Object value) {
|
||||
config.getConfig().set(path, value);
|
||||
config.save();
|
||||
MMOItems.plugin.getCustomBlocks().reload();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,5 @@
|
||||
package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
@ -23,6 +9,19 @@ import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ItemEdition extends EditionInventory {
|
||||
private static final int[] slots = { 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43 };
|
||||
@ -32,7 +31,7 @@ public class ItemEdition extends EditionInventory {
|
||||
}
|
||||
|
||||
/*
|
||||
* used in the item brower and when using the /mi edit command.
|
||||
* used in the item browser and when using the /mi edit command.
|
||||
*/
|
||||
public ItemEdition(Player player, MMOItem mmoitem, ItemStack cached) {
|
||||
super(player, mmoitem, cached);
|
||||
@ -45,7 +44,7 @@ public class ItemEdition extends EditionInventory {
|
||||
int n = 0;
|
||||
|
||||
/*
|
||||
* it has to determin what stats can be applied first because otherwise
|
||||
* it has to determine what stats can be applied first because otherwise
|
||||
* the for loop will just let some slots empty
|
||||
*/
|
||||
List<ItemStat> appliable = new ArrayList<>(getEdited().getType().getAvailableStats()).stream()
|
||||
|
@ -1,41 +1,33 @@
|
||||
package net.Indyuce.mmoitems.listener;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.block.CustomBlock;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class CustomBlockListener implements Listener {
|
||||
|
||||
private static final Random random = new Random();
|
||||
private static final List<Material> mat = Arrays.asList(Material.GRASS, Material.TALL_GRASS, Material.SEAGRASS, Material.TALL_SEAGRASS,
|
||||
Material.FERN, Material.LARGE_FERN, Material.DEAD_BUSH, Material.SNOW);
|
||||
|
||||
public CustomBlockListener() {
|
||||
if (MMOItems.plugin.getLanguage().replaceMushroomDrops)
|
||||
@ -64,77 +56,29 @@ public class CustomBlockListener implements Listener {
|
||||
: random.nextInt((block.getMaxExpDrop() - block.getMinExpDrop()) + 1) + block.getMinExpDrop()
|
||||
: 0);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void c(PlayerInteractEvent event) {
|
||||
if (!event.hasItem() || event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getHand() != EquipmentSlot.HAND
|
||||
|| event.getClickedBlock().getType().isInteractable())
|
||||
return;
|
||||
if (event.getItem().getType() == Material.CLAY_BALL) {
|
||||
NBTItem nbtItem = MMOLib.plugin.getVersion().getWrapper().getNBTItem(event.getItem());
|
||||
if (nbtItem.getInteger("MMOITEMS_BLOCK_ID") > 160 || nbtItem.getInteger("MMOITEMS_BLOCK_ID") < 1)
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void c(BlockPlaceEvent event) {
|
||||
if (!event.isCancelled() && !isMushroomBlock(event.getBlockPlaced().getType())) {
|
||||
NBTItem nbtItem = MMOLib.plugin.getNMS().getNBTItem(event.getItemInHand());
|
||||
int blockId = nbtItem.getInteger("MMOITEMS_BLOCK_ID");
|
||||
if (blockId > 160 || blockId < 1 || blockId == 54) // checks if block is a custom block
|
||||
return;
|
||||
|
||||
CustomBlock block = MMOItems.plugin.getCustomBlocks().getBlock(nbtItem.getInteger("MMOITEMS_BLOCK_ID"));
|
||||
|
||||
Block modify = mat.contains(event.getClickedBlock().getType()) ? event.getClickedBlock()
|
||||
: event.getClickedBlock().getRelative(event.getBlockFace());
|
||||
|
||||
if (isStandingInside(event.getPlayer().getLocation(), modify.getLocation()))
|
||||
if (MMOItems.plugin.getCustomBlocks().getBlock(blockId) == null) {
|
||||
MMOItems.plugin.getLogger().log(Level.SEVERE, "Could not load custom block '" + blockId + "': " + " Block is not registered.");
|
||||
MMOItems.plugin.getLogger().log(Level.SEVERE, "Try reloading the plugin to solve the issue.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mat.contains(modify.getType()))
|
||||
switch (modify.getType()) {
|
||||
case AIR:
|
||||
case CAVE_AIR:
|
||||
case STRUCTURE_VOID:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
CustomBlock block = MMOItems.plugin.getCustomBlocks().getBlock(blockId); // stores the custom block
|
||||
Block newBlock = event.getBlockPlaced();
|
||||
newBlock.setType(block.getState().getType(), false);
|
||||
newBlock.setBlockData(block.getState().getBlockData(), false);
|
||||
|
||||
Block oldState = modify;
|
||||
Material cachedType = modify.getType();
|
||||
BlockData cachedData = modify.getBlockData();
|
||||
modify.setType(block.getState().getType(), false);
|
||||
modify.setBlockData(block.getState().getBlockData(), false);
|
||||
|
||||
MMOLib.plugin.getVersion().getWrapper().playArmAnimation(event.getPlayer());
|
||||
modify.getWorld().playSound(event.getPlayer().getLocation(), MMOLib.plugin.getVersion().getWrapper().getBlockPlaceSound(modify), 0.8f, 1.0f);
|
||||
|
||||
BlockPlaceEvent bpe = new BlockPlaceEvent(modify, oldState.getState(), event.getClickedBlock(), event.getItem(), event.getPlayer(), true,
|
||||
BlockPlaceEvent bpe = new BlockPlaceEvent(newBlock, newBlock.getState(), event.getBlockAgainst(), event.getItemInHand(), event.getPlayer(), true,
|
||||
EquipmentSlot.HAND);
|
||||
Bukkit.getServer().getPluginManager().callEvent(bpe);
|
||||
if (bpe.isCancelled()) {
|
||||
modify.setType(cachedType);
|
||||
modify.setBlockData(cachedData);
|
||||
} else if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
|
||||
ItemStack stack = event.getItem();
|
||||
stack.setAmount(stack.getAmount() - 1);
|
||||
event.getPlayer().getInventory().setItemInMainHand(stack.getAmount() > 0 ? stack : null);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* else
|
||||
* if(MMOItems.plugin.getCustomBlocks().isMushroomBlock(event.getItem().getType()))
|
||||
* { event.setCancelled(true); Block modify =
|
||||
* event.getClickedBlock().getRelative(event.getBlockFace());
|
||||
*
|
||||
* if(isStandingInside(event.getPlayer().getLocation(),
|
||||
* modify.getLocation())) return; if(modify.getType() != Material.AIR)
|
||||
* return;
|
||||
*
|
||||
* Block oldState = modify; modify.setType(event.getItem().getType(),
|
||||
* false);
|
||||
* modify.setBlockData(event.getItem().getType().createBlockData(),
|
||||
* false);
|
||||
*
|
||||
* BlockPlaceEvent bpe = new BlockPlaceEvent(modify,
|
||||
* oldState.getState(), event.getClickedBlock(), event.getItem(),
|
||||
* event.getPlayer(), true, EquipmentSlot.HAND);
|
||||
* Bukkit.getServer().getPluginManager().callEvent(bpe);
|
||||
* if(bpe.isCancelled()) modify.setType(Material.AIR); }
|
||||
*/
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
@ -147,11 +91,6 @@ public class CustomBlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStandingInside(Location p, Location b) {
|
||||
return (p.getBlockX() == b.getBlockX() && (p.getBlockY() == b.getBlockY() || p.getBlockY() + 1 == b.getBlockY())
|
||||
&& p.getBlockZ() == b.getBlockZ());
|
||||
}
|
||||
|
||||
public static int getPickaxePower(Player player) {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item != null && item.getType() != Material.AIR) {
|
||||
@ -183,6 +122,10 @@ public class CustomBlockListener implements Listener {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean isMushroomBlock(Material material) {
|
||||
return (material == Material.BROWN_MUSHROOM_BLOCK || material == Material.MUSHROOM_STEM || material == Material.RED_MUSHROOM_BLOCK);
|
||||
}
|
||||
|
||||
public class MushroomReplacer implements Listener {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void d(BlockBreakEvent event) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmoitems.listener;
|
||||
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
@ -21,8 +22,6 @@ import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class CustomSoundListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
@ -78,7 +77,7 @@ public class CustomSoundListener implements Listener {
|
||||
playSound(event.getBrokenItem(), "ON_ITEM_BREAK", event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void i(BlockPlaceEvent event) {
|
||||
playSound(event.getItemInHand(), "ON_PLACED", event.getPlayer());
|
||||
}
|
||||
|
@ -1,28 +1,23 @@
|
||||
package net.Indyuce.mmoitems.manager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.block.CustomBlock;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.util.MushroomState;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.block.CustomBlock;
|
||||
import net.Indyuce.mmoitems.api.util.MushroomState;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class BlockManager {
|
||||
private final static List<Integer> downIds = Arrays.asList(new Integer[] { 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
|
||||
91, 92, 93, 94, 95, 96, 97, 98, 99, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
||||
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160 });
|
||||
private final static List<Integer> eastIds = Arrays
|
||||
@ -107,17 +102,21 @@ public class BlockManager {
|
||||
customBlocks.clear();
|
||||
mushroomStateValue.clear();
|
||||
|
||||
FileConfiguration config = new ConfigFile("custom-blocks").getConfig();
|
||||
for (int id = 1; id < 161; id++)
|
||||
if (id != 54 && config.contains("" + id))
|
||||
for (String blockItemId : Type.BLOCK.getConfigFile().getConfig().getKeys(false)) {
|
||||
MMOItem mmoitem = MMOItems.plugin.getItems().getMMOItem(Type.BLOCK, blockItemId).clone();
|
||||
int id = (mmoitem.hasData(ItemStat.BLOCK_ID)) ? (int) ((DoubleData) mmoitem.getData(ItemStat.BLOCK_ID)).generateNewValue() : 0;
|
||||
if (id > 0 && id < 161 && id != 54) {
|
||||
MushroomState state = new MushroomState(getType(id), upIds.contains(id), downIds.contains(id), westIds.contains(id),
|
||||
eastIds.contains(id), southIds.contains(id), northIds.contains(id));
|
||||
CustomBlock customBlock = new CustomBlock(state, mmoitem);
|
||||
register(customBlock);
|
||||
try {
|
||||
MushroomState state = new MushroomState(getType(id), upIds.contains(id), downIds.contains(id), westIds.contains(id),
|
||||
eastIds.contains(id), southIds.contains(id), northIds.contains(id));
|
||||
register(new CustomBlock(state, config.getConfigurationSection("" + id)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load custom block '" + id + "': " + exception.getMessage());
|
||||
}
|
||||
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load custom block '" + blockItemId + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Material getType(int id) {
|
||||
|
@ -1,19 +1,5 @@
|
||||
package net.Indyuce.mmoitems.manager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
@ -25,6 +11,21 @@ import net.Indyuce.mmoitems.stat.LuteAttackEffectStat.LuteAttackEffect;
|
||||
import net.Indyuce.mmoitems.stat.StaffSpiritStat.StaffSpirit;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ConfigManager {
|
||||
|
||||
@ -71,7 +72,8 @@ public class ConfigManager {
|
||||
String name = entries.nextElement().getName();
|
||||
if (name.startsWith("default/crafting-stations/") && name.length() > "default/crafting-stations/".length())
|
||||
Files.copy(MMOItems.plugin.getResource(name),
|
||||
new File(MMOItems.plugin.getDataFolder() + "/crafting-stations", name.split("\\/")[2]).toPath());
|
||||
new File(MMOItems.plugin.getDataFolder() + "/crafting-stations", name.split("\\/")[2])
|
||||
.toPath());
|
||||
}
|
||||
jarFile.close();
|
||||
} catch (IOException exception) {
|
||||
@ -261,7 +263,6 @@ public class ConfigManager {
|
||||
// default general config files -> /MMOItems
|
||||
ITEM_TIERS("item-tiers.yml", "", "item-tiers.yml"),
|
||||
ITEM_TYPES("item-types.yml", "", "item-types.yml", true),
|
||||
CUSTOM_BLOCKS("custom-blocks.yml", "", "custom-blocks.yml"),
|
||||
GEN_TEMPLATES("gen-templates.yml", "", "gen-templates.yml"),
|
||||
DROPS("drops.yml", "", "drops.yml"),
|
||||
ITEM_SETS("item-sets.yml", "", "item-sets.yml"),
|
||||
@ -283,6 +284,7 @@ public class ConfigManager {
|
||||
// default item config files -> /MMOItems/item
|
||||
ARMOR("item/armor.yml", "item", "armor.yml"),
|
||||
AXE("item/axe.yml", "item", "axe.yml"),
|
||||
BLOCK("item/block.yml", "item", "block.yml"),
|
||||
BOW("item/bow.yml", "item", "bow.yml"),
|
||||
CATALYST("item/catalyst.yml", "item", "catalyst.yml"),
|
||||
CONSUMABLE("item/consumable.yml", "item", "consumable.yml"),
|
||||
@ -333,10 +335,52 @@ public class ConfigManager {
|
||||
File file = getFile();
|
||||
if (!file.exists())
|
||||
try {
|
||||
Files.copy(MMOItems.plugin.getResource("default/" + resourceName), file.getAbsoluteFile().toPath());
|
||||
if (!new YamlConverter(file).convert()) {
|
||||
Files.copy(MMOItems.plugin.getResource("default/" + resourceName), file.getAbsoluteFile().toPath());
|
||||
}
|
||||
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class YamlConverter {
|
||||
private File file;
|
||||
|
||||
private final String fileName;
|
||||
|
||||
public YamlConverter(File newConfig) {
|
||||
this.file = newConfig;
|
||||
this.fileName = newConfig.getName();
|
||||
|
||||
}
|
||||
|
||||
public boolean convert() throws IOException {
|
||||
if (!file.exists())
|
||||
if (fileName.equalsIgnoreCase("block.yml") && new File(MMOItems.plugin.getDataFolder(), "custom-blocks.yml").exists()) { // this converts old custom-blocks.yml
|
||||
file.createNewFile(); // creates the file
|
||||
|
||||
YamlConfiguration oldConfig = YamlConfiguration.loadConfiguration(new File(MMOItems.plugin.getDataFolder(), "custom-blocks.yml"));
|
||||
|
||||
YamlConfiguration newConfig = oldConfig;
|
||||
|
||||
for (String id : oldConfig.getKeys(false)) {
|
||||
ConfigurationSection section = newConfig.getConfigurationSection(id);
|
||||
section.set("material", "STONE"); // adds material
|
||||
section.set("block-id", Integer.parseInt(id)); // adds block id
|
||||
for (String node : section.getKeys(false)) {
|
||||
Object value = section.get(node);
|
||||
if (node.equalsIgnoreCase("display-name")) { // converts name format
|
||||
section.set("display-name", null);
|
||||
section.set("name", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
newConfig.save(file);
|
||||
MMOItems.plugin.getLogger().log(Level.CONFIG, "Successfully converted custom-blocks.yml");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,17 @@
|
||||
package net.Indyuce.mmoitems.manager;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.manager.ConfigManager.DefaultFile;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.manager.ConfigManager.DefaultFile;
|
||||
|
||||
public class TypeManager {
|
||||
private final Map<String, Type> map = new LinkedHashMap<>();
|
||||
|
||||
@ -22,7 +21,7 @@ public class TypeManager {
|
||||
*/
|
||||
public void reload() {
|
||||
map.clear();
|
||||
registerAll(Type.ACCESSORY, Type.ARMOR, Type.BOW, Type.CATALYST, Type.CONSUMABLE, Type.CROSSBOW, Type.DAGGER, Type.GAUNTLET, Type.GEM_STONE,
|
||||
registerAll(Type.ACCESSORY, Type.ARMOR, Type.BLOCK, Type.BOW, Type.CATALYST, Type.CONSUMABLE, Type.CROSSBOW, Type.DAGGER, Type.GAUNTLET, Type.GEM_STONE,
|
||||
Type.SKIN, Type.HAMMER, Type.LUTE, Type.MISCELLANEOUS, Type.MUSKET, Type.OFF_CATALYST, Type.ORNAMENT, Type.SPEAR, Type.STAFF,
|
||||
Type.SWORD, Type.TOOL, Type.WHIP);
|
||||
|
||||
@ -67,7 +66,7 @@ public class TypeManager {
|
||||
map.put(type.getId(), type);
|
||||
}
|
||||
|
||||
private void registerAll(Type... types) {
|
||||
public void registerAll(Type... types) {
|
||||
for (Type type : types)
|
||||
register(type);
|
||||
}
|
||||
|
@ -1,20 +1,8 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
@ -34,13 +22,23 @@ import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Abilities extends ItemStat {
|
||||
private final DecimalFormat modifierFormat = new DecimalFormat("0.###");
|
||||
|
||||
public Abilities() {
|
||||
super("ABILITY", new ItemStack(Material.BLAZE_POWDER), "Item Abilities",
|
||||
new String[] { "Make your item cast amazing abilities", "to kill monsters or buff yourself." }, new String[] { "all" });
|
||||
new String[] { "Make your item cast amazing abilities", "to kill monsters or buff yourself." }, new String[] { "!block", "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,19 +1,9 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
@ -29,13 +19,21 @@ import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Commands extends ItemStat {
|
||||
private static final int max = 15;
|
||||
|
||||
public Commands() {
|
||||
super("COMMANDS", new ItemStack(VersionMaterial.COMMAND_BLOCK_MINECART.toMaterial()), "Commands",
|
||||
new String[] { "The commands your item", "performs when right clicked." }, new String[] { "!armor", "!gem_stone", "all" });
|
||||
new String[] { "The commands your item", "performs when right clicked." }, new String[] { "!armor", "!block", "!gem_stone", "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
@ -11,10 +8,12 @@ import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CustomModelData extends DoubleStat implements ProperStat {
|
||||
public CustomModelData() {
|
||||
super("CUSTOM_MODEL_DATA", new ItemStack(Material.PAINTING), "Custom Model Data", new String[] { "Your 1.14+ model data." }, new String[] { "all" });
|
||||
super("CUSTOM_MODEL_DATA", new ItemStack(Material.PAINTING), "Custom Model Data", new String[] { "Your 1.14+ model data." }, new String[] { "!block", "all" });
|
||||
|
||||
if (MMOLib.plugin.getVersion().isBelowOrEqual(1, 13))
|
||||
disable();
|
||||
|
@ -1,9 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
@ -11,10 +7,13 @@ import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
|
||||
public class DefaultDurability extends DoubleStat implements ProperStat {
|
||||
public DefaultDurability() {
|
||||
super("DURABILITY", new ItemStack(Material.FISHING_ROD), "Item Damage", new String[] { "Default item damage. This does &cNOT", "impact the item's max durability." }, new String[] { "all" });
|
||||
super("DURABILITY", new ItemStack(Material.FISHING_ROD), "Item Damage", new String[] { "Default item damage. This does &cNOT", "impact the item's max durability." }, new String[] { "!block", "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,17 +1,7 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
@ -28,11 +18,19 @@ import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemParticles extends ItemStat {
|
||||
public ItemParticles() {
|
||||
super("ITEM_PARTICLES", VersionMaterial.PINK_STAINED_GLASS.toItem(), "Item Particles", new String[] { "The particles displayed when",
|
||||
"holding/wearing your item.", "", ChatColor.BLUE + "A tutorial is available on the wiki." }, new String[] { "all" });
|
||||
"holding/wearing your item.", "", ChatColor.BLUE + "A tutorial is available on the wiki." }, new String[] { "all", "!block" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,13 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.ItemSet;
|
||||
@ -21,12 +13,19 @@ 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;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemSetStat extends StringStat {
|
||||
public ItemSetStat() {
|
||||
super("SET", new ItemStack(Material.LEATHER_CHESTPLATE), "Item Set",
|
||||
new String[] { "Item sets can give to the player extra", "bonuses that depend on how many items", "from the same set your wear." },
|
||||
new String[] { "!gem_stone", "!consumable", "!material", "!miscellaneous", "all" });
|
||||
new String[] { "!gem_stone", "!consumable", "!material", "!block", "!miscellaneous", "all" });
|
||||
}
|
||||
|
||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event, Player player, Type type, String path) {
|
||||
|
@ -1,17 +1,16 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.stat.data.BooleanData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.BooleanStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class LostWhenBroken extends BooleanStat {
|
||||
public LostWhenBroken() {
|
||||
super("WILL_BREAK", new ItemStack(Material.SHEARS), "Lost when Broken?", new String[] { "If set to true, the item will be lost", "once it reaches 0 durability." }, new String[] { "all" });
|
||||
super("WILL_BREAK", new ItemStack(Material.SHEARS), "Lost when Broken?", new String[] { "If set to true, the item will be lost", "once it reaches 0 durability." }, new String[] { "!block", "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,10 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
@ -15,10 +10,14 @@ import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MaximumDurability extends DoubleStat implements ItemRestriction, ProperStat {
|
||||
public MaximumDurability() {
|
||||
super("MAX_DURABILITY", new ItemStack(Material.SHEARS), "Maximum Durability", new String[] { "The amount of uses before your", "item becomes unusable/breaks." }, new String[] { "all" });
|
||||
super("MAX_DURABILITY", new ItemStack(Material.SHEARS), "Maximum Durability", new String[] { "The amount of uses before your", "item becomes unusable/breaks." }, new String[] { "!block", "all"});
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,21 +1,7 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
@ -34,11 +20,23 @@ import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class PermanentEffects extends ItemStat {
|
||||
public PermanentEffects() {
|
||||
super("PERM_EFFECTS", new ItemStack(Material.POTION), "Permanent Effects",
|
||||
new String[] { "The potion effects your", "item grants to the holder." }, new String[] { "!miscellaneous", "all" });
|
||||
new String[] { "The potion effects your", "item grants to the holder." }, new String[] { "!miscellaneous", "!block", "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,16 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
@ -30,11 +19,21 @@ import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class Permission extends ItemStat implements ItemRestriction, ProperStat {
|
||||
public Permission() {
|
||||
super("PERMISSION", new ItemStack(VersionMaterial.OAK_SIGN.toMaterial()), "Permission",
|
||||
new String[] { "The permission needed to use this item." }, new String[] { "all" });
|
||||
new String[] { "The permission needed to use this item." }, new String[] { "!block", "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,16 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
@ -30,11 +19,21 @@ import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RequiredClass extends ItemStat implements ItemRestriction, ProperStat {
|
||||
public RequiredClass() {
|
||||
super("REQUIRED_CLASS", new ItemStack(VersionMaterial.WRITABLE_BOOK.toMaterial()), "Required Class",
|
||||
new String[] { "The class you need to", "profess to use your item." }, new String[] { "all" });
|
||||
new String[] { "The class you need to", "profess to use your item." }, new String[] { "!block", "all"});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,9 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.api.itemgen.RandomStatData;
|
||||
@ -18,6 +14,9 @@ import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class RequiredLevel extends DoubleStat implements ItemRestriction {
|
||||
|
||||
@ -28,7 +27,7 @@ public class RequiredLevel extends DoubleStat implements ItemRestriction {
|
||||
*/
|
||||
public RequiredLevel() {
|
||||
super("REQUIRED_LEVEL", new ItemStack(VersionMaterial.EXPERIENCE_BOTTLE.toMaterial()), "Required Level",
|
||||
new String[] { "The level your item needs", "in order to be used." }, new String[] { "all" });
|
||||
new String[] { "The level your item needs", "in order to be used." }, new String[] { "!block", "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,15 +1,14 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.stat.data.BooleanData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.BooleanStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Unstackable extends BooleanStat {
|
||||
public Unstackable() {
|
||||
@ -20,8 +19,8 @@ public class Unstackable extends BooleanStat {
|
||||
@Override
|
||||
public void whenApplied(MMOItemBuilder item, StatData data) {
|
||||
if (((BooleanData) data).isEnabled()) {
|
||||
item.addItemTag(new ItemTag("MMOITEMS_UNSTACKABLE", true));
|
||||
item.addItemTag(new ItemTag("MMOITEMS_UNSTACKABLE_UUID", UUID.randomUUID().toString()));
|
||||
item.addItemTag(new ItemTag(getNBTPath(), true));
|
||||
item.addItemTag(new ItemTag(getNBTPath() + "_UUID", UUID.randomUUID().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
src/main/java/net/Indyuce/mmoitems/stat/block/BlockID.java
Normal file
22
src/main/java/net/Indyuce/mmoitems/stat/block/BlockID.java
Normal file
@ -0,0 +1,22 @@
|
||||
package net.Indyuce.mmoitems.stat.block;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class BlockID extends DoubleStat {
|
||||
|
||||
public BlockID() {
|
||||
super("BLOCK_ID", new ItemStack(Material.STONE), "Block ID", new String[] { "This value determines which", "custom block will get placed." }, new String[] { "block" });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenApplied(MMOItemBuilder item, StatData data) {
|
||||
super.whenApplied(item, data);
|
||||
item.addItemTag(new ItemTag("CustomModelData", (int) ((DoubleData) data).generateNewValue() +1000));
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package net.Indyuce.mmoitems.stat.block;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.type.StringStat;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class GenTemplate extends StringStat {
|
||||
public GenTemplate() {
|
||||
super("GEN_TEMPLATE", new ItemStack(Material.PAPER), "Gen Template", new String[] { "Can be set to any template", "from gen-templates.yml." }, new String[] { "block" });
|
||||
}
|
||||
}
|
12
src/main/java/net/Indyuce/mmoitems/stat/block/MaxXP.java
Normal file
12
src/main/java/net/Indyuce/mmoitems/stat/block/MaxXP.java
Normal file
@ -0,0 +1,12 @@
|
||||
package net.Indyuce.mmoitems.stat.block;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MaxXP extends DoubleStat {
|
||||
public MaxXP() {
|
||||
super("MAX_XP", new ItemStack(Material.EXPERIENCE_BOTTLE), "Maximum XP", new String[] { "The maximum xp you will receive", "for breaking this custom block." }, new String[] { "block" });
|
||||
}
|
||||
|
||||
}
|
11
src/main/java/net/Indyuce/mmoitems/stat/block/MinXP.java
Normal file
11
src/main/java/net/Indyuce/mmoitems/stat/block/MinXP.java
Normal file
@ -0,0 +1,11 @@
|
||||
package net.Indyuce.mmoitems.stat.block;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MinXP extends DoubleStat {
|
||||
public MinXP() {
|
||||
super("MIN_XP", new ItemStack(Material.EXPERIENCE_BOTTLE), "Minimum XP", new String[] { "The minimum xp you will receive", "for breaking this custom block." }, new String[] { "block" });
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package net.Indyuce.mmoitems.stat.block;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class RequiredPower extends DoubleStat {
|
||||
public RequiredPower() {
|
||||
super("REQUIRED_POWER", new ItemStack(Material.IRON_PICKAXE), "Required Pickaxe Power", new String[] { "The required pickaxe power", "needed to break this custom block." }, new String[] { "block" });
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ public abstract class AttributeStat extends DoubleStat {
|
||||
}
|
||||
|
||||
public AttributeStat(String id, ItemStack item, String name, String[] lore, Attribute attribute, double offset) {
|
||||
super(id, item, name, lore, new String[] { "!consumable", "!miscellaneous", "all" });
|
||||
super(id, item, name, lore, new String[] { "!consumable", "!block", "!miscellaneous", "all" });
|
||||
|
||||
this.offset = offset;
|
||||
this.attribute = attribute;
|
||||
|
@ -27,10 +27,11 @@ import java.util.List;
|
||||
|
||||
public class DoubleStat extends ItemStat implements Upgradable {
|
||||
public DoubleStat(String id, ItemStack item, String name, String[] lore) {
|
||||
super(id, item, name, lore, new String[] { "!miscellaneous", "all" });
|
||||
super(id, item, name, lore, new String[] { "!miscellaneous", "!block", "all" });
|
||||
}
|
||||
|
||||
public DoubleStat(String id, ItemStack item, String name, String[] lore, String[] types, Material... materials) {
|
||||
|
||||
super(id, item, name, lore, types, materials);
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
@ -16,67 +8,18 @@ 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.*;
|
||||
import net.Indyuce.mmoitems.stat.block.*;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ItemStat {
|
||||
public static final ItemStat MATERIAL = new MaterialStat(),
|
||||
@ -84,21 +27,29 @@ public abstract class ItemStat {
|
||||
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",
|
||||
// block stats
|
||||
public static final ItemStat BLOCK_ID = new BlockID(), REQUIRED_POWER = new RequiredPower(), MIN_XP = new MinXP(),
|
||||
MAX_XP = new MaxXP(), GEN_TEMPLATE = new GenTemplate();
|
||||
|
||||
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", new String[] { "!block", "all" }, "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_REPAIRING = new DisableStat("REPAIRING", Material.ANVIL, "Disable Repairing",
|
||||
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", new String[] { "!block", "all" }, "Players can't enchant this item."),
|
||||
DISABLE_ADVANCED_ENCHANTS = new DisableAdvancedEnchantments();
|
||||
public static final ItemStat DISABLE_REPAIRING = new DisableStat("REPAIRING", Material.ANVIL, "Disable Repairing", new String[] { "!block", "all" },
|
||||
"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.");
|
||||
@ -107,32 +58,41 @@ public abstract class ItemStat {
|
||||
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." },
|
||||
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 %." },
|
||||
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 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", "!block", "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 %." },
|
||||
new String[] { "!miscellaneous", "!block", "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", "!block", "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", "!block", "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", "!block", "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." },
|
||||
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 (%)." });
|
||||
new String[] { "!miscellaneous", "!block", "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", "!block", "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", "!block", "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", "!block", "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",
|
||||
@ -212,13 +172,14 @@ public abstract class ItemStat {
|
||||
"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." },
|
||||
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 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", "!block", "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 SUCCESS_RATE = new SuccessRate();
|
||||
public static final ItemStat COMPATIBLE_TYPES = new CompatibleTypes();
|
||||
@ -305,7 +266,7 @@ public abstract class ItemStat {
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -114,7 +114,7 @@ custom-blocks:
|
||||
# with silk-touch.
|
||||
# HIGHLY Recommended for servers that use
|
||||
# custom blocks, as the mushroom blocks can BREAK everything.
|
||||
replace-mushroom-drops: false
|
||||
replace-mushroom-drops: true
|
||||
|
||||
# Use this option if your chat management plugin is having
|
||||
# conflicts with the MMOItems chat input feature. This will
|
||||
|
@ -1,15 +0,0 @@
|
||||
1:
|
||||
display-name: "&aMy First Custom Block"
|
||||
lore:
|
||||
- "&7Wow... It's possible!"
|
||||
- "&7That's awesome!"
|
||||
required-power: 2
|
||||
min-xp: 10
|
||||
max-xp: 20
|
||||
gen-template: basic-template
|
||||
2:
|
||||
display-name: "&bMy Second Custom Block"
|
||||
3:
|
||||
lore:
|
||||
- "I have no display name."
|
||||
- "I only have a lore!"
|
@ -291,6 +291,20 @@ GEM_STONE:
|
||||
- '{range}&8- &7Lvl Range: &e#range#'
|
||||
- '{tier}&8- &7Item Tier: #prefix##tier#'
|
||||
|
||||
BLOCK:
|
||||
display: STONE:0
|
||||
name: 'Block'
|
||||
unident-item:
|
||||
name: '&f#prefix#Unidentified Block'
|
||||
lore:
|
||||
- '&7This item is unidentified. I must'
|
||||
- '&7find a way to identify it!'
|
||||
- '{tier}'
|
||||
- '{tier}&8Item Info:'
|
||||
- '{range}&8- &7Lvl Range: &e#range#'
|
||||
- '{tier}&8- &7Item Tier: #prefix##tier#'
|
||||
|
||||
|
||||
# Default subtypes
|
||||
GREATSWORD:
|
||||
display: DIAMOND_SWORD
|
||||
|
21
src/main/resources/default/item/block.yml
Normal file
21
src/main/resources/default/item/block.yml
Normal file
@ -0,0 +1,21 @@
|
||||
'1':
|
||||
name: '&aMy First Custom Block'
|
||||
lore:
|
||||
- '&7Wow... It''s possible!'
|
||||
- '&7That''s awesome!'
|
||||
required-power: 2
|
||||
min-xp: 10
|
||||
max-xp: 20
|
||||
gen-template: basic-template
|
||||
material: STONE
|
||||
block-id: 1.0
|
||||
'2':
|
||||
name: '&bMy Second Custom Block'
|
||||
material: STONE
|
||||
block-id: 2.0
|
||||
'3':
|
||||
lore:
|
||||
- I have no display name.
|
||||
- I only have a lore!
|
||||
material: STONE
|
||||
block-id: 3.0
|
Loading…
Reference in New Issue
Block a user