diff --git a/plugin/src/main/java/com/denizenscript/denizen/nms/NMSHandler.java b/plugin/src/main/java/com/denizenscript/denizen/nms/NMSHandler.java index d926375187..affee8d642 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/nms/NMSHandler.java +++ b/plugin/src/main/java/com/denizenscript/denizen/nms/NMSHandler.java @@ -11,6 +11,7 @@ import com.denizenscript.denizen.nms.abstracts.ProfileEditor; import com.denizenscript.denizen.nms.abstracts.Sidebar; import com.denizenscript.denizen.utilities.packets.DenizenPacketHandler; +import com.denizenscript.denizencore.utilities.ReflectionHelper; import net.md_5.bungee.api.chat.HoverEvent; import org.bukkit.Location; import org.bukkit.block.Biome; @@ -30,7 +31,9 @@ public abstract class NMSHandler { public static boolean initialize(JavaPlugin plugin) { javaPlugin = plugin; - String packageName = javaPlugin.getServer().getClass().getPackage().getName(); + Class serverClass = javaPlugin.getServer().getClass(); + ReflectionHelper.giveReflectiveAccess(serverClass, ReflectionHelper.class); + String packageName = serverClass.getPackage().getName(); int indexOfSubRevision = packageName.indexOf('R'); if (indexOfSubRevision > 0) { // "v1_14_R1" should become "v1_14" diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java index b825075a3b..7a7d41e212 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java @@ -1717,13 +1717,8 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( return new ElementTag(false); }); - // <--[tag] - // @attribute |...]> - // @returns ElementTag(Boolean) - // @description - // Returns whether the inventory contains any of the specified items. - // --> registerTag("contains_any", (attribute, object) -> { + Deprecations.inventoryNonMatcherTags.warn(attribute.context); if (!attribute.hasContext(1)) { return null; } @@ -1733,12 +1728,6 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( } int qty = 1; - // <--[tag] - // @attribute |...].quantity[<#>]> - // @returns ElementTag(Boolean) - // @description - // Returns whether the inventory contains a certain quantity of any of the specified items. - // --> if ((attribute.startsWith("quantity", 2) || attribute.startsWith("qty", 2)) && attribute.hasContext(2)) { if (attribute.startsWith("qty", 2)) { Deprecations.qtyTags.warn(attribute.context); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java index b2d872217d..e4e3cfc9ce 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java @@ -3368,7 +3368,6 @@ else if (material.hasModernData() && material.getModernData() instanceof org.buk // @description // If the location is part of a double-block structure (double chests, double plants, doors, beds, etc), // returns the location of the other block in the double-block structure. - // You can test if this will be valid with <@link tag MaterialTag.is_bisected>. // --> registerTag("other_block", (attribute, object) -> { Block b = object.getBlockForTag(attribute); diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/TakeCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/TakeCommand.java index bb6e2b8fee..6296523c5c 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/TakeCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/TakeCommand.java @@ -72,7 +72,7 @@ public TakeCommand() { // // If an economy is registered, using 'money' instead of an item will take money from the player's economy balance. // - // Material, Flagged, Slot, Bydisplay, and Scriptname all sort a list as input to take multiple different item types at once. + // Flagged, Slot, Bydisplay all take a list as input to take multiple different item types at once. // // If no quantity is specified, exactly 1 item will be taken. // @@ -92,7 +92,7 @@ public TakeCommand() { // // @Usage // Use to take an arrow from the player's enderchest - // - take material:arrow from: + // - take item:arrow from: // // @Usage // Use to take the current holding item from the player's hand @@ -100,7 +100,7 @@ public TakeCommand() { // // @Usage // Use to take 5 emeralds from the player's inventory - // - take material:emerald quantity:5 + // - take item:emerald quantity:5 // --> private enum Type {MONEY, XP, ITEMINHAND, CURSORITEM, ITEM, INVENTORY, BYDISPLAY, SLOT, BYCOVER, SCRIPTNAME, NBT, MATERIAL, FLAGGED, MATCHER} @@ -121,6 +121,16 @@ else if (arg.startsWith("scriptname:")) { addOne.accept("scriptname:" + itemScript); } } + else if (arg.startsWith("item:")) { + for (Material material : Material.values()) { + if (material.isItem()) { + addOne.accept("item:" + material.name()); + } + } + for (String itemScript : ItemScriptHelper.item_scripts.keySet()) { + addOne.accept("item:" + itemScript); + } + } } @Override