Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class AnvilBlockDamagedScriptEvent extends BukkitScriptEvent implements L
//
// @Determine
// "STATE:<ElementTag>" to set the anvil's new damage state.
// "BREAK:<ElementTag(Boolean)>" to set weather the anvil will break.
// "BREAK:<ElementTag(Boolean)>" to set whether the anvil will break.
// -->

public AnvilBlockDamagedScriptEvent() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.denizenscript.denizen.events.player;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.nms.NMSHandler;
import com.denizenscript.denizen.nms.NMSVersion;
import com.denizenscript.denizen.objects.ItemTag;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
Expand Down Expand Up @@ -53,7 +55,9 @@ public class PlayerRaiseLowerItemScriptEvent extends BukkitScriptEvent implement
//
// -->

public static final EnumSet<Material> raisableItems = EnumSet.of(Material.SHIELD, Material.CROSSBOW, Material.BOW, Material.TRIDENT, Material.SPYGLASS);
public static final EnumSet<Material> raisableItems = NMSHandler.getVersion().isAtLeast(NMSVersion.v1_21) ?
EnumSet.of(Material.SHIELD, Material.CROSSBOW, Material.BOW, Material.TRIDENT, Material.SPYGLASS, Material.COPPER_SPEAR, Material.DIAMOND_SPEAR, Material.GOLDEN_SPEAR, Material.IRON_SPEAR, Material.NETHERITE_SPEAR, Material.STONE_SPEAR, Material.WOODEN_SPEAR)
: EnumSet.of(Material.SHIELD, Material.CROSSBOW, Material.BOW, Material.TRIDENT, Material.SPYGLASS);
Comment on lines -56 to +60
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kinda messy imo - I'd have non-version-limited stuff inline, and then have an additional static {} block with a version check to add on extra stuff.
Can also use Tag.SPEARS instead of listing them manually.


public PlayerRaiseLowerItemScriptEvent() {
registerCouldMatcher("player raises|lowers|toggles <item>");
Expand Down