mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-02 11:21:20 +01:00
minute change for investigation of ticket 0607 dont bother updating
This commit is contained in:
parent
a39251a97b
commit
44fc5dd9ce
@ -607,4 +607,13 @@ public class MMOItems extends JavaPlugin {
|
|||||||
public ItemStack getItem(Type type, String id) {
|
public ItemStack getItem(Type type, String id) {
|
||||||
return getMMOItem(type, id).newBuilder().build();
|
return getMMOItem(type, id).newBuilder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs something into the console with a cool [MMOItems] prefix :)
|
||||||
|
* <p></p>
|
||||||
|
* Parses color codes
|
||||||
|
*/
|
||||||
|
public static void Log(String message) {
|
||||||
|
plugin.getLogger().log(Level.INFO, "\u00a78[" + ChatColor.YELLOW + "MMOItems\u00a78] \u00a77");
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.api.interaction.weapon;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.Indyuce.mmoitems.comp.flags.FlagPlugin;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -35,7 +36,10 @@ public class Weapon extends UseItem {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return MMOItems.plugin.getFlags().isFlagAllowed(getPlayer(), CustomFlag.MI_WEAPONS) && playerData.getRPG().canUse(getNBTItem(), true);
|
boolean asCanUse = playerData.getRPG().canUse(getNBTItem(), true);
|
||||||
|
boolean asFlagAllowed = true; FlagPlugin fg = MMOItems.plugin.getFlags(); if (fg != null) { asFlagAllowed = fg.isFlagAllowed(getPlayer(), CustomFlag.MI_WEAPONS); }
|
||||||
|
else { MMOItems.Log("Flag Plugin Not Found");}
|
||||||
|
return asCanUse || asFlagAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@ import net.Indyuce.mmoitems.stat.type.ItemStat;
|
|||||||
import net.mmogroup.mmolib.MMOLib;
|
import net.mmogroup.mmolib.MMOLib;
|
||||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.attribute.AttributeModifier;
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
@ -45,28 +46,35 @@ public class ItemStackBuilder {
|
|||||||
UUID.fromString("87851e28-af12-43f6-898e-c62bde6bd0ec"), "mmoitemsDecoy", 0, Operation.ADD_NUMBER);
|
UUID.fromString("87851e28-af12-43f6-898e-c62bde6bd0ec"), "mmoitemsDecoy", 0, Operation.ADD_NUMBER);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to build an MMOItem into an ItemStack
|
* Used to build an MMOItem into an ItemStack.
|
||||||
*
|
*
|
||||||
* @param mmoitem The mmoitem you want to build
|
* @param mmoitem The mmoitem you want to build
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public ItemStackBuilder(MMOItem mmoitem) {
|
public ItemStackBuilder(MMOItem mmoitem) {
|
||||||
|
|
||||||
|
// Reference to source MMOItem
|
||||||
this.mmoitem = mmoitem;
|
this.mmoitem = mmoitem;
|
||||||
|
|
||||||
item = new ItemStack(
|
// Generates a new ItemStack of the specified material (Specified in the Material stat, or a DIAMOND_SWORD if missing).
|
||||||
mmoitem.hasData(ItemStats.MATERIAL) ? ((MaterialData) mmoitem.getData(ItemStats.MATERIAL)).getMaterial()
|
item = new ItemStack( mmoitem.hasData(ItemStats.MATERIAL) ?
|
||||||
|
((MaterialData) mmoitem.getData(ItemStats.MATERIAL)).getMaterial()
|
||||||
: Material.DIAMOND_SWORD);
|
: Material.DIAMOND_SWORD);
|
||||||
|
|
||||||
|
// Gets a lore builder, which will be used to apply the chosen lore format (Choose with the lore format stat, or the default one if unspecified)
|
||||||
lore = new LoreBuilder(mmoitem.hasData(ItemStats.LORE_FORMAT)
|
lore = new LoreBuilder(mmoitem.hasData(ItemStats.LORE_FORMAT)
|
||||||
? MMOItems.plugin.getFormats().getFormat(mmoitem.getData(ItemStats.LORE_FORMAT).toString())
|
? MMOItems.plugin.getFormats().getFormat(mmoitem.getData(ItemStats.LORE_FORMAT).toString())
|
||||||
: MMOItems.plugin.getLanguage().getDefaultLoreFormat());
|
: MMOItems.plugin.getLanguage().getDefaultLoreFormat());
|
||||||
|
|
||||||
|
// Gets the meta, and hides attributes
|
||||||
meta = item.getItemMeta();
|
meta = item.getItemMeta();
|
||||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||||
|
|
||||||
|
// Store the internal TYPE-ID Information (not stats, so it must be done manually here)
|
||||||
tags.add(new ItemTag("MMOITEMS_ITEM_TYPE", mmoitem.getType().getId()));
|
tags.add(new ItemTag("MMOITEMS_ITEM_TYPE", mmoitem.getType().getId()));
|
||||||
tags.add(new ItemTag("MMOITEMS_ITEM_ID", mmoitem.getId()));
|
tags.add(new ItemTag("MMOITEMS_ITEM_ID", mmoitem.getId()));
|
||||||
if (MMOItems.INTERNAL_REVISION_ID > 1)
|
|
||||||
tags.add(new ItemTag("MMOITEMS_INTERNAL_REVISION_ID", MMOItems.INTERNAL_REVISION_ID));
|
|
||||||
|
|
||||||
|
// And a last technical tag for updating items
|
||||||
|
if (MMOItems.INTERNAL_REVISION_ID > 1) { tags.add(new ItemTag("MMOITEMS_INTERNAL_REVISION_ID", MMOItems.INTERNAL_REVISION_ID)); }
|
||||||
/*if (MMOItems.plugin.getUpdater().hasData(mmoitem))
|
/*if (MMOItems.plugin.getUpdater().hasData(mmoitem))
|
||||||
tags.add(new ItemTag("MMOITEMS_ITEM_UUID",
|
tags.add(new ItemTag("MMOITEMS_ITEM_UUID",
|
||||||
MMOItems.plugin.getUpdater().getData(mmoitem.getType(), mmoitem.getId()).getUniqueId().toString()));*/
|
MMOItems.plugin.getUpdater().getData(mmoitem.getType(), mmoitem.getId()).getUniqueId().toString()));*/
|
||||||
@ -100,21 +108,30 @@ public class ItemStackBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return Returns built NBTItem with applied tags and lore
|
* @return Returns built NBTItem with applied tags and lore
|
||||||
*/
|
*/
|
||||||
public NBTItem buildNBT() {
|
public NBTItem buildNBT() {
|
||||||
this.mmoitem = new StatLore(mmoitem).generateNewItem();
|
this.mmoitem = new StatLore(mmoitem).generateNewItem();
|
||||||
|
|
||||||
|
// For every stat within this item
|
||||||
for (ItemStat stat : mmoitem.getStats())
|
for (ItemStat stat : mmoitem.getStats())
|
||||||
|
|
||||||
|
// Attempt to add
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
//
|
||||||
stat.whenApplied(this, mmoitem.getData(stat));
|
stat.whenApplied(this, mmoitem.getData(stat));
|
||||||
|
|
||||||
|
// Something went wrong...
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
MMOItems.plugin.getLogger().log(Level.WARNING, "An error occurred while trying to generate item '"
|
MMOItems.plugin.getLogger().log(Level.WARNING,
|
||||||
+ mmoitem.getId() + "' with stat '" + stat.getId() + "': " + exception.getMessage());
|
ChatColor.GRAY + "An error occurred while trying to generate item '"
|
||||||
|
+ ChatColor.RED + mmoitem.getId() + ChatColor.GRAY + "' with stat '"
|
||||||
|
+ ChatColor.GOLD + stat.getId() + ChatColor.GRAY + "': "
|
||||||
|
+ ChatColor.YELLOW + exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display gem stone lore
|
// Display gem stone lore hint thing
|
||||||
if (mmoitem.getType() == Type.GEM_STONE)
|
if (mmoitem.getType() == Type.GEM_STONE)
|
||||||
lore.insert("gem-stone-lore", ItemStat.translate("gem-stone-lore"));
|
lore.insert("gem-stone-lore", ItemStat.translate("gem-stone-lore"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user