mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Boosted, limited and shop items new format recognition
This commit is contained in:
parent
6a539686dd
commit
0ee8b59401
@ -1,7 +1,5 @@
|
||||
package com.gamingmesh.jobs;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -10,8 +8,8 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gamingmesh.jobs.CMILib.CMIEnchantment;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
@ -20,16 +18,19 @@ import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobItems;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.CMIList;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.NBT.CMINBT;
|
||||
|
||||
public final class ItemBoostManager {
|
||||
|
||||
private static final Map<String, JobItems> ITEMS = new HashMap<>();
|
||||
private static final Map<String, JobItems> LEGACY = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
static boolean informed = false;
|
||||
|
||||
public static void load() {
|
||||
ConfigReader cfg;
|
||||
try {
|
||||
@ -40,50 +41,6 @@ public final class ItemBoostManager {
|
||||
}
|
||||
|
||||
ITEMS.clear();
|
||||
LEGACY.clear();
|
||||
|
||||
// Converting from existing records in Jobs from old format which was located in jobConfig.yml file
|
||||
boolean save = false;
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
for (Entry<String, JobItems> oneI : one.getItemBonus().entrySet()) {
|
||||
JobItems item = oneI.getValue();
|
||||
|
||||
String name = one.getName() + "_" + oneI.getKey();
|
||||
org.bukkit.inventory.ItemStack stack = item.getItemStack(null);
|
||||
|
||||
cfg.getC().set(name + ".id", CMIMaterial.get(stack).toString());
|
||||
cfg.getC().set(name + ".jobs", Arrays.asList(one.getName()));
|
||||
if (stack.hasItemMeta()) {
|
||||
cfg.getC().set(name + ".name", stack.getItemMeta().hasDisplayName() ? CMIChatColor.deColorize(stack.getItemMeta().getDisplayName()) : null);
|
||||
cfg.getC().set(name + ".lore", stack.getItemMeta().hasLore() ? CMIChatColor.deColorize(stack.getItemMeta().getLore()) : null);
|
||||
}
|
||||
List<String> ench = new ArrayList<>();
|
||||
for (Entry<Enchantment, Integer> oneE : stack.getEnchantments().entrySet()) {
|
||||
ench.add(CMIEnchantment.get(oneE.getKey()) + "=" + oneE.getValue());
|
||||
}
|
||||
cfg.getC().set(name + ".enchants", ench);
|
||||
for (CurrencyType oneC : CurrencyType.values()) {
|
||||
cfg.getC().set(name + "." + oneC.toString().toLowerCase() + "Boost", ((int) (item.getBoost().get(oneC) * 100D) / 100D) + 1D);
|
||||
}
|
||||
save = true;
|
||||
}
|
||||
|
||||
one.getItemBonus().clear();
|
||||
}
|
||||
|
||||
if (save) {
|
||||
try {
|
||||
cfg.getC().save(new File(Jobs.getFolder(), "boostedItems.yml"));
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
try {
|
||||
cfg = new ConfigReader(Jobs.getInstance(), "boostedItems.yml");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> keys = cfg.getC().getKeys(false);
|
||||
|
||||
@ -92,19 +49,10 @@ public final class ItemBoostManager {
|
||||
"",
|
||||
"Name which will be used to identify this particular item boost",
|
||||
"This is EXAMPLE boost and will be ignored");
|
||||
cfg.addComment("exampleBoost.id", "Item Id which can be any material name as of 1.13 update",
|
||||
"This is only used when performing command like /jobs give, but boost itself is not dependent on item type",
|
||||
cfg.addComment("exampleBoost.ItemStack", "Item information, on usage read more at https://www.zrips.net/cmi/commands/icwol/",
|
||||
"You can use ingame command /jobs edititemboost to give particular boost to any item you are holding");
|
||||
cfg.get("exampleBoost.id", "Golden_shovel");
|
||||
cfg.addComment("exampleBoost.name", "(Optional) Item custom name", "Custom colors like &2 &5 can be used");
|
||||
cfg.get("exampleBoost.name", "&2Custom item name");
|
||||
cfg.addComment("exampleBoost.lore", "(Optional) Item custom lore", "Same as name, supports color codes");
|
||||
cfg.get("exampleBoost.lore", Arrays.asList("&2Some random", "&5Lore with some", "&7Colors"));
|
||||
cfg.addComment("exampleBoost.enchants", "(Optional) Item custom enchants",
|
||||
"All enchantment names can be found https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html");
|
||||
cfg.get("exampleBoost.enchants", Arrays.asList("FIRE_ASPECT=1", "DAMAGE_ALL=1"));
|
||||
cfg.addComment("exampleBoost.leather-color", "(Optional) Leather armour colors (0-255)");
|
||||
cfg.get("exampleBoost.leather-color", "82,34,125");
|
||||
cfg.get("exampleBoost.ItemStack", "Golden_shovel;n{&2Custom_item_name};l{&2Some_random\\n&5Lore_with_some\\n{#pink}Colors};FIRE_ASPECT:1,DAMAGE_ALL:1");
|
||||
|
||||
cfg.addComment("exampleBoost.moneyBoost", "[Required] Money boost: 1.1 is equals 10% more income when 0.9 is equals 10% less from base income");
|
||||
for (CurrencyType oneC : CurrencyType.values()) {
|
||||
cfg.get("exampleBoost." + oneC.toString().toLowerCase() + "Boost", 1D);
|
||||
@ -149,12 +97,50 @@ public final class ItemBoostManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<String> lore = cfg.get(one + ".lore", Arrays.asList(""));
|
||||
for (int a = 0; a < lore.size(); a++) {
|
||||
lore.set(a, CMIChatColor.translate(lore.get(a)));
|
||||
BoostMultiplier b = new BoostMultiplier();
|
||||
for (CurrencyType oneC : CurrencyType.values()) {
|
||||
String typeName = oneC.toString().toLowerCase();
|
||||
|
||||
if (cfg.getC().isDouble(one + "." + typeName + "Boost"))
|
||||
b.add(oneC, cfg.get(one + "." + typeName + "Boost", 1D) - 1);
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
String node = one.toLowerCase();
|
||||
|
||||
JobItems jitem = new JobItems(node);
|
||||
|
||||
jitem.setJobs(jobs);
|
||||
jitem.setBoostMultiplier(b);
|
||||
|
||||
if (cfg.getC().isInt(one + ".levelFrom"))
|
||||
jitem.setFromLevel(cfg.get(one + ".levelFrom", 0));
|
||||
|
||||
if (cfg.getC().isInt(one + ".levelUntil"))
|
||||
jitem.setUntilLevel(cfg.get(one + ".levelUntil", 1000));
|
||||
|
||||
// Old format, should be removed down the line
|
||||
if (cfg.getC().isString(one + ".id")) {
|
||||
|
||||
if (!informed) {
|
||||
CMIMessages.consoleMessage("&5Update boosted item " + one + " item section to use new 'ItemStack' format");
|
||||
informed = true;
|
||||
}
|
||||
|
||||
CMIMaterial mat = cfg.getC().isString(one + ".id") ? CMIMaterial.get(cfg.get(one + ".id", "Stone")) : null;
|
||||
|
||||
String name = cfg.getC().isString(one + ".name") ? cfg.get(one + ".name", "") : null;
|
||||
|
||||
if (mat == null) {
|
||||
CMIMessages.consoleMessage("&cCould not determine boosted item material (" + node + ")");
|
||||
continue;
|
||||
}
|
||||
List<String> lore = cfg.get(one + ".lore", new ArrayList<String>());
|
||||
for (int a = 0; a < lore.size(); a++) {
|
||||
lore.set(a, CMIChatColor.translate(lore.get(a)).replace(" ", "_"));
|
||||
}
|
||||
|
||||
StringBuilder enchants = new StringBuilder();
|
||||
|
||||
if (cfg.getC().isList(one + ".enchants"))
|
||||
for (String eachLine : cfg.get(one + ".enchants", Arrays.asList(""))) {
|
||||
String[] split = eachLine.split("=", 2);
|
||||
@ -162,6 +148,10 @@ public final class ItemBoostManager {
|
||||
continue;
|
||||
|
||||
Enchantment ench = CMIEnchantment.getEnchantment(split[0]);
|
||||
|
||||
if (ench == null)
|
||||
continue;
|
||||
|
||||
int level = -1;
|
||||
|
||||
if (split.length > 1) {
|
||||
@ -172,60 +162,43 @@ public final class ItemBoostManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (ench != null && level != -1)
|
||||
enchants.put(ench, level);
|
||||
if (level == -1)
|
||||
continue;
|
||||
|
||||
if (!enchants.toString().isEmpty())
|
||||
enchants.append(",");
|
||||
enchants.append(split[0] + ":" + level);
|
||||
|
||||
}
|
||||
|
||||
BoostMultiplier b = new BoostMultiplier();
|
||||
for (CurrencyType oneC : CurrencyType.values()) {
|
||||
String typeName = oneC.toString().toLowerCase();
|
||||
|
||||
if (cfg.getC().isDouble(one + "." + typeName + "Boost"))
|
||||
b.add(oneC, cfg.get(one + "." + typeName + "Boost", 1D) - 1);
|
||||
}
|
||||
|
||||
CMIMaterial mat = cfg.getC().isString(one + ".id") ? CMIMaterial.get(cfg.get(one + ".id", "Stone")) : null;
|
||||
|
||||
String name = cfg.getC().isString(one + ".name") ? cfg.get(one + ".name", "") : null;
|
||||
String node = one.toLowerCase();
|
||||
|
||||
Color leatherColor = null;
|
||||
String lc = cfg.getC().getString(one + ".leather-color", "");
|
||||
if (!lc.isEmpty()) {
|
||||
String[] split = lc.split(",", 3);
|
||||
|
||||
if (split.length != 0) {
|
||||
int red = Integer.parseInt(split[0]);
|
||||
int green = split.length > 0 ? Integer.parseInt(split[1]) : 0;
|
||||
int blue = split.length > 1 ? Integer.parseInt(split[2]) : 0;
|
||||
String itemSring = mat.toString();
|
||||
if (name != null)
|
||||
itemSring += ";n{" + name.replace(" ", "_") + "}";
|
||||
|
||||
try {
|
||||
leatherColor = Color.fromRGB(red, green, blue);
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
if (!lore.isEmpty())
|
||||
itemSring += ";l{" + CMIList.listToString(lore, "\\n") + "}";
|
||||
|
||||
if (lc != null)
|
||||
itemSring += ";" + lc;
|
||||
|
||||
if (!enchants.toString().isEmpty())
|
||||
itemSring += ";" + enchants.toString();
|
||||
|
||||
jitem.setItemString(itemSring);
|
||||
} else if (cfg.getC().isString(one + ".ItemStack")) {
|
||||
String itemString = cfg.get(one + ".ItemStack", cfg.getC().getString(one + ".ItemStack"));
|
||||
CMIItemStack item = CMIItemStack.deserialize(itemString, null);
|
||||
|
||||
if (item == null || item.getCMIType().isNone()) {
|
||||
CMIMessages.consoleMessage("&cInvalid ItemStack for boosted item (" + node + ")");
|
||||
continue;
|
||||
}
|
||||
jitem.setItemString(itemString);
|
||||
}
|
||||
|
||||
JobItems item = new JobItems(node, mat, 1, name, lore, enchants, b, jobs, null, leatherColor);
|
||||
|
||||
if (cfg.getC().isInt(one + ".levelFrom"))
|
||||
item.setFromLevel(cfg.get(one + ".levelFrom", 0));
|
||||
|
||||
if (cfg.getC().isInt(one + ".levelUntil"))
|
||||
item.setUntilLevel(cfg.get(one + ".levelUntil", 1000));
|
||||
|
||||
for (Job oneJ : jobs) {
|
||||
oneJ.getItemBonus().put(node, item);
|
||||
}
|
||||
|
||||
// Lets add into legacy map
|
||||
String[] split = one.split("_", 2);
|
||||
if (split.length > 1) {
|
||||
item.setLegacyKey(split[1].toLowerCase());
|
||||
LEGACY.put(item.getLegacyKey(), item);
|
||||
}
|
||||
|
||||
ITEMS.put(node, item);
|
||||
ITEMS.put(node, jitem);
|
||||
}
|
||||
|
||||
cfg.save();
|
||||
@ -270,10 +243,7 @@ public final class ItemBoostManager {
|
||||
* @return {@link JobItems}
|
||||
*/
|
||||
public static JobItems getItemByKey(String key) {
|
||||
key = key.toLowerCase();
|
||||
|
||||
JobItems item = ITEMS.get(key);
|
||||
return item != null ? item : LEGACY.get(key);
|
||||
return ITEMS.get(key.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -283,10 +253,43 @@ public final class ItemBoostManager {
|
||||
return ITEMS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current cached map of legacy items.
|
||||
*/
|
||||
public static Map<String, JobItems> getLegacyItems() {
|
||||
return LEGACY;
|
||||
private static final String jobsItemBoost = "JobsItemBoost";
|
||||
|
||||
public static boolean containsItemBoostByNBT(ItemStack item) {
|
||||
return item != null && new CMINBT(item).hasNBT(jobsItemBoost);
|
||||
}
|
||||
|
||||
public static JobItems getJobsItemByNbt(ItemStack item) {
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
Object itemName = new CMINBT(item).getString(jobsItemBoost);
|
||||
|
||||
if (itemName == null || itemName.toString().isEmpty()) {
|
||||
// Checking old boost items and converting to new format if needed
|
||||
if (new CMINBT(item).hasNBT(jobsItemBoost)) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
itemName = new CMINBT(item).getString(jobsItemBoost + "." + one.getName());
|
||||
if (itemName != null) {
|
||||
JobItems b = getItemByKey(itemName.toString());
|
||||
if (b != null) {
|
||||
ItemStack ic = (ItemStack) new CMINBT(item).setString(jobsItemBoost, b.getNode());
|
||||
item.setItemMeta(ic.getItemMeta());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemName == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
return getItemByKey(itemName.toString());
|
||||
}
|
||||
|
||||
public static ItemStack applyNBT(ItemStack item, String node) {
|
||||
if (item == null)
|
||||
return null;
|
||||
return (ItemStack) new CMINBT(item).setString(jobsItemBoost, node);
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.NBT.CMINBT;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
@ -1073,46 +1074,25 @@ public class PlayerManager {
|
||||
JobProgression progress = getJobsPlayer(player).getJobProgression(job);
|
||||
|
||||
for (JobItems jitem : jitems) {
|
||||
if (jitem != null && jitem.getJobs().contains(job)) {
|
||||
if (jitem == null)
|
||||
continue;
|
||||
if (!jitem.getJobs().contains(job))
|
||||
continue;
|
||||
|
||||
data.add(jitem.getBoost(progress));
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private final String jobsItemBoost = "JobsItemBoost";
|
||||
|
||||
@Deprecated
|
||||
public boolean containsItemBoostByNBT(ItemStack item) {
|
||||
return item != null && new CMINBT(item).hasNBT(jobsItemBoost);
|
||||
return containsItemBoostByNBT(item);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public JobItems getJobsItemByNbt(ItemStack item) {
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
Object itemName = new CMINBT(item).getString(jobsItemBoost);
|
||||
|
||||
if (itemName == null || itemName.toString().isEmpty()) {
|
||||
// Checking old boost items and converting to new format if needed
|
||||
if (new CMINBT(item).hasNBT(jobsItemBoost)) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
itemName = new CMINBT(item).getString(jobsItemBoost + "." + one.getName());
|
||||
if (itemName != null) {
|
||||
JobItems b = ItemBoostManager.getItemByKey(itemName.toString());
|
||||
if (b != null) {
|
||||
ItemStack ic = (ItemStack) new CMINBT(item).setString(jobsItemBoost, b.getNode());
|
||||
item.setItemMeta(ic.getItemMeta());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemName == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
return ItemBoostManager.getItemByKey(itemName.toString());
|
||||
return ItemBoostManager.getJobsItemByNbt(item);
|
||||
}
|
||||
|
||||
public enum BoostOf {
|
||||
|
@ -14,6 +14,9 @@ import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import com.gamingmesh.jobs.stuff.GiveItem;
|
||||
|
||||
import net.Zrips.CMILib.Items.CMIAsyncHead;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
|
||||
public class give implements Cmd {
|
||||
|
||||
private enum actions {
|
||||
@ -72,17 +75,27 @@ public class give implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = player;
|
||||
|
||||
switch (name) {
|
||||
case items:
|
||||
JobItems jItem = ItemBoostManager.getItemByKey(itemName);
|
||||
ItemStack item = jItem == null ? null : jItem.getItemStack(player);
|
||||
|
||||
if (item == null) {
|
||||
CMIAsyncHead ahead = new CMIAsyncHead() {
|
||||
@Override
|
||||
public void afterAsyncUpdate(ItemStack item) {
|
||||
GiveItem.giveItemForPlayer(p, ItemBoostManager.applyNBT(item, jItem.getNode()));
|
||||
}
|
||||
};
|
||||
|
||||
CMIItemStack item = jItem == null ? null : jItem.getItemStack(player, ahead);
|
||||
|
||||
if (jItem == null || item == null) {
|
||||
Language.sendMessage(sender, "command.give.output.noitem");
|
||||
return true;
|
||||
}
|
||||
|
||||
GiveItem.giveItemForPlayer(player, item);
|
||||
if (!ahead.isAsyncHead())
|
||||
GiveItem.giveItemForPlayer(player, ItemBoostManager.applyNBT(item.getItemStack(), jItem.getNode()));
|
||||
break;
|
||||
case limiteditems:
|
||||
if (job == null) {
|
||||
@ -91,14 +104,23 @@ public class give implements Cmd {
|
||||
}
|
||||
|
||||
JobLimitedItems jLItem = job.getLimitedItems().get(itemName.toLowerCase());
|
||||
ItemStack limItem = jLItem == null ? null : jLItem.getItemStack(player);
|
||||
|
||||
ahead = new CMIAsyncHead() {
|
||||
@Override
|
||||
public void afterAsyncUpdate(ItemStack item) {
|
||||
GiveItem.giveItemForPlayer(p, item);
|
||||
}
|
||||
};
|
||||
|
||||
CMIItemStack limItem = jLItem == null ? null : jLItem.getItemStack(player, ahead);
|
||||
|
||||
if (limItem == null) {
|
||||
Language.sendMessage(sender, "command.give.output.noitem");
|
||||
return true;
|
||||
}
|
||||
|
||||
GiveItem.giveItemForPlayer(player, limItem);
|
||||
if (!ahead.isAsyncHead())
|
||||
GiveItem.giveItemForPlayer(player, limItem.getItemStack());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -52,9 +52,11 @@ import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||
import com.gamingmesh.jobs.container.JobPermission;
|
||||
import com.gamingmesh.jobs.container.Quest;
|
||||
import com.gamingmesh.jobs.container.QuestObjective;
|
||||
import com.gamingmesh.jobs.listeners.JobsListener;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.CMIList;
|
||||
import net.Zrips.CMILib.Entities.CMIEntityType;
|
||||
import net.Zrips.CMILib.Equations.ParseError;
|
||||
import net.Zrips.CMILib.Equations.Parser;
|
||||
@ -1317,64 +1319,6 @@ public class ConfigManager {
|
||||
}
|
||||
job.setCommands(jobCommand);
|
||||
|
||||
// Items **OUTDATED** Moved to ItemBoostManager!!
|
||||
HashMap<String, JobItems> jobItems = new HashMap<>();
|
||||
ConfigurationSection itemsSection = jobSection.getConfigurationSection("items");
|
||||
if (itemsSection != null) {
|
||||
for (String itemKey : itemsSection.getKeys(false)) {
|
||||
ConfigurationSection itemSection = itemsSection.getConfigurationSection(itemKey);
|
||||
|
||||
String node = itemKey.toLowerCase();
|
||||
if (itemSection == null) {
|
||||
log.warning("Job " + jobConfigName + " has an invalid item key " + itemKey + "!");
|
||||
continue;
|
||||
}
|
||||
int id = itemSection.getInt("id");
|
||||
|
||||
String name = null;
|
||||
if (itemSection.isString("name"))
|
||||
name = itemSection.getString("name");
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (itemSection.contains("lore"))
|
||||
for (String eachLine : itemSection.getStringList("lore")) {
|
||||
lore.add(CMIChatColor.translate(eachLine));
|
||||
}
|
||||
|
||||
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||
if (itemSection.contains("enchants"))
|
||||
for (String eachLine : itemSection.getStringList("enchants")) {
|
||||
|
||||
if (!eachLine.contains("="))
|
||||
continue;
|
||||
|
||||
Enchantment ench = CMIEnchantment.getEnchantment(eachLine.split("=")[0]);
|
||||
Integer level = -1;
|
||||
try {
|
||||
level = Integer.parseInt(eachLine.split("=")[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ench != null && level != -1)
|
||||
enchants.put(ench, level);
|
||||
}
|
||||
|
||||
BoostMultiplier b = new BoostMultiplier();
|
||||
if (itemSection.isDouble("moneyBoost"))
|
||||
b.add(CurrencyType.MONEY, itemSection.getDouble("moneyBoost") - 1);
|
||||
if (itemSection.isDouble("pointBoost"))
|
||||
b.add(CurrencyType.POINTS, itemSection.getDouble("pointBoost") - 1);
|
||||
if (itemSection.isDouble("expBoost"))
|
||||
b.add(CurrencyType.EXP, itemSection.getDouble("expBoost") - 1);
|
||||
|
||||
jobItems.put(node.toLowerCase(), new JobItems(node, CMIMaterial.get(id), 1, name, lore, enchants, b, new ArrayList<Job>()));
|
||||
}
|
||||
|
||||
CMIMessages.consoleMessage("&cRemove Items section from " + jobConfigName + " job, as of Jobs 4.10.0 version this was moved to boostedItems.yml file!");
|
||||
}
|
||||
job.setItemBonus(jobItems);
|
||||
|
||||
// Limited Items
|
||||
Map<String, JobLimitedItems> jobLimitedItems = new HashMap<>();
|
||||
ConfigurationSection limitedItemsSection = jobSection.getConfigurationSection("limitedItems");
|
||||
@ -1406,11 +1350,12 @@ public class ConfigManager {
|
||||
|
||||
List<String> lore = itemSection.getStringList("lore");
|
||||
|
||||
if (lore != null)
|
||||
for (int a = 0; a < lore.size(); a++) {
|
||||
lore.set(a, CMIChatColor.translate(lore.get(a)));
|
||||
lore.set(a, CMIChatColor.translate(lore.get(a).replace(" ", "_")));
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
StringBuilder enchants = new StringBuilder();
|
||||
for (String eachLine : itemSection.getStringList("enchants")) {
|
||||
String[] split = eachLine.split("=", 2);
|
||||
if (split.length == 0)
|
||||
@ -1429,11 +1374,30 @@ public class ConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (level != -1)
|
||||
enchants.put(ench, level);
|
||||
if (level == -1)
|
||||
continue;
|
||||
|
||||
if (!enchants.toString().isEmpty())
|
||||
enchants.append(",");
|
||||
enchants.append(split[0] + ":" + level);
|
||||
}
|
||||
|
||||
jobLimitedItems.put(node, new JobLimitedItems(node, mat, 1, itemSection.getString("name"), lore, enchants, itemSection.getInt("level")));
|
||||
String itemString = "";
|
||||
|
||||
String name = CMIChatColor.translate(itemSection.getString("name"));
|
||||
|
||||
if (name != null)
|
||||
itemString += ";n{" + name.replace(" ", "_") + "}";
|
||||
|
||||
if (lore != null)
|
||||
for (int b = 0; b < lore.size(); b++) {
|
||||
lore.set(b, CMIChatColor.translate(lore.get(b).replace(" ", "_")));
|
||||
}
|
||||
|
||||
if (lore != null && !lore.isEmpty())
|
||||
itemString += ";l{" + CMIList.listToString(lore, "\\n") + "}";
|
||||
|
||||
jobLimitedItems.put(node, new JobLimitedItems(node, itemString, itemSection.getInt("level")));
|
||||
|
||||
if (!informedLimited) {
|
||||
CMIMessages.consoleMessage("&5Update " + jobConfigName
|
||||
@ -1450,11 +1414,12 @@ public class ConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
jobLimitedItems.put(node, new JobLimitedItems(node, limitedItem.getItemStack(), itemSection.getInt("level")));
|
||||
jobLimitedItems.put(node, new JobLimitedItems(node, itemSection.getString("ItemStack"), itemSection.getInt("level")));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
job.setLimitedItems(jobLimitedItems);
|
||||
|
||||
job.setCmdOnJoin(jobSection.getStringList("cmd-on-join"));
|
||||
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -16,31 +15,28 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIEnchantment;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobItems;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.ShopItem;
|
||||
import com.gamingmesh.jobs.stuff.GiveItem;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.CMIList;
|
||||
import net.Zrips.CMILib.GUI.CMIGui;
|
||||
import net.Zrips.CMILib.GUI.CMIGuiButton;
|
||||
import net.Zrips.CMILib.GUI.GUIManager.GUIClickType;
|
||||
import net.Zrips.CMILib.GUI.GUIManager.GUIRows;
|
||||
import net.Zrips.CMILib.Items.CMIAsyncHead;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ShopManager {
|
||||
@ -110,7 +106,15 @@ public class ShopManager {
|
||||
|
||||
mainCycle: for (ShopItem item : ls) {
|
||||
List<String> lore = new ArrayList<>();
|
||||
CMIMaterial mat = CMIMaterial.get(item.getIconMaterial());
|
||||
|
||||
CMIAsyncHead ahead = new CMIAsyncHead() {
|
||||
@Override
|
||||
public void afterAsyncUpdate(ItemStack item) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
CMIItemStack icon = item.getIcon(player, ahead);
|
||||
|
||||
boolean hiddenLore = false;
|
||||
|
||||
@ -124,26 +128,18 @@ public class ShopManager {
|
||||
|
||||
if (item.isHideIfNoEnoughPoints() && item.getPointPrice() > 0 &&
|
||||
jPlayer.getPointsData().getCurrentPoints() < item.getPointPrice()) {
|
||||
mat = CMIMaterial.STONE_BUTTON;
|
||||
icon = CMIMaterial.STONE_BUTTON.newCMIItemStack();
|
||||
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
||||
hiddenLore = true;
|
||||
}
|
||||
|
||||
if (mat == CMIMaterial.NONE)
|
||||
mat = CMIMaterial.STONE_BUTTON;
|
||||
|
||||
ItemStack guiItem = mat.newItemStack();
|
||||
ItemStack guiItem = icon.getItemStack();
|
||||
ItemMeta meta = guiItem.getItemMeta();
|
||||
if (meta == null)
|
||||
continue;
|
||||
|
||||
guiItem.setAmount(item.getIconAmount());
|
||||
|
||||
if (item.getIconName() != null)
|
||||
meta.setDisplayName(item.getIconName());
|
||||
|
||||
if (!hiddenLore) {
|
||||
lore.addAll(item.getIconLore());
|
||||
lore.addAll(icon.getLore());
|
||||
|
||||
if (item.getPointPrice() > 0) {
|
||||
String color = item.getPointPrice() >= points ? "" : Jobs.getLanguage().getMessage("command.shop.info.haveColor");
|
||||
@ -190,32 +186,6 @@ public class ShopManager {
|
||||
|
||||
meta.setLore(lore);
|
||||
|
||||
if (item.getCustomHead() != null) {
|
||||
guiItem = CMIMaterial.PLAYER_HEAD.newItemStack(item.getIconAmount());
|
||||
|
||||
SkullMeta skullMeta = (SkullMeta) guiItem.getItemMeta();
|
||||
if (skullMeta == null)
|
||||
continue;
|
||||
|
||||
if (item.getIconName() != null)
|
||||
skullMeta.setDisplayName(item.getIconName());
|
||||
|
||||
skullMeta.setLore(lore);
|
||||
|
||||
if (item.isHeadOwner()) {
|
||||
Util.setSkullOwner(skullMeta, jPlayer.getPlayer());
|
||||
} else {
|
||||
try {
|
||||
Util.setSkullOwner(skullMeta, Bukkit.getOfflinePlayer(UUID.fromString(item.getCustomHead())));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Util.setSkullOwner(skullMeta, Bukkit.getOfflinePlayer(item.getCustomHead()));
|
||||
}
|
||||
}
|
||||
|
||||
guiItem.setItemMeta(skullMeta);
|
||||
} else
|
||||
guiItem.setItemMeta(meta);
|
||||
|
||||
CMIGuiButton button = new CMIGuiButton(guiItem) {
|
||||
@Override
|
||||
public void click(GUIClickType type) {
|
||||
@ -272,7 +242,15 @@ public class ShopManager {
|
||||
}
|
||||
|
||||
for (JobItems one : item.getitems()) {
|
||||
GiveItem.giveItemForPlayer(player, one.getItemStack(player));
|
||||
CMIAsyncHead ahead = new CMIAsyncHead() {
|
||||
@Override
|
||||
public void afterAsyncUpdate(ItemStack item) {
|
||||
GiveItem.giveItemForPlayer(player, item);
|
||||
}
|
||||
};
|
||||
CMIItemStack citem = one.getItemStack(player, ahead);
|
||||
if (citem != null && !ahead.isAsyncHead())
|
||||
GiveItem.giveItemForPlayer(player, citem.getItemStack());
|
||||
}
|
||||
|
||||
if (item.getPointPrice() > 0) {
|
||||
@ -326,6 +304,8 @@ public class ShopManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean informed = false;
|
||||
|
||||
public void load() {
|
||||
list.clear();
|
||||
|
||||
@ -361,27 +341,71 @@ public class ShopManager {
|
||||
sItem.setPointPrice(pointPrice);
|
||||
sItem.setVaultPrice(vaultPrice);
|
||||
|
||||
if (nameSection.contains("Icon.Id")) {
|
||||
|
||||
String itemString = "";
|
||||
|
||||
if (!informed) {
|
||||
CMIMessages.consoleMessage("&5Update shops items icon section and use 'ItemStack' instead");
|
||||
informed = true;
|
||||
}
|
||||
|
||||
CMIMaterial mat = null;
|
||||
if (nameSection.isString("Icon.Id"))
|
||||
sItem.setIconMaterial(nameSection.getString("Icon.Id"));
|
||||
else {
|
||||
mat = CMIMaterial.get(nameSection.getString("Icon.Id"));
|
||||
|
||||
if (mat == null) {
|
||||
Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid Icon name property. Skipping!");
|
||||
continue;
|
||||
}
|
||||
|
||||
sItem.setIconAmount(nameSection.getInt("Icon.Amount", 1));
|
||||
sItem.setIconName(CMIChatColor.translate(nameSection.getString("Icon.Name")));
|
||||
int amount = nameSection.getInt("Icon.Amount", 1);
|
||||
|
||||
if (amount > 1)
|
||||
itemString += ";" + amount;
|
||||
|
||||
String name = CMIChatColor.translate(nameSection.getString("Icon.Name"));
|
||||
|
||||
if (name != null)
|
||||
itemString += ";n{" + name.replace(" ", "_") + "}";
|
||||
|
||||
List<String> lore = nameSection.getStringList("Icon.Lore");
|
||||
if (lore != null)
|
||||
for (int b = 0; b < lore.size(); b++) {
|
||||
lore.set(b, CMIChatColor.translate(lore.get(b)));
|
||||
lore.set(b, CMIChatColor.translate(lore.get(b).replace(" ", "_")));
|
||||
}
|
||||
|
||||
sItem.setIconLore(lore);
|
||||
if (lore != null && !lore.isEmpty())
|
||||
itemString += ";l{" + CMIList.listToString(lore, "\\n") + "}";
|
||||
|
||||
if (nameSection.isString("Icon.CustomHead.PlayerName"))
|
||||
sItem.setCustomHead(nameSection.getString("Icon.CustomHead.PlayerName"));
|
||||
if (nameSection.isString("Icon.CustomHead.PlayerName")) {
|
||||
itemString = mat.toString() + ":" + nameSection.getString("Icon.CustomHead.PlayerName") + itemString;
|
||||
} else if (nameSection.getBoolean("Icon.CustomHead.UseCurrentPlayer", false)) {
|
||||
itemString = mat.toString() + ":[player]" + itemString;
|
||||
} else {
|
||||
itemString = mat.toString() + itemString;
|
||||
}
|
||||
|
||||
sItem.setIconString(itemString);
|
||||
|
||||
} else if (nameSection.contains("Icon.ItemStack")) {
|
||||
|
||||
String itemString = nameSection.getString("Icon.ItemStack");
|
||||
CMIItemStack item = CMIItemStack.deserialize(itemString, null);
|
||||
|
||||
if (item == null || item.getCMIType().isNone()) {
|
||||
CMIMessages.consoleMessage("&cInvalid ItemStack for shop icon item (" + category + ")");
|
||||
continue;
|
||||
}
|
||||
|
||||
sItem.setIconString(itemString);
|
||||
}
|
||||
|
||||
if (sItem.getIconString() == null) {
|
||||
Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid Icon name property. Skipping!");
|
||||
continue;
|
||||
}
|
||||
|
||||
sItem.setCustomHeadOwner(nameSection.getBoolean("Icon.CustomHead.UseCurrentPlayer", true));
|
||||
sItem.setHideIfThereIsNoEnoughPoints(nameSection.getBoolean("Icon.HideIfThereIsNoEnoughPoints"));
|
||||
sItem.setHideWithoutPerm(nameSection.getBoolean("Icon.HideWithoutPermission"));
|
||||
sItem.setRequiredPerm(nameSection.getStringList("RequiredPermission"));
|
||||
@ -417,6 +441,26 @@ public class ShopManager {
|
||||
}
|
||||
sItem.setCommands(performCommands);
|
||||
|
||||
if (nameSection.isList("GiveItems")) {
|
||||
|
||||
List<JobItems> items = new ArrayList<>();
|
||||
for (String itemString : nameSection.getStringList("GiveItems")) {
|
||||
|
||||
CMIItemStack item = CMIItemStack.deserialize(itemString, null);
|
||||
|
||||
if (item == null || item.getCMIType().isNone()) {
|
||||
CMIMessages.consoleMessage("&cInvalid ItemStack for boosted item (" + itemString + ")");
|
||||
continue;
|
||||
}
|
||||
JobItems jitem = new JobItems("");
|
||||
jitem.setItemString(itemString);
|
||||
items.add(jitem);
|
||||
}
|
||||
sItem.setitems(items);
|
||||
|
||||
} else {
|
||||
|
||||
// Outdated method
|
||||
ConfigurationSection itemsSection = nameSection.getConfigurationSection("GiveItems");
|
||||
if (itemsSection != null) {
|
||||
List<JobItems> items = new ArrayList<>();
|
||||
@ -426,9 +470,10 @@ public class ShopManager {
|
||||
if (itemSection == null)
|
||||
continue;
|
||||
|
||||
String id = null;
|
||||
if (itemSection.contains("Id")) {
|
||||
CMIMaterial mat = null;
|
||||
if (itemSection.isString("Id"))
|
||||
id = itemSection.getString("Id");
|
||||
mat = CMIMaterial.get(itemSection.getString("Id"));
|
||||
else {
|
||||
Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid GiveItems item id property. Skipping!");
|
||||
continue;
|
||||
@ -438,11 +483,12 @@ public class ShopManager {
|
||||
String name = CMIChatColor.translate(itemSection.getString("Name"));
|
||||
|
||||
List<String> giveLore = itemSection.getStringList("Lore");
|
||||
if (giveLore != null)
|
||||
for (int v = 0; v < giveLore.size(); v++) {
|
||||
giveLore.set(v, CMIChatColor.translate(giveLore.get(v)));
|
||||
giveLore.set(v, CMIChatColor.translate(giveLore.get(v)).replace(" ", "_"));
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
StringBuilder enchants = new StringBuilder();
|
||||
for (String eachLine : itemSection.getStringList("Enchants")) {
|
||||
String[] split = eachLine.split("=", 2);
|
||||
if (split.length == 0)
|
||||
@ -461,10 +507,12 @@ public class ShopManager {
|
||||
}
|
||||
}
|
||||
|
||||
enchants.put(ench, level);
|
||||
if (!enchants.toString().isEmpty())
|
||||
enchants.append(",");
|
||||
enchants.append(split[0] + ":" + level);
|
||||
}
|
||||
|
||||
Object potionData = null;
|
||||
String potionData = "";
|
||||
if (itemSection.contains("potion-type")) {
|
||||
PotionType type;
|
||||
try {
|
||||
@ -473,18 +521,35 @@ public class ShopManager {
|
||||
type = PotionType.SPEED;
|
||||
}
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_10_R1)) {
|
||||
potionData = new PotionData(type);
|
||||
} else {
|
||||
potionData = new Potion(type, 1, false);
|
||||
}
|
||||
potionData += type.toString() + ":false:false";
|
||||
}
|
||||
|
||||
String itemSring = mat.toString();
|
||||
if (name != null)
|
||||
itemSring += ";n{" + name.replace(" ", "_") + "}";
|
||||
if (amount > 1)
|
||||
itemSring += ";" + amount;
|
||||
|
||||
if (giveLore != null && !giveLore.isEmpty())
|
||||
itemSring += ";l{" + CMIList.listToString(giveLore, "\\n") + "}";
|
||||
|
||||
if (!potionData.isEmpty())
|
||||
itemSring += ";" + potionData;
|
||||
|
||||
if (!enchants.toString().isEmpty())
|
||||
itemSring += ";" + enchants.toString();
|
||||
|
||||
JobItems jitem = new JobItems(oneItemName.toLowerCase());
|
||||
|
||||
jitem.setItemString(itemSring);
|
||||
|
||||
items.add(jitem);
|
||||
}
|
||||
|
||||
items.add(new JobItems(oneItemName.toLowerCase(), id == null ? CMIMaterial.STONE : CMIMaterial.get(id), amount, name, giveLore,
|
||||
enchants, new BoostMultiplier(), new ArrayList<>(), potionData, null));
|
||||
}
|
||||
sItem.setitems(items);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class Job {
|
||||
private List<JobCommands> jobCommands;
|
||||
private List<JobConditions> jobConditions;
|
||||
|
||||
private Map<String, JobItems> jobItems;
|
||||
// private Map<String, JobItems> jobItems;
|
||||
private Map<String, JobLimitedItems> jobLimitedItems;
|
||||
|
||||
private String jobName = "N/A";
|
||||
@ -115,7 +115,7 @@ public class Job {
|
||||
vipmaxLevel, maxSlots, jobPermissions, jobCommands, jobConditions,
|
||||
jobLimitedItems, cmdOnJoin, cmdOnLeave, guiItem, guiSlot, worldBlacklist);
|
||||
|
||||
this.jobItems = jobItems;
|
||||
// this.jobItems = jobItems;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@ -580,36 +580,6 @@ public class Job {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* No longer used, moved to ItemBoostManager
|
||||
* @return Items for this job
|
||||
*/
|
||||
@Deprecated
|
||||
public Map<String, JobItems> getItemBonus() {
|
||||
if (jobItems == null)
|
||||
jobItems = new HashMap<String, JobItems>();
|
||||
return jobItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* No longer used, moved to ItemBoostManager
|
||||
* @return Items for this job
|
||||
*/
|
||||
@Deprecated
|
||||
public JobItems getItemBonus(String key) {
|
||||
return jobItems.get(key.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* No longer used, moved to ItemBoostManager
|
||||
* @return Items for this job
|
||||
*/
|
||||
@Deprecated
|
||||
public Job setItemBonus(HashMap<String, JobItems> jobItems) {
|
||||
this.jobItems = jobItems;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the limited item nodes for this job
|
||||
* @return Limited items for this job
|
||||
|
@ -19,37 +19,19 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.NBT.CMINBT;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
import net.Zrips.CMILib.Items.CMIAsyncHead;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class JobItems {
|
||||
|
||||
private String node;
|
||||
private String legacyKey;
|
||||
private ItemStack item;
|
||||
|
||||
private Object potion;
|
||||
private Color leatherColor;
|
||||
private String itemString;
|
||||
|
||||
private final Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
private BoostMultiplier boostMultiplier = new BoostMultiplier();
|
||||
|
||||
private final List<Job> jobs = new ArrayList<>();
|
||||
@ -57,139 +39,16 @@ public class JobItems {
|
||||
private int fromLevel = 0;
|
||||
private int untilLevel = Integer.MAX_VALUE;
|
||||
|
||||
public JobItems(String node, CMIMaterial mat, int amount, String name, List<String> lore, Map<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier, List<Job> jobs) {
|
||||
this(node, mat, amount, name, lore, enchants, boostMultiplier, jobs, null, null);
|
||||
}
|
||||
|
||||
public JobItems(String node, CMIMaterial mat, int amount, String name, List<String> lore, Map<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier, List<Job> jobs,
|
||||
Object potion, Color leatherColor) {
|
||||
if (mat == null) {
|
||||
mat = CMIMaterial.STONE;
|
||||
}
|
||||
|
||||
if (enchants != null) {
|
||||
this.enchants.putAll(enchants);
|
||||
}
|
||||
|
||||
public JobItems(String node) {
|
||||
this.node = node;
|
||||
|
||||
if (boostMultiplier != null) {
|
||||
this.boostMultiplier = boostMultiplier;
|
||||
}
|
||||
|
||||
setJobs(jobs);
|
||||
|
||||
ItemMeta meta = (item = mat.newItemStack()).getItemMeta();
|
||||
if (potion != null && meta instanceof PotionMeta && CMIMaterial.isPotion(mat.getMaterial())) {
|
||||
PotionMeta potionMeta = (PotionMeta) meta;
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_10_R1) && potion instanceof org.bukkit.potion.PotionData) {
|
||||
potionMeta.setBasePotionData((org.bukkit.potion.PotionData) potion);
|
||||
} else if (potion instanceof org.bukkit.potion.Potion) {
|
||||
PotionEffectType effectType = ((org.bukkit.potion.Potion) potion).getType().getEffectType();
|
||||
|
||||
if (effectType != null) {
|
||||
potionMeta.setMainEffect(effectType);
|
||||
}
|
||||
}
|
||||
|
||||
meta = potionMeta;
|
||||
} else if (leatherColor != null && meta instanceof LeatherArmorMeta && CMIMaterial.isLeatherArmor(mat.getMaterial())) {
|
||||
LeatherArmorMeta armorMeta = (LeatherArmorMeta) meta;
|
||||
armorMeta.setColor(this.leatherColor = leatherColor);
|
||||
meta = armorMeta;
|
||||
}
|
||||
|
||||
if (meta != null) {
|
||||
if (name != null)
|
||||
meta.setDisplayName(CMIChatColor.translate(name));
|
||||
|
||||
if (lore != null)
|
||||
meta.setLore(lore);
|
||||
|
||||
if (enchants != null) {
|
||||
if (mat == CMIMaterial.ENCHANTED_BOOK) {
|
||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
||||
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
||||
}
|
||||
} else {
|
||||
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
|
||||
meta.addEnchant(oneEnchant.getKey(), oneEnchant.getValue(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
|
||||
item.setAmount(amount);
|
||||
CMINBT nbt = new CMINBT(item);
|
||||
item = (ItemStack) nbt.setString("JobsItemBoost", node);
|
||||
}
|
||||
|
||||
public String getNode() {
|
||||
return node;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(Player player) {
|
||||
if (player == null)
|
||||
return item;
|
||||
|
||||
ItemStack item = this.item.clone();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) {
|
||||
return item;
|
||||
}
|
||||
|
||||
if (potion != null && CMIMaterial.isPotion(item.getType()) && meta instanceof PotionMeta) {
|
||||
PotionMeta potionMeta = (PotionMeta) meta;
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_10_R1) && potion instanceof org.bukkit.potion.PotionData) {
|
||||
potionMeta.setBasePotionData((org.bukkit.potion.PotionData) potion);
|
||||
} else if (potion instanceof org.bukkit.potion.Potion) {
|
||||
PotionEffectType effectType = ((org.bukkit.potion.Potion) potion).getType().getEffectType();
|
||||
|
||||
if (effectType != null) {
|
||||
potionMeta.setMainEffect(effectType);
|
||||
}
|
||||
}
|
||||
|
||||
meta = potionMeta;
|
||||
} else if (leatherColor != null && CMIMaterial.isLeatherArmor(item.getType()) && meta instanceof LeatherArmorMeta) {
|
||||
LeatherArmorMeta armorMeta = (LeatherArmorMeta) meta;
|
||||
armorMeta.setColor(leatherColor);
|
||||
meta = armorMeta;
|
||||
}
|
||||
|
||||
if (meta.hasDisplayName())
|
||||
meta.setDisplayName(CMIChatColor.translate(meta.getDisplayName().replace("[player]", player.getName())));
|
||||
|
||||
if (meta.hasLore()) {
|
||||
List<String> translatedLore = meta.getLore();
|
||||
|
||||
for (int a = 0; a < translatedLore.size(); a++) {
|
||||
translatedLore.set(a, CMIChatColor.translate(translatedLore.get(a).replace("[player]", player.getName())));
|
||||
}
|
||||
|
||||
meta.setLore(translatedLore);
|
||||
}
|
||||
|
||||
if (enchants != null) {
|
||||
if (item.getType() == CMIMaterial.ENCHANTED_BOOK.getMaterial()) {
|
||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
||||
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
||||
}
|
||||
} else {
|
||||
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
|
||||
meta.addEnchant(oneEnchant.getKey(), oneEnchant.getValue(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
public CMIItemStack getItemStack(Player player, CMIAsyncHead ahead) {
|
||||
return CMIItemStack.deserialize(itemString.replace("[player]", player == null ? "" : player.getName()), ahead);
|
||||
}
|
||||
|
||||
public BoostMultiplier getBoost() {
|
||||
@ -215,10 +74,6 @@ public class JobItems {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Enchantment, Integer> getEnchants() {
|
||||
return enchants;
|
||||
}
|
||||
|
||||
public int getFromLevel() {
|
||||
return fromLevel;
|
||||
}
|
||||
@ -235,11 +90,16 @@ public class JobItems {
|
||||
this.untilLevel = untilLevel;
|
||||
}
|
||||
|
||||
public String getLegacyKey() {
|
||||
return legacyKey;
|
||||
public CMIItemStack getItem() {
|
||||
return CMIItemStack.deserialize(itemString);
|
||||
}
|
||||
|
||||
public void setLegacyKey(String legacyKey) {
|
||||
this.legacyKey = legacyKey;
|
||||
public void setItemString(String itemString) {
|
||||
this.itemString = itemString.replace(" ", "_");
|
||||
}
|
||||
|
||||
public void setBoostMultiplier(BoostMultiplier boostMultiplier) {
|
||||
this.boostMultiplier = boostMultiplier;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,59 +18,44 @@
|
||||
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Container.CMINumber;
|
||||
import net.Zrips.CMILib.Items.CMIAsyncHead;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.NBT.CMINBT;
|
||||
|
||||
public class JobLimitedItems {
|
||||
private String node;
|
||||
CMIMaterial mat;
|
||||
private String name;
|
||||
private ItemStack item;
|
||||
private String itemString;
|
||||
private List<String> lore;
|
||||
private Map<Enchantment, Integer> enchants;
|
||||
private int level;
|
||||
|
||||
public JobLimitedItems(String node, CMIMaterial material, int amount, String name, List<String> lore, Map<Enchantment, Integer> enchants, int level) {
|
||||
public JobLimitedItems(String node, String itemString, int level) {
|
||||
this.node = node;
|
||||
this.itemString = itemString.replace(" ", "_");
|
||||
|
||||
CMIItemStack ct = material.newCMIItemStack(CMINumber.clamp(amount, 1, material.getMaterial().getMaxStackSize()));
|
||||
ct.setDisplayName(name);
|
||||
ct.setLore(lore);
|
||||
for (Entry<Enchantment, Integer> one : enchants.entrySet()) {
|
||||
ct.addEnchant(one.getKey(), one.getValue());
|
||||
}
|
||||
this.item = ct.getItemStack();
|
||||
CMIItemStack citem = CMIItemStack.deserialize(itemString);
|
||||
|
||||
this.name = name;
|
||||
this.lore = lore;
|
||||
this.enchants = enchants;
|
||||
this.level = level;
|
||||
this.mat = material;
|
||||
}
|
||||
|
||||
public JobLimitedItems(String node, ItemStack item, int level) {
|
||||
this.node = node;
|
||||
this.item = item;
|
||||
if (this.item.hasItemMeta()) {
|
||||
ItemMeta meta = this.item.getItemMeta();
|
||||
ItemStack item = citem.getItemStack();
|
||||
if (item.hasItemMeta()) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta.hasDisplayName())
|
||||
name = meta.getDisplayName();
|
||||
if (meta.hasLore())
|
||||
lore = meta.getLore();
|
||||
}
|
||||
enchants = item.getEnchantments();
|
||||
mat = citem.getCMIType();
|
||||
|
||||
this.level = level;
|
||||
}
|
||||
@ -79,26 +64,8 @@ public class JobLimitedItems {
|
||||
return node;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(Player player) {
|
||||
|
||||
ItemStack item = this.item.clone();
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) {
|
||||
return item;
|
||||
}
|
||||
|
||||
if (lore != null && !lore.isEmpty()) {
|
||||
List<String> translatedLore = new ArrayList<>();
|
||||
for (String oneLore : lore) {
|
||||
translatedLore.add(CMIChatColor.translate(oneLore.replace("[player]", player.getName())));
|
||||
}
|
||||
|
||||
meta.setLore(translatedLore);
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
public CMIItemStack getItemStack(Player player, CMIAsyncHead ahead) {
|
||||
return CMIItemStack.deserialize(itemString.replace("[player]", player == null ? "" : player.getName()), ahead);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -125,4 +92,10 @@ public class JobLimitedItems {
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public static ItemStack applyNBT(ItemStack item, int jobId, String node) {
|
||||
CMINBT nbt = new CMINBT(item);
|
||||
nbt.setInt("JobsLimited", jobId);
|
||||
return (ItemStack) nbt.setString("JobsLimitedNode", node);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Zrips.CMILib.Items.CMIAsyncHead;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
|
||||
public class ShopItem {
|
||||
|
||||
private double pointPrice = 0D;
|
||||
@ -12,11 +18,8 @@ public class ShopItem {
|
||||
|
||||
private int slot = -1;
|
||||
private int page = -1;
|
||||
private int iconAmount = 1;
|
||||
|
||||
private String nodeName;
|
||||
private String iconMaterial;
|
||||
private String iconName;
|
||||
|
||||
private boolean hideWithoutPerm = false;
|
||||
private boolean hideNoEnoughPoint = false;
|
||||
@ -25,13 +28,19 @@ public class ShopItem {
|
||||
|
||||
private Map<String, Integer> requiredJobs = new HashMap<>();
|
||||
|
||||
private final List<String> iconLore = new ArrayList<>();
|
||||
// private final List<String> iconLore = new ArrayList<>();
|
||||
private final List<String> requiredPerm = new ArrayList<>();
|
||||
private final List<String> commands = new ArrayList<>();
|
||||
private final List<JobItems> items = new ArrayList<>();
|
||||
|
||||
private String playerName;
|
||||
private boolean useCurrentPlayer = false;
|
||||
// private String playerName;
|
||||
// private boolean useCurrentPlayer = false;
|
||||
|
||||
private String iconString;
|
||||
|
||||
public CMIItemStack getIcon(Player player, CMIAsyncHead ahead) {
|
||||
return CMIItemStack.deserialize(iconString.replace("[player]", player.getName()), ahead);
|
||||
}
|
||||
|
||||
public ShopItem(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
@ -110,28 +119,28 @@ public class ShopItem {
|
||||
return hideWithoutPerm;
|
||||
}
|
||||
|
||||
public void setIconLore(List<String> iconLore) {
|
||||
this.iconLore.clear();
|
||||
|
||||
if (iconLore != null)
|
||||
this.iconLore.addAll(iconLore);
|
||||
}
|
||||
|
||||
public List<String> getIconLore() {
|
||||
return iconLore;
|
||||
}
|
||||
// public void setIconLore(List<String> iconLore) {
|
||||
// this.iconLore.clear();
|
||||
//
|
||||
// if (iconLore != null)
|
||||
// this.iconLore.addAll(iconLore);
|
||||
// }
|
||||
//
|
||||
// public List<String> getIconLore() {
|
||||
// return iconLore;
|
||||
// }
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public String getIconMaterial() {
|
||||
return iconMaterial;
|
||||
}
|
||||
|
||||
public void setIconMaterial(String iconMaterial) {
|
||||
this.iconMaterial = iconMaterial;
|
||||
}
|
||||
// public String getIconMaterial() {
|
||||
// return iconMaterial;
|
||||
// }
|
||||
//
|
||||
// public void setIconMaterial(String iconMaterial) {
|
||||
// this.iconMaterial = iconMaterial;
|
||||
// }
|
||||
|
||||
@Deprecated
|
||||
public double getPrice() {
|
||||
@ -142,21 +151,21 @@ public class ShopItem {
|
||||
return pointPrice;
|
||||
}
|
||||
|
||||
public void setIconAmount(int iconAmount) {
|
||||
this.iconAmount = iconAmount;
|
||||
}
|
||||
|
||||
public int getIconAmount() {
|
||||
return iconAmount;
|
||||
}
|
||||
|
||||
public void setIconName(String iconName) {
|
||||
this.iconName = iconName;
|
||||
}
|
||||
|
||||
public String getIconName() {
|
||||
return iconName;
|
||||
}
|
||||
// public void setIconAmount(int iconAmount) {
|
||||
// this.iconAmount = iconAmount;
|
||||
// }
|
||||
//
|
||||
// public int getIconAmount() {
|
||||
// return iconAmount;
|
||||
// }
|
||||
//
|
||||
// public void setIconName(String iconName) {
|
||||
// this.iconName = iconName;
|
||||
// }
|
||||
//
|
||||
// public String getIconName() {
|
||||
// return iconName;
|
||||
// }
|
||||
|
||||
public int getRequiredTotalLevels() {
|
||||
return requiredTotalLevels;
|
||||
@ -166,21 +175,21 @@ public class ShopItem {
|
||||
this.requiredTotalLevels = requiredTotalLevels;
|
||||
}
|
||||
|
||||
public String getCustomHead() {
|
||||
return playerName;
|
||||
}
|
||||
|
||||
public void setCustomHead(String playerName) {
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
public boolean isHeadOwner() {
|
||||
return useCurrentPlayer;
|
||||
}
|
||||
|
||||
public void setCustomHeadOwner(boolean useCurrentPlayer) {
|
||||
this.useCurrentPlayer = useCurrentPlayer;
|
||||
}
|
||||
// public String getCustomHead() {
|
||||
// return playerName;
|
||||
// }
|
||||
//
|
||||
// public void setCustomHead(String playerName) {
|
||||
// this.playerName = playerName;
|
||||
// }
|
||||
//
|
||||
// public boolean isHeadOwner() {
|
||||
// return useCurrentPlayer;
|
||||
// }
|
||||
//
|
||||
// public void setCustomHeadOwner(boolean useCurrentPlayer) {
|
||||
// this.useCurrentPlayer = useCurrentPlayer;
|
||||
// }
|
||||
|
||||
public double getVaultPrice() {
|
||||
return vaultPrice;
|
||||
@ -193,4 +202,12 @@ public class ShopItem {
|
||||
public void setPointPrice(double pointPrice) {
|
||||
this.pointPrice = pointPrice;
|
||||
}
|
||||
|
||||
public String getIconString() {
|
||||
return iconString;
|
||||
}
|
||||
|
||||
public void setIconString(String iconString) {
|
||||
this.iconString = iconString;
|
||||
}
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ public class JobsListener implements Listener {
|
||||
String itemNode = null;
|
||||
CMIMaterial mat = CMIMaterial.get(iih);
|
||||
|
||||
Integer jobId = null;
|
||||
int jobId = 0;
|
||||
mein: for (JobProgression one : jPlayer.getJobProgression()) {
|
||||
for (JobLimitedItems oneItem : one.getJob().getLimitedItems().values()) {
|
||||
if (one.getLevel() >= oneItem.getLevel() || !isThisItem(oneItem, mat, name, lore, enchants))
|
||||
@ -486,9 +486,7 @@ public class JobsListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
CMIActionBar.send(player, Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", meinOk));
|
||||
|
||||
CMINBT nbt = new CMINBT(iih);
|
||||
nbt.setInt("JobsLimited", jobId);
|
||||
iih = (ItemStack) nbt.setString("JobsLimitedNode", itemNode);
|
||||
iih = JobLimitedItems.applyNBT(iih, jobId, itemNode);
|
||||
try {
|
||||
if (Version.isCurrentHigher(Version.v1_8_R3) && event.getHand() != EquipmentSlot.HAND) {
|
||||
CMIItemStack.setItemInOffHand(player, iih);
|
||||
@ -502,8 +500,9 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
|
||||
private static boolean isThisItem(JobLimitedItems oneItem, CMIMaterial mat, String name, List<String> lore, Map<Enchantment, Integer> enchants) {
|
||||
if (oneItem.getType() != mat)
|
||||
if (oneItem.getType() != mat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (oneItem.getName() != null && !CMIChatColor.translate(oneItem.getName()).equalsIgnoreCase(name)) {
|
||||
return false;
|
||||
@ -518,12 +517,12 @@ public class JobsListener implements Listener {
|
||||
for (Entry<Enchantment, Integer> oneE : enchants.entrySet()) {
|
||||
Integer value = oneItem.getEnchants().get(oneE.getKey());
|
||||
|
||||
if (value != null && value <= oneE.getValue()) {
|
||||
return true;
|
||||
if (value != null && value > oneE.getValue()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
|
@ -1044,7 +1044,7 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (!Jobs.getGCManager().allowEnchantingBoostedItems) {
|
||||
for (JobProgression prog : jPlayer.getJobProgression()) {
|
||||
for (JobItems jobItem : ItemBoostManager.getItemsByJob(prog.getJob())) {
|
||||
if (event.getItem().isSimilar(jobItem.getItemStack(player))) {
|
||||
if (event.getItem().isSimilar(jobItem.getItemStack(player, null).getItemStack())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
public final class GiveItem {
|
||||
|
||||
@ -54,7 +55,11 @@ public final class GiveItem {
|
||||
}
|
||||
|
||||
public static void giveItemForPlayer(Player player, ItemStack item) {
|
||||
if (player == null)
|
||||
return;
|
||||
CMIScheduler.runAtEntity(player, () -> {
|
||||
player.getInventory().addItem(item);
|
||||
player.updateInventory();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -6,27 +6,12 @@ Items:
|
||||
# Atleast one type of currency needs to be defined
|
||||
vaultPrice: 10000.0
|
||||
Icon:
|
||||
# (REQUIRED) Icon item
|
||||
Id: diamond_pickaxe
|
||||
# (Optional - Default: 1) Icon item amount
|
||||
Amount: 1
|
||||
# (Optional) Icon name. Supports usual color codes
|
||||
Name: "&eBest pick axe ever!"
|
||||
# (Optional) Icon lore. Supports usual color codes
|
||||
Lore:
|
||||
- "&6Efficiency V"
|
||||
- "&6Unbreaking III"
|
||||
- "&eAnd one tasty apple!"
|
||||
# (REQUIRED) Icon item. [player] can be used as a variable for the player who opens UI
|
||||
ItemStack: diamond_pickaxe;&eBest_pick_axe_ever!;&6Efficiency_V\n&6Unbreaking_III\n&eAnd_one_tasty_apple!
|
||||
# (Optional - default: false) Hides icon if player don't have permission to get this item
|
||||
HideWithoutPermission: true
|
||||
# (Optional - default: false) Hides icon if player don't have enough point levels to get this icon
|
||||
HideIfThereIsNoEnoughPoints: false
|
||||
# (Optional) When you want to use Player Head material with skin then use this
|
||||
#CustomHead:
|
||||
# You can specify here valid player name or uuid.
|
||||
# PlayerName: playerNameOrUUID
|
||||
# Use the current player who opened the gui, so the head skin will be this player who opened.
|
||||
# UseCurrentPlayer: true
|
||||
# (Optional) List of permissions required to buy this item
|
||||
RequiredPermission:
|
||||
- jobs.item.pickaxe
|
||||
@ -44,30 +29,9 @@ Items:
|
||||
- "msg &eThanks for buying this super pick axe!"
|
||||
# (Optional) Gives items by defined criteria
|
||||
GiveItems:
|
||||
# Can be any word
|
||||
PickAxe:
|
||||
# (Required) Item name
|
||||
Id: diamond_pickaxe
|
||||
# (Optional - Default: 1) Item amount
|
||||
Amount: 1
|
||||
# (Optional) Item name
|
||||
Name: "&eSuper PickAxe"
|
||||
# (Optional) Item lore
|
||||
Lore:
|
||||
- "&eUber pickAxe"
|
||||
# (Optional) Item enchants
|
||||
Enchants:
|
||||
- DIG_SPEED=5
|
||||
- DURABILITY=3
|
||||
Giving-Potion:
|
||||
Id: potion
|
||||
Amount: 1
|
||||
Name: "&6Jump boost"
|
||||
potion-type: jump
|
||||
# Can be any word
|
||||
Apple:
|
||||
# (Required) Item name
|
||||
Id: apple
|
||||
- diamond_pickaxe;2;&eSuper_PickAxe;&eUber_pickAxe;DIG_SPEED:5,DURABILITY:3
|
||||
- potion;n{&6Jump_boost};jump
|
||||
- apple
|
||||
WoodenShovel:
|
||||
pointPrice: 100.0
|
||||
Icon:
|
||||
|
Loading…
Reference in New Issue
Block a user