Skip to content

Commit

Permalink
disregard spigot and rename HIDE_POTION_EFFECTS to ITEM_DATA
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 4, 2020
1 parent 60c62a8 commit c0038af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Expand Up @@ -17,9 +17,8 @@ public class SheepDyedScriptEvent extends BukkitScriptEvent implements Listener
// <--[event]
// @Events
// sheep dyed (<color>)
// player dyes sheep (<color>)
//
// @Regex ^on (sheep dyed|player dyes sheep) [^\s]+$
// @Regex ^on sheep dyed [^\s]+$
//
// @Group Entity
//
Expand All @@ -29,7 +28,7 @@ public class SheepDyedScriptEvent extends BukkitScriptEvent implements Listener
//
// @Warning Determine color will not update the clientside, use - wait 1t and adjust <context.entity> color:YOUR_COLOR to force-update.
//
// @Triggers when a sheep is dyed by a player.
// @Triggers when a sheep is dyed.
//
// @Context
// <context.entity> returns the EntityTag of the sheep.
Expand All @@ -38,8 +37,6 @@ public class SheepDyedScriptEvent extends BukkitScriptEvent implements Listener
// @Determine
// ElementTag that matches DyeColor to dye it a different color.
//
// @Player when a player dyes a sheep, and using the 'player dyes sheep' event.
//
// -->

public SheepDyedScriptEvent() {
Expand Down
Expand Up @@ -57,7 +57,12 @@ public ListTag hides() {
ItemStack itemStack = item.getItemStack();
if (itemStack.hasItemMeta()) {
for (ItemFlag flag : itemStack.getItemMeta().getItemFlags()) {
output.add(flag.name().substring("HIDE_".length()));
if (flag == ItemFlag.HIDE_POTION_EFFECTS) {
output.add("ITEM_DATA");
}
else {
output.add(flag.name().substring("HIDE_".length()));
}
}
}
return output;
Expand All @@ -79,8 +84,8 @@ public ObjectTag getObjectAttribute(Attribute attribute) {
// @group properties
// @description
// Returns a list of item data types to be hidden from view on this item.
// Valid hide types include: ATTRIBUTES, DESTROYS, ENCHANTS, PLACED_ON, POTION_EFFECTS, and UNBREAKABLE
// NOTE: 'POTION_EFFECTS' also hides banner patterns.
// Valid hide types include: ATTRIBUTES, DESTROYS, ENCHANTS, PLACED_ON, ITEM_DATA, and UNBREAKABLE
// ITEM_DATA hides potion effects, banner patterns, etc.
// -->
if (attribute.startsWith("hides")) {
return hides().getObjectAttribute(attribute.fulfill(1));
Expand Down Expand Up @@ -118,7 +123,8 @@ public void adjust(Mechanism mechanism) {
// @input ListTag
// @description
// Sets the item's list of data types to hide.
// Valid hide types include: ATTRIBUTES, DESTROYS, ENCHANTS, PLACED_ON, POTION_EFFECTS, UNBREAKABLE, or ALL.
// Valid hide types include: ATTRIBUTES, DESTROYS, ENCHANTS, PLACED_ON, ITEM_DATA, UNBREAKABLE, or ALL.
// ITEM_DATA hides potion effects, banner patterns, etc.
// Use "ALL" to automatically hide all hideable item data.
// @tags
// <ItemTag.hides>
Expand All @@ -138,6 +144,9 @@ public void adjust(Mechanism mechanism) {
if (str.equals("HIDE_ALL")) {
meta.addItemFlags(ItemFlag.values());
}
else if (str.equals("HIDE_ITEM_DATA")) {
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
}
else {
meta.addItemFlags(ItemFlag.valueOf(str));
}
Expand Down

0 comments on commit c0038af

Please sign in to comment.