From 0607cd71d7537a57ace787fd8e1741b7b27c1318 Mon Sep 17 00:00:00 2001 From: sovdee <10354869+sovdeeth@users.noreply.github.com> Date: Sat, 14 Dec 2024 19:00:04 -0500 Subject: [PATCH] requested changes --- .../ch/njol/skript/aliases/AliasesParser.java | 2 +- .../njol/skript/aliases/AliasesProvider.java | 6 ++-- .../java/ch/njol/skript/aliases/ItemData.java | 4 +-- .../expressions/ExprScoreboardTags.java | 2 +- .../njol/skript/util/chat/ChatMessages.java | 2 +- .../skript/bukkit/tags/SkriptTag.java | 7 ++++- .../skript/bukkit/tags/TagModule.java | 14 ++++----- .../tags/{Tags.java => TagRegistry.java} | 29 ++++++------------- .../skript/bukkit/tags/TagType.java | 7 ++--- .../bukkit/tags/elements/CondIsTagged.java | 4 +-- .../bukkit/tags/elements/EffRegisterTag.java | 24 +++++++++------ .../skript/bukkit/tags/elements/ExprTag.java | 4 +-- .../bukkit/tags/elements/ExprTagContents.java | 2 +- .../bukkit/tags/elements/ExprTagsOf.java | 7 +++-- .../bukkit/tags/elements/ExprTagsOfType.java | 7 +++-- .../bukkit/tags/sources/BukkitTagSource.java | 1 + .../bukkit/tags/sources/PaperTagSource.java | 6 ++-- .../bukkit/tags/sources/SkriptTagSource.java | 3 +- .../skript/bukkit/tags/sources/TagOrigin.java | 5 ++++ 19 files changed, 70 insertions(+), 66 deletions(-) rename src/main/java/org/skriptlang/skript/bukkit/tags/{Tags.java => TagRegistry.java} (88%) diff --git a/src/main/java/ch/njol/skript/aliases/AliasesParser.java b/src/main/java/ch/njol/skript/aliases/AliasesParser.java index e4a0891b689..62dcbcf82b4 100644 --- a/src/main/java/ch/njol/skript/aliases/AliasesParser.java +++ b/src/main/java/ch/njol/skript/aliases/AliasesParser.java @@ -538,7 +538,7 @@ protected Map parseKeyVariations(String name) { int insertPoint = -1; /** - * Tags by their names. All variations can add and overwrite them. + * TagRegistry by their names. All variations can add and overwrite them. */ Map tags = new HashMap<>(); diff --git a/src/main/java/ch/njol/skript/aliases/AliasesProvider.java b/src/main/java/ch/njol/skript/aliases/AliasesProvider.java index 1cbaa0c9cfd..0148bf8f0e1 100644 --- a/src/main/java/ch/njol/skript/aliases/AliasesProvider.java +++ b/src/main/java/ch/njol/skript/aliases/AliasesProvider.java @@ -45,7 +45,7 @@ public class AliasesProvider { private final Set materials; /** - * Tags are in JSON format. We may need GSON when merging tags + * TagRegistry are in JSON format. We may need GSON when merging tags * (which might be done if variations are used). */ private final Gson gson; @@ -89,7 +89,7 @@ public Map parseMojangson(String raw) { /** * Applies given tags to an item stack. * @param stack Item stack. - * @param tags Tags. + * @param tags TagRegistry. * @return Additional flags for the item. */ public int applyTags(ItemStack stack, Map tags) { @@ -127,7 +127,7 @@ public int applyTags(ItemStack stack, Map tags) { * Adds an alias to this provider. * @param name Name of alias without any patterns or variation blocks. * @param id Id of material. - * @param tags Tags for material. + * @param tags TagRegistry for material. * @param blockStates Block states. */ public void addAlias(AliasName name, String id, @Nullable Map tags, Map blockStates) { diff --git a/src/main/java/ch/njol/skript/aliases/ItemData.java b/src/main/java/ch/njol/skript/aliases/ItemData.java index f18812aabb8..ee3e2e17054 100644 --- a/src/main/java/ch/njol/skript/aliases/ItemData.java +++ b/src/main/java/ch/njol/skript/aliases/ItemData.java @@ -605,7 +605,7 @@ public void deserialize(Fields fields) throws StreamCorruptedException, NotSeria /** * Creates a plain copy of this ItemData. It will have same material, - * amount of 1 and same block values. Tags will also be copied, with + * amount of 1 and same block values. TagRegistry will also be copied, with * following exceptions: *
    *
  • Damage: 1.13 tag-damage is only used for actual durability. @@ -635,7 +635,7 @@ public ItemData aliasCopy() { /** * Applies tags to this item. - * @param tags Tags in Mojang's JSON format. + * @param tags TagRegistry in Mojang's JSON format. */ public void applyTags(String tags) { if (stack == null) diff --git a/src/main/java/ch/njol/skript/expressions/ExprScoreboardTags.java b/src/main/java/ch/njol/skript/expressions/ExprScoreboardTags.java index 80490af39e3..5556272ed5c 100644 --- a/src/main/java/ch/njol/skript/expressions/ExprScoreboardTags.java +++ b/src/main/java/ch/njol/skript/expressions/ExprScoreboardTags.java @@ -38,7 +38,7 @@ import ch.njol.util.Kleenean; import ch.njol.util.coll.CollectionUtils; -@Name("Scoreboard Tags") +@Name("Scoreboard TagRegistry") @Description({"Scoreboard tags are simple list of texts stored directly in the data of an entity.", "So this is a Minecraft related thing, not Bukkit, so the tags will not get removed when the server stops. " + "You can visit visit Minecraft Wiki for more info.", diff --git a/src/main/java/ch/njol/skript/util/chat/ChatMessages.java b/src/main/java/ch/njol/skript/util/chat/ChatMessages.java index b032b76207e..5c758e96810 100644 --- a/src/main/java/ch/njol/skript/util/chat/ChatMessages.java +++ b/src/main/java/ch/njol/skript/util/chat/ChatMessages.java @@ -229,7 +229,7 @@ else if (c2 == '>') } else { name = tag; } - name = name.toLowerCase(Locale.ENGLISH); // Tags are case-insensitive + name = name.toLowerCase(Locale.ENGLISH); // TagRegistry are case-insensitive boolean tryHex = Utils.HEX_SUPPORTED && name.startsWith("#"); ChatColor chatColor = null; diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/SkriptTag.java b/src/main/java/org/skriptlang/skript/bukkit/tags/SkriptTag.java index c3014703b7b..e565d0a3304 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/SkriptTag.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/SkriptTag.java @@ -11,14 +11,19 @@ import java.util.HashSet; import java.util.Set; +/** + * Represents a custom tag created by the Skript user. + * Implementation of {@link Tag} with a custom set of contents. + * @param The type of the contents. + */ public class SkriptTag implements Tag { private final Set contents; private final NamespacedKey key; public SkriptTag(NamespacedKey key, Collection contents) { - this.contents = new HashSet<>(contents); this.key = key; + this.contents = new HashSet<>(contents); } @Override diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/TagModule.java b/src/main/java/org/skriptlang/skript/bukkit/tags/TagModule.java index 6cbfd9d1e9b..7a6021548db 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/TagModule.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/TagModule.java @@ -19,8 +19,6 @@ import org.jetbrains.annotations.Nullable; import org.skriptlang.skript.lang.comparator.Comparators; import org.skriptlang.skript.lang.comparator.Relation; -import org.skriptlang.skript.lang.converter.Converter; -import org.skriptlang.skript.lang.converter.Converters; import java.io.IOException; @@ -30,15 +28,13 @@ public class TagModule { public static final boolean PAPER_TAGS_EXIST = Skript.classExists("com.destroystokyo.paper.MaterialTags"); // tag object - public static Tags TAGS; + public static TagRegistry TagRegistry; public static void load() throws IOException { // abort if no class exists if (!Skript.classExists("org.bukkit.Tag")) return; - // load classes (todo: replace with registering methods after regitration api - Skript.getAddonInstance().loadClasses("org.skriptlang.skript.bukkit", "tags"); // Classes Classes.registerClass(new ClassInfo<>(Tag.class, "minecrafttag") @@ -63,14 +59,14 @@ public String toVariableNameString(Tag tag) { } })); + // load classes (todo: replace with registering methods after registration api + Skript.getAddonInstance().loadClasses("org.skriptlang.skript.bukkit", "tags"); + // compare tags by keys, not by object instance. Comparators.registerComparator(Tag.class, Tag.class, (a, b) -> Relation.get(a.getKey().equals(b.getKey()))); - // converter to String - Converters.registerConverter(Tag.class, String.class, tag -> tag.getKey().toString(), Converter.NO_LEFT_CHAINING); - // init tags - TAGS = new Tags(); + TagRegistry = new TagRegistry(); } /** diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/Tags.java b/src/main/java/org/skriptlang/skript/bukkit/tags/TagRegistry.java similarity index 88% rename from src/main/java/org/skriptlang/skript/bukkit/tags/Tags.java rename to src/main/java/org/skriptlang/skript/bukkit/tags/TagRegistry.java index cd2915e9206..617f8abc834 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/Tags.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/TagRegistry.java @@ -27,14 +27,14 @@ /** * A class in charge of storing and handling all the tags Skript can access. */ -public class Tags { +public class TagRegistry { private final TagSourceMap tagSourceMap = new TagSourceMap(); /** * Each new instance will create a new set of tag sources, in an effort to be reload safe. */ - public Tags() { + TagRegistry() { tagSourceMap.put(TagType.ITEMS, new BukkitTagSource<>("items", TagType.ITEMS)); tagSourceMap.put(TagType.BLOCKS, new BukkitTagSource<>("blocks", TagType.BLOCKS)); tagSourceMap.put(TagType.ENTITIES, new BukkitTagSource<>("entity_types", TagType.ENTITIES)); @@ -72,7 +72,7 @@ public Tags() { * @param origin The origin to filter by. * @param typeClass The class the tags should be applicable to. * @param types Tag types to check with. Leaving this empty will check all tag types. - * @return Tags from the given origin and types that apply to the given class. + * @return TagRegistry from the given origin and types that apply to the given class. * @param see typeClass. */ public Iterable> getTags(TagOrigin origin, Class typeClass, TagType... types) { @@ -80,7 +80,7 @@ public Iterable> getTags(TagOrigin origin, Class typ if (types == null) types = tagSourceMap.map.keys().toArray(new TagType[0]); for (TagType type : types) { - if (type.type() == typeClass) { + if (typeClass.isAssignableFrom(type.type())) { //noinspection unchecked Iterator> iterator = getTags(origin, (TagType) type).iterator(); if (iterator.hasNext()) @@ -99,7 +99,7 @@ public Iterable> getTags(TagOrigin origin, Class typ * Gets all the tags of a specific origin that are of a specific type. * @param origin The origin to filter by. * @param type The type of tags to get. - * @return Tags from the given origin that are of the given type. + * @return TagRegistry from the given origin that are of the given type. * @param The class these tags apply to. */ public Iterable> getTags(TagOrigin origin, TagType type) { @@ -114,21 +114,16 @@ public Iterable> getTags(TagOrigin origin, TagType t return new Iterator<>() { // private Iterator> currentTagIter = tagSources.next().getAllTags().iterator(); - private Iterator> nextTagIter; @Override public boolean hasNext() { // does the current source have more tags if (currentTagIter.hasNext()) return true; - // is there another source in the pipeline? if so, check it. - if (nextTagIter != null) - return nextTagIter.hasNext(); - // if there's no known next source, check if have one. - // if we do, mark it as the next source. + // if we have another tag source, mark it as the next source. if (tagSources.hasNext()) { - nextTagIter = tagSources.next().getAllTags().iterator(); - return nextTagIter.hasNext(); + currentTagIter = tagSources.next().getAllTags().iterator(); + return currentTagIter.hasNext(); } return false; } @@ -138,12 +133,6 @@ public Tag next() { // if current source has more, get more. if (currentTagIter.hasNext()) return currentTagIter.next(); - // if current source is dry, switch to using the next source - if (nextTagIter != null && nextTagIter.hasNext()) { - currentTagIter = nextTagIter; - nextTagIter = null; - return currentTagIter.next(); - } throw new IllegalStateException("Called next without calling hasNext to set the next tag iterator."); } // @@ -158,7 +147,7 @@ public Tag next() { * @param origin The origin to filter by. * @param type The type of tags to get. * @param predicate A predicate to filter the tags with. - * @return Tags from the given origin that are of the given type and that pass the filter. + * @return TagRegistry from the given origin that are of the given type and that pass the filter. * @param The class these tags apply to. */ public Iterable> getMatchingTags(TagOrigin origin, TagType type, Predicate> predicate) { diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/TagType.java b/src/main/java/org/skriptlang/skript/bukkit/tags/TagType.java index ba7ab961702..6446250a3ef 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/TagType.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/TagType.java @@ -44,9 +44,7 @@ public class TagType { * @param type The class this tag type applies to. */ public TagType(String pattern, Class type) { - this.pattern = pattern; - this.type = type; - this.toString = pattern; + this(pattern, pattern, type); } /** @@ -77,7 +75,7 @@ public String toString() { * Adds types to the registered tag types. * @param type The types to add. */ - private static void addType(TagType... type) { + public static void addType(TagType... type) { REGISTERED_TAG_TYPES.addAll(List.of(type)); } @@ -120,6 +118,7 @@ private static void addType(TagType... type) { public static @NotNull String getFullPattern() { return getFullPattern(false); } + /** * @param required whether the choice should be optional or required. * @return Returns a choice pattern for use in Skript patterns. Contains parse marks. diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/CondIsTagged.java b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/CondIsTagged.java index a94836e1068..5553c27076a 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/CondIsTagged.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/CondIsTagged.java @@ -59,8 +59,8 @@ public boolean check(Event event) { return elements.check(event, element -> { boolean isAny = (element instanceof ItemType itemType && !itemType.isAll()); Keyed[] values = TagModule.getKeyed(element); - if (values == null) - return false; + if (values == null) + return false; for (Tag tag : tags) { if (isTagged(tag, values, !isAny)) { diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/EffRegisterTag.java b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/EffRegisterTag.java index def741052ea..3ea93bfbd2e 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/EffRegisterTag.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/EffRegisterTag.java @@ -42,7 +42,7 @@ "include the characters A to Z, 0 to 9, and '/', '.', '_', and '-'. Otherwise, the tag will not register.", "", "Please note that two tags can share a name if they are of different types. Registering a new tag of the same " + - "name and type will overwrite the existing tag. Tags will reset on server shutdown." + "name and type will overwrite the existing tag. TagRegistry will reset on server shutdown." }) @Examples({ "register a new custom entity tag named \"fish\" using cod, salmon, tropical fish, and pufferfish", @@ -61,7 +61,7 @@ public class EffRegisterTag extends Effect { static { Skript.registerEffect(EffRegisterTag.class, - "register [a[n]] [new] [custom] " + TagType.getFullPattern(true) + + "register [a[n]] [custom] " + TagType.getFullPattern(true) + " tag named %string% (containing|using) %entitydatas/itemtypes%"); } @@ -74,9 +74,7 @@ public boolean init(Expression[] expressions, int matchedPattern, Kleenean is //noinspection unchecked name = (Expression) expressions[0]; if (name instanceof Literal literal) { - String key = literal.getSingle(); - if (key.startsWith("skript:")) - key = key.substring(7); + String key = removeSkriptNamespace(literal.getSingle()); if (!KEY_PATTERN.matcher(key).matches()) { Skript.error("Tag names can only contain the following characters: 'a-z', '0-9', '/', '.', '_', and '-'."); return false; @@ -94,8 +92,7 @@ protected void execute(Event event) { if (name == null) return; - if (name.startsWith("skript:")) - name = name.substring(7); + name = removeSkriptNamespace(name); if (!KEY_PATTERN.matcher(name).matches()) return; @@ -121,6 +118,12 @@ protected void execute(Event event) { } } + private static @NotNull String removeSkriptNamespace(@NotNull String key) { + if (key.startsWith("skript:")) + key = key.substring(7); + return key; + } + @Contract("_, _ -> new") private @NotNull Tag getMaterialTag(NamespacedKey key, Object @NotNull [] contents) { ThreadLocalRandom random = ThreadLocalRandom.current(); @@ -132,7 +135,8 @@ protected void execute(Event event) { tagContents.add((Material) values[random.nextInt(0, values.length)]); } else { for (Keyed value : values) { - tagContents.add((Material) value); + if (value instanceof Material material) + tagContents.add(material); } } } @@ -144,7 +148,8 @@ protected void execute(Event event) { List tagContents = new ArrayList<>(); for (Object object : contents) { for (Keyed value : TagModule.getKeyed(object)) { - tagContents.add((EntityType) value); + if (value instanceof EntityType entityType) + tagContents.add(entityType); } } return new SkriptTag<>(key, tagContents); @@ -155,4 +160,5 @@ public String toString(@Nullable Event event, boolean debug) { return "register a new " + type.toString() + " tag named " + name.toString(event, debug) + " containing " + contents.toString(event, debug); } + } diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTag.java b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTag.java index 5ffeca029a5..68bf7f55555 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTag.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTag.java @@ -28,7 +28,7 @@ @Name("Tag") @Description({ "Represents a tag which can be used to classify items, blocks, or entities.", - "Tags are composed of a value and an optional namespace: \"minecraft:oak_logs\".", + "TagRegistry are composed of a value and an optional namespace: \"minecraft:oak_logs\".", "If you omit the namespace, one will be provided for you, depending on what kind of tag you're using. " + "For example, `tag \"doors\"` will be the tag \"minecraft:doors\", " + "while `paper tag \"doors\"` will be \"paper:doors\".", @@ -97,7 +97,7 @@ public boolean init(Expression[] expressions, int matchedPattern, Kleenean is Tag tag; for (TagType type : types) { - tag = TagModule.TAGS.getTag(origin, type, key); + tag = TagModule.TagRegistry.getTag(origin, type, key); if (tag != null // ensures that only datapack/minecraft tags are sent when specifically requested && (origin != TagOrigin.BUKKIT || (datapackOnly ^ tag.getKey().getNamespace().equals("minecraft"))) diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagContents.java b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagContents.java index 1a2a5fb103e..97bcf5ecd10 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagContents.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagContents.java @@ -24,7 +24,7 @@ import java.util.Objects; -@Name("Tags Contents") +@Name("TagRegistry Contents") @Description({ "Returns all the values that a tag contains.", "For item and block tags, this will return items. For entity tags, " + diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOf.java b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOf.java index 2e29dc81509..a72bd47d926 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOf.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOf.java @@ -30,7 +30,7 @@ import java.util.TreeSet; import java.util.concurrent.ThreadLocalRandom; -@Name("Tags of X") +@Name("TagRegistry of X") @Description({ "Returns all the tags of an item, block, or entity.", "`minecraft tag` will return only the vanilla tags, `datapack tag` will return only datapack-provided tags, " + @@ -50,7 +50,7 @@ public class ExprTagsOf extends PropertyExpression { static { Skript.registerExpression(ExprTagsOf.class, Tag.class, ExpressionType.PROPERTY, - "[all [of]] [the] " + TagOrigin.getFullPattern() + " " + TagType.getFullPattern() + " tags of %itemtype/entity/entitydata%", + "[all [[of] the]|the] " + TagOrigin.getFullPattern() + " " + TagType.getFullPattern() + " tags of %itemtype/entity/entitydata%", "%itemtype/entity/entitydata%'[s] " + TagOrigin.getFullPattern() + " " + TagType.getFullPattern() + " tags"); } @@ -103,7 +103,7 @@ public Collection> getTags(@NotNull T value) { List> tags = new ArrayList<>(); //noinspection unchecked Class clazz = (Class) value.getClass(); - for (Tag tag : TagModule.TAGS.getTags(origin, clazz, types)) { + for (Tag tag : TagModule.TagRegistry.getTags(origin, clazz, types)) { if (tag.isTagged(value)) tags.add(tag); } @@ -126,4 +126,5 @@ public String toString(@Nullable Event event, boolean debug) { //noinspection DataFlowIssue return origin.toString(datapackOnly) + registry + "tags of " + getExpr().toString(event, debug); } + } diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOfType.java b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOfType.java index 19abb5dcb62..961a5d6e755 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOfType.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/elements/ExprTagsOfType.java @@ -24,7 +24,7 @@ import java.util.Set; import java.util.TreeSet; -@Name("All Tags of a Type") +@Name("All TagRegistry of a Type") @Description({ "Returns all the tags.", "`minecraft tag` will return only the vanilla tags, `datapack tag` will return only datapack-provided tags, " + @@ -44,7 +44,7 @@ public class ExprTagsOfType extends SimpleExpression { static { Skript.registerExpression(ExprTagsOfType.class, Tag.class, ExpressionType.SIMPLE, - "[all [[of] the]] " + TagOrigin.getFullPattern() + " " + TagType.getFullPattern() + " tags"); + "[all [[of] the]|the] " + TagOrigin.getFullPattern() + " " + TagType.getFullPattern() + " tags"); } TagType[] types; @@ -63,7 +63,7 @@ public boolean init(Expression[] expressions, int matchedPattern, Kleenean is protected Tag @Nullable [] get(Event event) { Set> tags = new TreeSet<>(Comparator.comparing(Keyed::key)); for (TagType type : types) { - for (Tag tag : TagModule.TAGS.getMatchingTags(origin, type, + for (Tag tag : TagModule.TagRegistry.getMatchingTags(origin, type, tag -> (origin != TagOrigin.BUKKIT || (datapackOnly ^ tag.getKey().getNamespace().equals("minecraft")))) ) { tags.add(tag); @@ -87,4 +87,5 @@ public String toString(@Nullable Event event, boolean debug) { String registry = types.length > 1 ? "" : types[0].toString(); return "all of the " + origin.toString(datapackOnly) + registry + "tags"; } + } diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/BukkitTagSource.java b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/BukkitTagSource.java index 8b09a3fe3c3..ccf74ce6bd0 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/BukkitTagSource.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/BukkitTagSource.java @@ -34,4 +34,5 @@ public BukkitTagSource(String registry, TagType type) { public @Nullable Tag getTag(NamespacedKey key) { return Bukkit.getTag(registry, key, getTypes()[0].type()); } + } diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/PaperTagSource.java b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/PaperTagSource.java index ebab102bf83..49f41ed1446 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/PaperTagSource.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/PaperTagSource.java @@ -23,11 +23,11 @@ public class PaperTagSource extends CustomTagSource { * @param The class of the tags. */ private static @NotNull Iterable> getPaperTags(@NotNull Iterable> tags) { - List> modified_tags = new ArrayList<>(); + List> modifiedTags = new ArrayList<>(); for (Tag tag : tags) { - modified_tags.add(new PaperTag<>(tag)); + modifiedTags.add(new PaperTag<>(tag)); } - return modified_tags; + return modifiedTags; } /** diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/SkriptTagSource.java b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/SkriptTagSource.java index 16c3b1e4732..e5ee280a409 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/SkriptTagSource.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/SkriptTagSource.java @@ -14,7 +14,7 @@ public class SkriptTagSource extends CustomTagSource { public static final SkriptTagSource ENTITIES = new SkriptTagSource<>(TagType.ENTITIES); /** - * @param types The tag types this source will represent. + * @param types The tag types this source will represent. */ @SafeVarargs public SkriptTagSource(TagType... types) { @@ -24,4 +24,5 @@ public SkriptTagSource(TagType... types) { public void addTag(Tag tag) { tags.put(tag.getKey(), tag); } + } diff --git a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/TagOrigin.java b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/TagOrigin.java index b2f76014b5c..af08bb5331f 100644 --- a/src/main/java/org/skriptlang/skript/bukkit/tags/sources/TagOrigin.java +++ b/src/main/java/org/skriptlang/skript/bukkit/tags/sources/TagOrigin.java @@ -7,6 +7,10 @@ import java.util.List; +/** + * The origin of a tag, eg. from Bukkit, from Paper, from a custom Skript tag, or from anywhere. + * Used for classification and filtering tags. + */ public enum TagOrigin { /** * Bukkit supplies both native minecraft tags and datapack tags. @@ -84,4 +88,5 @@ public boolean matches(TagOrigin other) { case ANY -> ""; }; } + }