Skip to content

Commit

Permalink
RegistryParser - strip out minecraft namespaces from docs (#6844)
Browse files Browse the repository at this point in the history
* RegistryParser - strip out minecraft namespaces from docs

* RegistryParser - Stream#toList() not available on older java versions

---------

Co-authored-by: sovdee <[email protected]>
  • Loading branch information
ShaneBeee and sovdeeth authored Jul 1, 2024
1 parent dfaacd6 commit befa81f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/main/java/ch/njol/skript/classes/data/BukkitClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,8 @@ public String toVariableNameString(final ItemStack i) {
Classes.registerClass(biomeClassInfo
.user("biomes?")
.name("Biome")
.description("All possible biomes Minecraft uses to generate a world.")
.description("All possible biomes Minecraft uses to generate a world.",
"NOTE: Minecraft namespaces are supported, ex: 'minecraft:basalt_deltas'.")
.examples("biome at the player is desert")
.since("1.4.4")
.after("damagecause"));
Expand Down Expand Up @@ -1465,7 +1466,8 @@ public String toVariableNameString(FireworkEffect effect) {
Classes.registerClass(catTypeClassInfo
.user("cat ?(type|race)s?")
.name("Cat Type")
.description("Represents the race/type of a cat entity.")
.description("Represents the race/type of a cat entity.",
"NOTE: Minecraft namespaces are supported, ex: 'minecraft:british_shorthair'.")
.since("2.4")
.requiredPlugins("Minecraft 1.14 or newer")
.documentationId("CatType"));
Expand Down Expand Up @@ -1533,7 +1535,8 @@ public String toVariableNameString(EnchantmentOffer eo) {
.user("attribute ?types?")
.name("Attribute Type")
.description("Represents the type of an attribute. Note that this type does not contain any numerical values."
+ "See <a href='https://minecraft.wiki/w/Attribute#Attributes'>attribute types</a> for more info.")
+ "See <a href='https://minecraft.wiki/w/Attribute#Attributes'>attribute types</a> for more info.",
"NOTE: Minecraft namespaces are supported, ex: 'minecraft:generic.attack_damage'.")
.since("2.5"));

Classes.registerClass(new EnumClassInfo<>(Environment.class, "environment", "environments")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;

/**
* A parser based on a {@link Registry} used to parse data from a string or turn data into a string.
Expand Down Expand Up @@ -147,8 +146,7 @@ private void refresh() {
* Note that some entries may represent the same registry object.
*/
public String getAllNames() {
List<String> strings = new ArrayList<>(parseMap.keySet());
Collections.sort(strings);
List<String> strings = parseMap.keySet().stream().filter(s -> !s.startsWith("minecraft:")).sorted().collect(Collectors.toList());
return StringUtils.join(strings, ", ");
}

Expand Down

0 comments on commit befa81f

Please sign in to comment.