Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: LimeGlass <[email protected]>
  • Loading branch information
cheeezburga and TheLimeGlass authored Jun 16, 2024
1 parent 444d6a8 commit 038e77e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/main/java/ch/njol/skript/conditions/CondTooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"send true if entire tooltip of player's tool is shown",
"if additional tooltip of {_item} is hidden:"
})
@RequiredPlugins("Spigot 1.20.5+")
@Since("INSERT VERSION")
@RequiredPlugins("MC 1.20.5+")
public class CondTooltip extends Condition {

static {
Expand All @@ -61,8 +61,8 @@ public class CondTooltip extends Condition {
private Expression<ItemType> items;
private boolean entire;

@SuppressWarnings("unchecked")
@Override
@SuppressWarnings("unchecked")
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
items = (Expression<ItemType>) exprs[0];
entire = !parseResult.hasTag("additional");
Expand All @@ -79,7 +79,7 @@ public boolean check(Event event) {

@Override
public String toString(@Nullable Event event, boolean debug) {
return "the " + (entire ? "entire" : "additional") + " tooltip of " + items.toString(event, debug) + " is " + (isNegated() ? "hidden" : "shown");
return (entire ? "entire" : "additional") + " tooltip of " + items.toString(event, debug) + " is " + (isNegated() ? "hidden" : "shown");
}

}
4 changes: 2 additions & 2 deletions src/main/java/ch/njol/skript/effects/EffTooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"hide the entire tooltip of player's tool",
"hide {_item}'s additional tool tip"
})
@RequiredPlugins("Spigot 1.20.5+")
@Since("INSERT VERSION")
@RequiredPlugins("MC 1.20.5+")
public class EffTooltip extends Effect {

static {
Expand All @@ -59,8 +59,8 @@ public class EffTooltip extends Effect {
private Expression<ItemType> items;
private boolean show, entire;

@SuppressWarnings("unchecked")
@Override
@SuppressWarnings("unchecked")
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
items = (Expression<ItemType>) exprs[0];
show = parseResult.hasTag("show");
Expand Down
8 changes: 4 additions & 4 deletions src/test/skript/tests/syntaxes/conditions/CondTooltip.sk
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
test "tooltip" when running minecraft "1.20.5":

set {_item} to diamond
set {_item} to a diamond
assert entire tooltip of {_item} is shown with "item unexpectedly doesn't have entire tooltip"
assert additional tooltip of {_item} is shown with "item unexpectedly doesn't have additional tooltip"

hide entire tooltip of {_item}
hide additional tooltip of {_item}
assert entire tooltip of {_item} is hidden with "item unexpectedly has entire tooltip"
assert entire tooltip of {_item} is hidden with "item unexpectedly has additional tooltip"
hide additional tooltip of {_item}
assert additional tooltip of {_item} is hidden with "item unexpectedly has additional tooltip"

show entire tooltip of {_item}
show additional tooltip of {_item}
assert entire tooltip of {_item} is shown with "item unexpectedly doesn't have entire tooltip"
show additional tooltip of {_item}
assert additional tooltip of {_item} is shown with "item unexpectedly doesn't have additional tooltip"

0 comments on commit 038e77e

Please sign in to comment.