Skip to content

Commit

Permalink
Made item rarity tests not run before their respective implementing v…
Browse files Browse the repository at this point in the history
…ersions; potentially fixed item frame tests.
  • Loading branch information
JakeGBLP committed Jan 26, 2025
1 parent 3289493 commit 6dbed27
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import ch.njol.skript.aliases.ItemType;
import ch.njol.skript.classes.Changer;
import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Examples;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.doc.*;
import ch.njol.skript.expressions.base.SimplePropertyExpression;
import org.bukkit.event.Event;
import org.bukkit.inventory.ItemRarity;
Expand All @@ -18,6 +15,7 @@
@Description("Returns the rarity of an item.\nCan be set.\n\nBefore Lusk 1.2 (and Minecraft 1.20.5), this expression returned strings and also worked for enchantments, due to some major changes enchantments no longer have a rarity.")
@Examples({"broadcast item rarity of tool", "set item rarity of {_sword} to epic"})
@Since("1.0.0, 1.2 (ItemRarity)")
@RequiredPlugins("1.20.5")
@SuppressWarnings("unused")
public class ExprRarity extends SimplePropertyExpression<ItemType,ItemRarity> {
//todo: add tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package it.jakegblp.lusk.elements.minecraft.item.expressions;

import ch.njol.skript.Skript;
import ch.njol.skript.aliases.ItemType;
import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Examples;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.doc.*;
import ch.njol.skript.expressions.base.SimplePropertyExpression;
import ch.njol.skript.util.SkriptColor;
import net.kyori.adventure.text.format.TextColor;
Expand All @@ -21,6 +17,7 @@
@Description("Returns the color of an item's rarity.\nCan be used with the item itself and it will get its rarity's color without getting the rarity itself if you don't need it.")
@Examples({"broadcast rarity color of tool", "broadcast rarity color of item rarity of heart of the sea"})
@Since("1.0.0, 1.2 (ItemRarity)")
@RequiredPlugins("1.20.5")
@SuppressWarnings("unused")
public class ExprRarityColor extends SimplePropertyExpression<Object, SkriptColor> {
static {
Expand Down
4 changes: 3 additions & 1 deletion src/test/scripts/conditions/CondItemFrameFixed.sk
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
test "CondItemFrameFixed":
spawn item frame at location(1,3,3):
set {_location} to location(1,3,3)
set block at {_location} to air
spawn item frame at {_location}:
assert item frame entity is not fixed with "item frame is fixed instead of not fixed"
set itemframe is fixed property of entity to true
assert item frame entity is fixed with "item frame is not fixed instead of fixed"
Expand Down
4 changes: 3 additions & 1 deletion src/test/scripts/expressions/ExprItemFrameDropChance.sk
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
test "ExprItemFrameDropChance":
spawn item frame at location(1,2,3):
set {_location} to location(1,2,3)
set block at {_location} to air
spawn item frame at {_location}:
assert item frame drop chance of entity = 1 with "item frame drop chance of %entity% is equal to %item frame drop chance of entity% instead of 1"
set item frame drop chance of entity to 0
assert item frame drop chance of entity = 0 with "item frame drop chance of %entity% is equal to %item frame drop chance of entity% instead of 0"
Expand Down
4 changes: 3 additions & 1 deletion src/test/scripts/expressions/ExprItemFrameIsFixed.sk
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
test "ExprItemFrameIsFixed":
spawn item frame at location(2,3,3):
set {_location} to location(2,3,3)
set block at {_location} to air
spawn item frame at {_location}:
assert itemframe is fixed property of entity is false with "item frame is fixed property is true instead of false"
set itemframe is fixed property of entity to true
assert itemframe is fixed property of entity is true with "item frame is fixed property is false instead of true"
Expand Down
4 changes: 2 additions & 2 deletions src/test/scripts/expressions/ExprRarity.sk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test "ExprRarity":
test "ExprRarity" when running minecraft "1.20.5":
set {_item} to iron sword
set item rarity of {_item} to epic
assert item rarity of {_item} is epic with "item rarity of iron sword %{_item}% is not epic"
assert {_item} is epic with "item rarity state of iron sword %{_item}% is not epic"
assert {_item} is epic with "item rarity of iron sword %{_item}% is not epic"

0 comments on commit 6dbed27

Please sign in to comment.