diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec67eac4..b7f1cf0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,16 +54,15 @@ jobs: strategy: matrix: - java-version: [17, 18, 19] - java-vendor: [temurin, zulu] + java-version: [8, 11, 17] - name: Build Java ${{ matrix.java-version }}-${{ matrix.java-vendor }} + name: Build Java ${{ matrix.java-version }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java-version }} uses: actions/setup-java@v4 with: - distribution: ${{ matrix.java-vendor }} + distribution: 'temurin' java-version: ${{ matrix.java-version }} cache: 'gradle' - name: Change Permissions @@ -121,3 +120,39 @@ jobs: run: ./gradlew :starcosmetics-api:clean :starcosmetics-api:javadoc - name: Deploy JavaDoc run: bash javadoc.sh ${GITHUB_SHA::7} + + test-server: + runs-on: ubuntu-latest + timeout-minutes: 360 + needs: test + + strategy: + matrix: + version: [1.16.5, 1.15.2, 1.14.4, 1.13.2, 1.12.2, 1.11.2, 1.10.2, 1.9.4] + java-version: [8] + include: + - version: 1.19.4 + java-version: 17 + - version: 1.20.4 + java-version: 17 + + name: Test Plugin on MC ${{ matrix.version }} + steps: + - uses: actions/checkout@v4 + - name: Setup JDK ${{ matrix.java-version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java-version }} + distribution: 'temurin' + cache: 'gradle' + - name: Change Permissions + run: chmod +x ./gradlew + - name: Build Plugin + run: ./gradlew clean assemble + - name: Test Plugin - ${{ matrix.version }} + uses: GamerCoder215/TestMC@v1.0.1 + with: + path: 'plugin/build/libs/starcosmetics-*.jar' + runtime: 'paper' + version: ${{ matrix.version }} + time: 120 \ No newline at end of file diff --git a/README.md b/README.md index 095a75bd..05a9e321 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,16 @@ Featuring things from Projectile Trails, Particle Rings, Custom Structures, Pets ## 📓 Changelog +🛠ī¸ v1.3.2 - February 4, 2024 +- Fix Legacy Issues (1.9-1.12.2) +- Add Additional Testing Measures +- Dependency Updates +- Allow Disable Cosmetics by Parent Namespace + - Includes Disable Cosmetics API +- Add Enable/Disable Cosmetic Commands for Admins +- Fix Java 8 Compatibility +- Other Minor Bug Fixes & Optimizations + đŸĒŠ v1.3.1 - December 22, 2023 - Add 1.20.3+ Support & Cosmetics - Fix Additional 1.20.2 Bugs diff --git a/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/StarAnimator.java b/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/StarAnimator.java index 8a4d4bbc..ffc66748 100644 --- a/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/StarAnimator.java +++ b/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/StarAnimator.java @@ -49,19 +49,19 @@ of this software and associated documentation files (the "Software"), to deal */ public final class StarAnimator { - public static Set animators = new HashSet<>(); + public static final Set animators = new HashSet<>(); public static void updateAll() { animators.forEach(StarAnimator::update); } - private UUID owner; - private ArmorStand armorStand; + private final UUID owner; + private final ArmorStand armorStand; private int length; private Frame[] frames; private boolean stopped = false; private int currentFrame; - private Location startLocation; + private final Location startLocation; private void readFrames(InputStream stream) { if (stream == null) throw new IllegalArgumentException("Null input stream for animation file"); diff --git a/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/Wrapper.java b/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/Wrapper.java index 53740377..0dd0805d 100644 --- a/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/Wrapper.java +++ b/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/Wrapper.java @@ -164,7 +164,9 @@ static StructureReader getStructureReader(Reader r) { } } - int getCommandVersion(); + default int getCommandVersion() { + return 2; + } boolean isItem(Material m); @@ -259,8 +261,4 @@ static void sendError(CommandSender sender, String key) { sender.sendMessage(getMessage(key, ChatColor.RED)); } - static void sendWithArgs(CommandSender sender, String key, Object... args) { - sender.sendMessage(String.format(get(key), args)); - } - } diff --git a/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapper.java b/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapper.java index ee8c3b3d..5cb64436 100644 --- a/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapper.java +++ b/abstraction/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapper.java @@ -605,6 +605,61 @@ default void emote(@NotNull Player p, @Nullable String emote) { } } + default void disableCosmetic(CommandSender sender, String loc) { + if (!sender.hasPermission("starcosmetics.admin.disable_cosmetics")) { + sendError(sender, "error.permission"); + return; + } + + boolean somethingHappened = false; + + if (StarConfig.getRegistry().getByFullKey(loc) != null) { + CosmeticLocation c = StarConfig.getRegistry().getByFullKey(loc); + StarConfig.getConfig().disableCosmetic(c); + somethingHappened = true; + } + + if (StarConfig.getRegistry().getByNamespace(loc) != null) { + Cosmetic c = StarConfig.getRegistry().getByNamespace(loc); + StarConfig.getConfig().disableCosmetic(c); + somethingHappened = true; + } + + if (!somethingHappened) { + sendError(sender, "error.argument.cosmetic"); + return; + } + + sender.sendMessage(prefix() + ChatColor.GREEN + get("success.cosmetics.disabled")); + } + + default void enableCosmetic(CommandSender sender, String loc) { + if (!sender.hasPermission("starcosmetics.admin.enable_cosmetics")) { + sendError(sender, "error.permission"); + return; + } + + boolean somethingHappened = false; + if (StarConfig.getRegistry().getByFullKey(loc) != null) { + CosmeticLocation c = StarConfig.getRegistry().getByFullKey(loc); + StarConfig.getConfig().enableCosmetic(c); + somethingHappened = true; + } + + if (StarConfig.getRegistry().getByNamespace(loc) != null) { + Cosmetic c = StarConfig.getRegistry().getByNamespace(loc); + StarConfig.getConfig().enableCosmetic(c); + somethingHappened = true; + } + + if (!somethingHappened) { + sendError(sender, "error.argument.cosmetic"); + return; + } + + sender.sendMessage(prefix() + ChatColor.GREEN + get("success.cosmetics.enabled")); + } + // Utilities static long getCosmeticCount(TrailType t) { diff --git a/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/TestStarSound.java b/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/TestStarSound.java index 1ae9b3d1..f2667855 100644 --- a/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/TestStarSound.java +++ b/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/TestStarSound.java @@ -10,7 +10,7 @@ public class TestStarSound { @DisplayName("Test StarSound") public void testStarSound() { for (StarSound sound : StarSound.values()) - Assertions.assertTrue(sound.sounds.size() > 0); + Assertions.assertTrue(!sound.sounds.isEmpty()); } } diff --git a/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/inventory/MockStarInventory.java b/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/inventory/MockStarInventory.java index e089ee12..7eb60814 100644 --- a/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/inventory/MockStarInventory.java +++ b/abstraction/src/test/java/me/gamercoder215/starcosmetics/util/inventory/MockStarInventory.java @@ -12,7 +12,7 @@ public class MockStarInventory implements StarInventory { private final Map attributes = new HashMap<>(); - private String key; + private final String key; public MockStarInventory(String key) { this.key = key; diff --git a/api/src/main/java/me/gamercoder215/starcosmetics/api/StarConfig.java b/api/src/main/java/me/gamercoder215/starcosmetics/api/StarConfig.java index 3872eaf8..22bfba96 100644 --- a/api/src/main/java/me/gamercoder215/starcosmetics/api/StarConfig.java +++ b/api/src/main/java/me/gamercoder215/starcosmetics/api/StarConfig.java @@ -1,6 +1,7 @@ package me.gamercoder215.starcosmetics.api; import com.google.common.collect.Iterables; +import me.gamercoder215.starcosmetics.api.cosmetics.Cosmetic; import me.gamercoder215.starcosmetics.api.cosmetics.CosmeticLocation; import me.gamercoder215.starcosmetics.api.cosmetics.CosmeticRegistry; import me.gamercoder215.starcosmetics.api.cosmetics.structure.Structure; @@ -15,6 +16,7 @@ import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.Unmodifiable; import java.io.File; import java.io.IOException; @@ -352,12 +354,38 @@ default String getWithArgs(String key, String def, Object... args) { StructureReader getStructureReader(@NotNull Reader reader); /** - * Fetches a list of all disabled cosmetics. + * Fetches an immutable set of all disabled cosmetics. * @return Disabled Cosmetics */ @NotNull + @Unmodifiable Set> getDisabledCosmetics(); + /** + * Disables a cosmetic. + * @param loc Cosmetic Location + */ + void disableCosmetic(@NotNull CosmeticLocation loc); + + /** + * Disables all cosmetics with the given Cosmetic Parent. + * @param c Cosmetic Parent + */ + void disableCosmetic(@NotNull Cosmetic c); + + /** + *

Enables all cosmetics with the parent. This method will silently fail if the cosmetic is not disabled.

+ *

If any cosmetic locations are explicity disabled with this parent, they will be removed.

+ * @param c Cosmetic Parent + */ + void enableCosmetic(@NotNull Cosmetic c); + + /** + * Enables a cosmetic. This method will silently fail if the cosmetic is not disabled. + * @param loc Cosmetic Location + */ + void enableCosmetic(@NotNull CosmeticLocation loc); + /** * Whether pets can play their ambient sound. * @return true if enabled, else false diff --git a/api/src/main/resources/lang/starcosmetics.properties b/api/src/main/resources/lang/starcosmetics.properties index 381eae4c..7eeef486 100644 --- a/api/src/main/resources/lang/starcosmetics.properties +++ b/api/src/main/resources/lang/starcosmetics.properties @@ -202,6 +202,8 @@ cosmetics.gadgets.flamethrower=Flamethrower cosmetics.gadgets.soul_flamethrower=Soul Flamethrower cosmetics.gadgets.raygun=Raygun cosmetics.gadgets.riptide=Riptide +success.cosmetics.disabled=Successfully disabled cosmetic(s)! +success.cosmetics.enabled=Successfully enabled cosmetic(s)! diff --git a/api/src/main/resources/lang/starcosmetics_de.properties b/api/src/main/resources/lang/starcosmetics_de.properties index 4e424cd9..1ecb9f06 100644 --- a/api/src/main/resources/lang/starcosmetics_de.properties +++ b/api/src/main/resources/lang/starcosmetics_de.properties @@ -202,6 +202,8 @@ cosmetics.gadgets.flamethrower=Flammenwerfer cosmetics.gadgets.soul_flamethrower=Seelenflammenwerfer cosmetics.gadgets.raygun=Strahlenpistole cosmetics.gadgets.riptide=Springfluten +success.cosmetics.disabled=Kosmetische(s) Kosmetik(en) erfolgreich deaktiviert! +success.cosmetics.enabled=Kosmetik(e) erfolgreich aktiviert! diff --git a/api/src/main/resources/lang/starcosmetics_es.properties b/api/src/main/resources/lang/starcosmetics_es.properties index 332b3c79..b0eaf1d4 100644 --- a/api/src/main/resources/lang/starcosmetics_es.properties +++ b/api/src/main/resources/lang/starcosmetics_es.properties @@ -202,6 +202,8 @@ cosmetics.gadgets.flamethrower=Echador de Llama cosmetics.gadgets.soul_flamethrower=Lanzallamas del Alma cosmetics.gadgets.raygun=Pistola de Rayos cosmetics.gadgets.riptide=Contracorrientes +success.cosmetics.disabled=Cosm\u00E9tico(s) desactivado(s) con \u00E9xito! +success.cosmetics.enabled=Cosm\u00E9ticos habilitados exitosamente! diff --git a/api/src/main/resources/lang/starcosmetics_fr.properties b/api/src/main/resources/lang/starcosmetics_fr.properties index 62328f5b..aba1ee28 100644 --- a/api/src/main/resources/lang/starcosmetics_fr.properties +++ b/api/src/main/resources/lang/starcosmetics_fr.properties @@ -202,6 +202,8 @@ cosmetics.gadgets.flamethrower=Lance-flammes cosmetics.gadgets.soul_flamethrower=Lance-flammes D'\u00E2me cosmetics.gadgets.raygun=Raygun cosmetics.gadgets.riptide=Contre-Courants +success.cosmetics.disabled=Cosm\u00E9tique(s) d\u00E9sactiv\u00E9(s) avec succ\u00E8s! +success.cosmetics.enabled=Cosm\u00E9tique(s) activ\u00E9(s) avec succ\u00E8s! diff --git a/api/src/main/resources/lang/starcosmetics_it.properties b/api/src/main/resources/lang/starcosmetics_it.properties index 878fb0ab..be7f4962 100644 --- a/api/src/main/resources/lang/starcosmetics_it.properties +++ b/api/src/main/resources/lang/starcosmetics_it.properties @@ -202,6 +202,8 @@ cosmetics.gadgets.flamethrower=Lanciafiamme cosmetics.gadgets.soul_flamethrower=Lanciafiamme dell'Anima cosmetics.gadgets.raygun=Fucile a Raggi cosmetics.gadgets.riptide=Maree +success.cosmetics.disabled=Cosmetici disabilitati con successo! +success.cosmetics.enabled=Cosmetici abilitati con successo! diff --git a/api/src/main/resources/lang/starcosmetics_ja.properties b/api/src/main/resources/lang/starcosmetics_ja.properties index 9abb5463..4731858e 100644 --- a/api/src/main/resources/lang/starcosmetics_ja.properties +++ b/api/src/main/resources/lang/starcosmetics_ja.properties @@ -202,6 +202,8 @@ cosmetics.gadgets.flamethrower=\u706B\u708E\u653E\u5C04\u5668 cosmetics.gadgets.soul_flamethrower=\u30BD\u30A6\u30EB\u706B\u708E\u653E\u5C04\u5668 cosmetics.gadgets.raygun=\u5149\u7DDA\u9283 cosmetics.gadgets.riptide=\u30EA\u30C3\u30D7\u30BF\u30A4\u30C9 +success.cosmetics.disabled=\u30B3\u30B9\u30E1\u30C6\u30A3\u30C3\u30AF\u306E\u7121\u52B9\u5316\u306B\u6210\u529F\u3057\u307E\u3057\u305F! +success.cosmetics.enabled=\u5316\u7CA7\u54C1\u304C\u6B63\u5E38\u306B\u6709\u52B9\u306B\u306A\u308A\u307E\u3057\u305F! diff --git a/api/src/main/resources/lang/starcosmetics_pt.properties b/api/src/main/resources/lang/starcosmetics_pt.properties index 89023ccc..4c3c8ff8 100644 --- a/api/src/main/resources/lang/starcosmetics_pt.properties +++ b/api/src/main/resources/lang/starcosmetics_pt.properties @@ -202,6 +202,8 @@ cosmetics.gadgets.flamethrower=Lan\u00E7a-Chamas cosmetics.gadgets.soul_flamethrower=Lan\u00E7a-chamas de Alma cosmetics.gadgets.raygun=Arma de Raio cosmetics.gadgets.riptide=Contracorrentes +success.cosmetics.disabled=Cosm\u00E9ticos desativados com sucesso! +success.cosmetics.enabled=Cosm\u00E9ticos ativados com sucesso! diff --git a/api/src/main/resources/lang/starcosmetics_zh.properties b/api/src/main/resources/lang/starcosmetics_zh.properties index 4f2f9e65..ba5d8582 100644 --- a/api/src/main/resources/lang/starcosmetics_zh.properties +++ b/api/src/main/resources/lang/starcosmetics_zh.properties @@ -202,5 +202,7 @@ cosmetics.gadgets.flamethrower=\u55B7\u706B\u5668 cosmetics.gadgets.soul_flamethrower=\u7075\u9B42\u706B\u7130\u55B7\u5C04\u5668 cosmetics.gadgets.raygun=\u5C04\u7EBF\u67AA cosmetics.gadgets.riptide=\u6FC0\u6D41 +success.cosmetics.disabled=\u6210\u529F\u7981\u7528\u5316\u5986\u54C1! +success.cosmetics.enabled=\u6210\u529F\u542F\u7528\u5316\u5986\u54C1! diff --git a/build.gradle.kts b/build.gradle.kts index 6b91a504..8d1345a2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ plugins { } val pGroup = "me.gamercoder215.starcosmetics" -val pVersion = "1.3.1" +val pVersion = "1.3.2" val pAuthor = "GamerCoder215" sonarqube { @@ -129,7 +129,7 @@ subprojects { csv.required.set(false) xml.required.set(true) // SonarCloud - xml.outputLocation.set(layout.buildDirectory.file("jacoco/jacoco.xml")); + xml.outputLocation.set(layout.buildDirectory.file("jacoco/jacoco.xml")) html.required.set(true) html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml")) diff --git a/nms/1_10_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_10_R1/Wrapper1_10_R1.java b/nms/1_10_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_10_R1/Wrapper1_10_R1.java index 370d708a..f93e061f 100644 --- a/nms/1_10_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_10_R1/Wrapper1_10_R1.java +++ b/nms/1_10_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_10_R1/Wrapper1_10_R1.java @@ -30,7 +30,7 @@ final class Wrapper1_10_R1 implements Wrapper { @Override public int getCommandVersion() { - return 2; + return 1; } @Override diff --git a/nms/1_11_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_11_R1/Wrapper1_11_R1.java b/nms/1_11_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_11_R1/Wrapper1_11_R1.java index bda915e0..2a34dbcf 100644 --- a/nms/1_11_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_11_R1/Wrapper1_11_R1.java +++ b/nms/1_11_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_11_R1/Wrapper1_11_R1.java @@ -30,7 +30,7 @@ final class Wrapper1_11_R1 implements Wrapper { @Override public int getCommandVersion() { - return 2; + return 1; } @Override diff --git a/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_12_R1/Wrapper1_12_R1.java b/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_12_R1/Wrapper1_12_R1.java index a4e2708a..32cea25f 100644 --- a/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_12_R1/Wrapper1_12_R1.java +++ b/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_12_R1/Wrapper1_12_R1.java @@ -33,7 +33,7 @@ final class Wrapper1_12_R1 implements Wrapper { @Override public int getCommandVersion() { - return 2; + return 1; } @Override diff --git a/nms/1_13_R2/build.gradle.kts b/nms/1_13_R2/build.gradle.kts index 9f9a460f..fbe638a6 100644 --- a/nms/1_13_R2/build.gradle.kts +++ b/nms/1_13_R2/build.gradle.kts @@ -1,5 +1,5 @@ val mcVersion = "1.13.2" -val lampVersion = "3.1.5" +val lampVersion = "3.1.8" dependencies { api(project(":starcosmetics-abstraction")) diff --git a/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV2.java b/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV2.java index 9ef7594f..bf654af1 100644 --- a/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV2.java +++ b/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV2.java @@ -2,6 +2,7 @@ import me.gamercoder215.starcosmetics.api.StarConfig; import me.gamercoder215.starcosmetics.api.cosmetics.Cosmetic; +import me.gamercoder215.starcosmetics.api.cosmetics.CosmeticLocation; import me.gamercoder215.starcosmetics.api.cosmetics.CosmeticRegistry; import me.gamercoder215.starcosmetics.api.cosmetics.emote.Emote; import me.gamercoder215.starcosmetics.api.cosmetics.structure.StructureInfo; @@ -27,6 +28,11 @@ public CommandWrapperV2(final T plugin) { handler = BukkitCommandHandler.create(plugin); handler.getAutoCompleter() + .registerSuggestion("cosmetics", SuggestionProvider + .map(plugin::getAllCosmetics, CosmeticLocation::getFullKey) + .compose(SuggestionProvider.map(plugin::getAllParents, Cosmetic::getNamespace)) + ) + .registerSuggestion("structures", SuggestionProvider.map(plugin::getAvailableStructures, StructureInfo::getLocalizedName)) .registerSuggestion("parents", SuggestionProvider.of(PARENTS_INFO.keySet())); @@ -115,6 +121,16 @@ final class CosmeticCommands { @Subcommand("hologram") public void hologram(Player p) { wrapper.hologram(p); } + + @Subcommand("enable") + @AutoComplete("@cosmetics *") + @CommandPermission("starcosmetics.admin.enable_cosmetics") + public void enable(Player p, @Single String cosmetic) { wrapper.enableCosmetic(p, cosmetic); } + + @Subcommand("disable") + @AutoComplete("@cosmetics *") + @CommandPermission("starcosmetics.admin.disable_cosmetics") + public void disable(Player p, @Single String cosmetic) { wrapper.disableCosmetic(p, cosmetic); } } @Override diff --git a/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_13_R2/Wrapper1_13_R2.java b/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_13_R2/Wrapper1_13_R2.java index 8e319e7a..83504bf5 100644 --- a/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_13_R2/Wrapper1_13_R2.java +++ b/nms/1_13_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_13_R2/Wrapper1_13_R2.java @@ -34,10 +34,6 @@ import java.util.function.Consumer; final class Wrapper1_13_R2 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } @Override public boolean isItem(org.bukkit.Material m) { diff --git a/nms/1_14_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_14_R1/Wrapper1_14_R1.java b/nms/1_14_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_14_R1/Wrapper1_14_R1.java index 9d26ce74..246ba28e 100644 --- a/nms/1_14_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_14_R1/Wrapper1_14_R1.java +++ b/nms/1_14_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_14_R1/Wrapper1_14_R1.java @@ -35,11 +35,6 @@ final class Wrapper1_14_R1 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public boolean isItem(org.bukkit.Material m) { if (m == org.bukkit.Material.AIR) return false; diff --git a/nms/1_15_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_15_R1/Wrapper1_15_R1.java b/nms/1_15_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_15_R1/Wrapper1_15_R1.java index 6fd8c4ba..5a64a5bb 100644 --- a/nms/1_15_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_15_R1/Wrapper1_15_R1.java +++ b/nms/1_15_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_15_R1/Wrapper1_15_R1.java @@ -34,11 +34,6 @@ final class Wrapper1_15_R1 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public boolean isItem(org.bukkit.Material m) { if (m == org.bukkit.Material.AIR) return false; diff --git a/nms/1_16_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R1/Wrapper1_16_R1.java b/nms/1_16_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R1/Wrapper1_16_R1.java index 3265c749..f1eef956 100644 --- a/nms/1_16_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R1/Wrapper1_16_R1.java +++ b/nms/1_16_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R1/Wrapper1_16_R1.java @@ -34,11 +34,6 @@ final class Wrapper1_16_R1 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public boolean isItem(org.bukkit.Material m) { if (m == org.bukkit.Material.AIR) return false; diff --git a/nms/1_16_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R2/Wrapper1_16_R2.java b/nms/1_16_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R2/Wrapper1_16_R2.java index 9bc581fa..53e22249 100644 --- a/nms/1_16_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R2/Wrapper1_16_R2.java +++ b/nms/1_16_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R2/Wrapper1_16_R2.java @@ -34,11 +34,6 @@ final class Wrapper1_16_R2 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public boolean isItem(org.bukkit.Material m) { if (m == org.bukkit.Material.AIR) return false; diff --git a/nms/1_16_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R3/Wrapper1_16_R3.java b/nms/1_16_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R3/Wrapper1_16_R3.java index 966a2386..c2dc6c46 100644 --- a/nms/1_16_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R3/Wrapper1_16_R3.java +++ b/nms/1_16_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_16_R3/Wrapper1_16_R3.java @@ -33,11 +33,6 @@ final class Wrapper1_16_R3 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public boolean isItem(org.bukkit.Material m) { if (m == org.bukkit.Material.AIR) return false; diff --git a/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_17_R1/Wrapper1_17_R1.java b/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_17_R1/Wrapper1_17_R1.java index a4ebc68b..4075641a 100644 --- a/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_17_R1/Wrapper1_17_R1.java +++ b/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_17_R1/Wrapper1_17_R1.java @@ -46,11 +46,6 @@ final class Wrapper1_17_R1 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public boolean isItem(org.bukkit.Material m) { if (m == org.bukkit.Material.AIR) return false; diff --git a/nms/1_18_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R1/Wrapper1_18_R1.java b/nms/1_18_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R1/Wrapper1_18_R1.java index ae64358c..ca428e46 100644 --- a/nms/1_18_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R1/Wrapper1_18_R1.java +++ b/nms/1_18_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R1/Wrapper1_18_R1.java @@ -45,11 +45,6 @@ final class Wrapper1_18_R1 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public boolean isItem(org.bukkit.Material m) { if (m == org.bukkit.Material.AIR) return false; diff --git a/nms/1_18_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R2/Wrapper1_18_R2.java b/nms/1_18_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R2/Wrapper1_18_R2.java index 9c81b0e9..93cb5b04 100644 --- a/nms/1_18_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R2/Wrapper1_18_R2.java +++ b/nms/1_18_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_18_R2/Wrapper1_18_R2.java @@ -45,11 +45,6 @@ final class Wrapper1_18_R2 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public NBTWrapper getNBTWrapper(ItemStack item) { return new NBTWrapper1_18_R2(item); diff --git a/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R1/Wrapper1_19_R1.java b/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R1/Wrapper1_19_R1.java index d6e5a1e1..cb1e4f47 100644 --- a/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R1/Wrapper1_19_R1.java +++ b/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R1/Wrapper1_19_R1.java @@ -51,11 +51,6 @@ final class Wrapper1_19_R1 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public NBTWrapper getNBTWrapper(ItemStack item) { return new NBTWrapper1_19_R1(item); diff --git a/nms/1_19_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R2/Wrapper1_19_R2.java b/nms/1_19_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R2/Wrapper1_19_R2.java index ba5b3c9d..c8fd2e71 100644 --- a/nms/1_19_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R2/Wrapper1_19_R2.java +++ b/nms/1_19_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R2/Wrapper1_19_R2.java @@ -46,11 +46,6 @@ final class Wrapper1_19_R2 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public NBTWrapper getNBTWrapper(ItemStack item) { return new NBTWrapper1_19_R2(item); diff --git a/nms/1_19_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R3/Wrapper1_19_R3.java b/nms/1_19_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R3/Wrapper1_19_R3.java index e9503429..d197e4d0 100644 --- a/nms/1_19_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R3/Wrapper1_19_R3.java +++ b/nms/1_19_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_19_R3/Wrapper1_19_R3.java @@ -50,11 +50,6 @@ final class Wrapper1_19_R3 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public NBTWrapper getNBTWrapper(ItemStack item) { return new NBTWrapper1_19_R3(item); diff --git a/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R1/Wrapper1_20_R1.java b/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R1/Wrapper1_20_R1.java index 4f6d204b..be0e1fef 100644 --- a/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R1/Wrapper1_20_R1.java +++ b/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R1/Wrapper1_20_R1.java @@ -58,11 +58,6 @@ final class Wrapper1_20_R1 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public NBTWrapper getNBTWrapper(ItemStack item) { return new NBTWrapper1_20_R1(item); diff --git a/nms/1_20_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R2/Wrapper1_20_R2.java b/nms/1_20_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R2/Wrapper1_20_R2.java index 03db47ab..2f8e79a4 100644 --- a/nms/1_20_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R2/Wrapper1_20_R2.java +++ b/nms/1_20_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R2/Wrapper1_20_R2.java @@ -61,11 +61,6 @@ final class Wrapper1_20_R2 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public NBTWrapper getNBTWrapper(ItemStack item) { return new NBTWrapper1_20_R2(item); diff --git a/nms/1_20_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R3/Wrapper1_20_R3.java b/nms/1_20_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R3/Wrapper1_20_R3.java index d92972ff..44790443 100644 --- a/nms/1_20_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R3/Wrapper1_20_R3.java +++ b/nms/1_20_R3/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_20_R3/Wrapper1_20_R3.java @@ -62,11 +62,6 @@ final class Wrapper1_20_R3 implements Wrapper { - @Override - public int getCommandVersion() { - return 2; - } - @Override public NBTWrapper getNBTWrapper(ItemStack item) { return new NBTWrapper1_20_R3(item); diff --git a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV1.java b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV1.java index 5c0ec1df..66754f15 100644 --- a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV1.java +++ b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/commands/CommandWrapperV1.java @@ -95,6 +95,34 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String hologramInfo(p); break; } + case "disable": { + if (!sender.hasPermission("starcosmetics.admin.disable_cosmetics")) { + sendError(p, "error.permission"); + return true; + } + + if (args.length < 2) { + sendError(p, "error.argument.cosmetic"); + return true; + } + + disableCosmetic(p, args[1]); + break; + } + case "enable": { + if (!sender.hasPermission("starcosmetics.admin.enable_cosmetics")) { + sendError(p, "error.permission"); + return true; + } + + if (args.length < 2) { + sendError(p, "error.argument.cosmetic"); + return true; + } + + enableCosmetic(p, args[1]); + break; + } default: { sendError(p, "error.argument"); break; diff --git a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java index 40a8bb99..b50d8554 100644 --- a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java +++ b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java @@ -547,7 +547,7 @@ final class CosmeticSelections1_9 implements CosmeticSelections { Snowball s = cosmetic(loc.getWorld().spawn(loc, Snowball.class)); s.setVelocity(loc.getDirection().multiply(1.5)); - loc.getWorld().playSound(loc, Sound.ENTITY_SNOWBALL_THROW, 2F, r.nextFloat(0.3F, 0.6F)); + loc.getWorld().playSound(loc, Sound.ENTITY_SNOWBALL_THROW, 2F, 0.5F); }, fromMined(30, Material.SNOW_BLOCK), COMMON)) .add(new GadgetSelection("tnt_launcher", Material.TNT, loc -> { @@ -561,7 +561,7 @@ final class CosmeticSelections1_9 implements CosmeticSelections { Firework f = cosmetic(loc.getWorld().spawn(loc, Firework.class)); FireworkMeta meta = f.getFireworkMeta(); - meta.setPower(r.nextInt(1, 4)); + meta.setPower(r.nextInt(3) + 1); meta.addEffect(FireworkEffect.builder() .withColor(Color.fromRGB(r.nextInt(16777215))) .withFade(Color.fromRGB(r.nextInt(16777215))) diff --git a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R1/Wrapper1_9_R1.java b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R1/Wrapper1_9_R1.java index 3854ef78..64800cdf 100644 --- a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R1/Wrapper1_9_R1.java +++ b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R1/Wrapper1_9_R1.java @@ -28,7 +28,7 @@ final class Wrapper1_9_R1 implements Wrapper { @Override public int getCommandVersion() { - return 2; + return 1; } @Override diff --git a/nms/1_9_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R2/Wrapper1_9_R2.java b/nms/1_9_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R2/Wrapper1_9_R2.java index 073f3cce..1ee35d57 100644 --- a/nms/1_9_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R2/Wrapper1_9_R2.java +++ b/nms/1_9_R2/src/main/java/me/gamercoder215/starcosmetics/wrapper/v1_9_R2/Wrapper1_9_R2.java @@ -30,7 +30,7 @@ final class Wrapper1_9_R2 implements Wrapper { @Override public int getCommandVersion() { - return 2; + return 1; } @Override diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 8a201c74..415e8701 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,25 +1,25 @@ -val versions = listOf( - "1_9_R1", - "1_9_R2", - "1_10_R1", - "1_11_R1", - "1_12_R1", - "1_13_R1", - "1_13_R2", - "1_14_R1", - "1_15_R1", - "1_16_R1", - "1_16_R2", - "1_16_R3", - "1_17_R1", - "1_18_R1", - "1_18_R2", - "1_19_R1", - "1_19_R2", - "1_19_R3", - "1_20_R1", - "1_20_R2", - "1_20_R3" +val versions = mapOf( + "1_9_R1" to 8, + "1_9_R2" to 8, + "1_10_R1" to 8, + "1_11_R1" to 8, + "1_12_R1" to 8, + "1_13_R1" to 8, + "1_13_R2" to 8, + "1_14_R1" to 8, + "1_15_R1" to 8, + "1_16_R1" to 8, + "1_16_R2" to 8, + "1_16_R3" to 8, + "1_17_R1" to 16, + "1_18_R1" to 17, + "1_18_R2" to 17, + "1_19_R1" to 17, + "1_19_R2" to 17, + "1_19_R3" to 17, + "1_20_R1" to 17, + "1_20_R2" to 17, + "1_20_R3" to 17 ) dependencies { @@ -46,13 +46,17 @@ dependencies { // API api(project(":starcosmetics-api")) - versions.forEach { api(project(":starcosmetics-$it")) } + versions.forEach { + if (JavaVersion.current().isCompatibleWith(JavaVersion.toVersion(it.value))) + api(project(":starcosmetics-${it.key}")) + } } tasks { compileJava { - versions.subList(versions.indexOf("1_18_R1"), versions.size).forEach { dependsOn(project(":starcosmetics-$it").tasks["remap"]) } + if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) + versions.filterValues { it >= 17 }.keys.forEach { dependsOn(project(":starcosmetics-$it").tasks["remap"]) } } register("sourcesJar", Jar::class.java) { diff --git a/plugin/src/main/java/me/gamercoder215/starcosmetics/StarCosmetics.java b/plugin/src/main/java/me/gamercoder215/starcosmetics/StarCosmetics.java index ee124756..1c6103e8 100644 --- a/plugin/src/main/java/me/gamercoder215/starcosmetics/StarCosmetics.java +++ b/plugin/src/main/java/me/gamercoder215/starcosmetics/StarCosmetics.java @@ -321,11 +321,56 @@ public StructureReader getStructureReader(File file) { List disabled = config.getStringList("cosmetics.disabled"); return ImmutableSet.copyOf(disabled.stream() - .map(StarConfig.getRegistry()::getByFullKey) + .map(s -> { + Set> list = new HashSet<>(); + list.add(StarConfig.getRegistry().getByFullKey(s)); + Optional.ofNullable(StarConfig.getRegistry().getByNamespace(s)) + .map(StarConfig.getRegistry()::getAllFor) + .ifPresent(list::addAll); + + return list; + }) + .flatMap(Collection::stream) .filter(Objects::nonNull) .collect(Collectors.toSet())); } + @Override + public void disableCosmetic(@NotNull CosmeticLocation loc) { + List disabled = config.getStringList("cosmetics.disabled"); + disabled.add(loc.getFullKey()); + + config.set("cosmetics.disabled", disabled); + saveConfig(); + } + + @Override + public void disableCosmetic(@NotNull Cosmetic c) { + List disabled = config.getStringList("cosmetics.disabled"); + disabled.add(c.getNamespace()); + + config.set("cosmetics.disabled", disabled); + saveConfig(); + } + + @Override + public void enableCosmetic(@NotNull CosmeticLocation loc) { + List disabled = config.getStringList("cosmetics.disabled"); + disabled.remove(loc.getFullKey()); + + config.set("cosmetics.disabled", disabled); + saveConfig(); + } + + @Override + public void enableCosmetic(@NotNull Cosmetic c) { + List disabled = config.getStringList("cosmetics.disabled"); + disabled.removeIf(s -> s.startsWith(c.getNamespace())); + + config.set("cosmetics.disabled", disabled); + saveConfig(); + } + @Override public boolean isAmbientPetSoundEnabled() { return config.getBoolean("cosmetics.pets.ambient-sound", true); @@ -663,13 +708,7 @@ public List> getAllFor(Class parentClass for (CosmeticLocation loc : getCustomCosmetics()) if (parentClass.isInstance(loc.getParent())) locs.add(loc); - Function, Rarity> c = CosmeticLocation::getRarity; - locs.sort(Comparator.comparing(c).thenComparing(CosmeticLocation::getDisplayName)); - - return ImmutableList.copyOf(locs.stream() - .filter(l -> !getDisabledCosmetics().contains(l)) - .collect(Collectors.toList()) - ); + return sortLocations(locs); } @Override @@ -682,6 +721,10 @@ public List> getAllFor(Cosmetic parent) { for (Map.Entry>> entry : selections.entrySet()) if (entry.getKey().equals(parent)) locs.addAll(entry.getValue()); + return sortLocations(locs); + } + + private List> sortLocations(List> locs) { Function, Rarity> c = CosmeticLocation::getRarity; locs.sort(Comparator.comparing(c).thenComparing(CosmeticLocation::getDisplayName)); diff --git a/plugin/src/main/java/me/gamercoder215/starcosmetics/events/ClickEvents.java b/plugin/src/main/java/me/gamercoder215/starcosmetics/events/ClickEvents.java index 4dc81385..a66c7e4a 100644 --- a/plugin/src/main/java/me/gamercoder215/starcosmetics/events/ClickEvents.java +++ b/plugin/src/main/java/me/gamercoder215/starcosmetics/events/ClickEvents.java @@ -193,6 +193,8 @@ public void run() { StarSound.BLOCK_NOTE_BLOCK_PLING.playFailure(p); inv.getAttribute("selection_back", Consumer.class).accept(p); }); + + updateCache(p); }) .put("choose:cosmetic", (inv, e) -> { Player p = (Player) e.getWhoClicked(); diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml index 2c199005..4660a1fd 100644 --- a/plugin/src/main/resources/config.yml +++ b/plugin/src/main/resources/config.yml @@ -50,6 +50,10 @@ cosmetics: # "trail/projectile[red_flowers]" # # You can figure out a cosmetic's key by equipping it, then navigating to your player information file. + # + # As of v1.3.2, you can disable categories by inputting the parent namespace: + # "hat" + # "trail/sound" disabled: [] # The multipler against the numerical amount required for a cosmetic diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml index be727f47..d28bd406 100644 --- a/plugin/src/main/resources/plugin.yml +++ b/plugin/src/main/resources/plugin.yml @@ -32,6 +32,18 @@ permissions: children: starcosmetics.admin: true + starcosmetics.admin.disable_cosmetics: + description: Access to disable cosmetics + default: op + children: + starcosmetics.admin: true + + starcosmetics.admin.enable_cosmetics: + description: Access to enable cosmetics + default: op + children: + starcosmetics.admin: true + # User starcosmetics.user: description: Access to all StarCosmetics User Actions diff --git a/settings.gradle.kts b/settings.gradle.kts index 6576816c..a153257b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,29 +15,34 @@ listOf("api", "abstraction").forEach { project(":starcosmetics-$it").projectDir = rootDir.resolve(it) } -listOf( - "1_9_R1", - "1_9_R2", - "1_10_R1", - "1_11_R1", - "1_12_R1", - "1_13_R1", - "1_13_R2", - "1_14_R1", - "1_15_R1", - "1_16_R1", - "1_16_R2", - "1_16_R3", - "1_17_R1", - "1_18_R1", - "1_18_R2", - "1_19_R1", - "1_19_R2", - "1_19_R3", - "1_20_R1", - "1_20_R2", - "1_20_R3" +mapOf( + "1_9_R1" to 8, + "1_9_R2" to 8, + "1_10_R1" to 8, + "1_11_R1" to 8, + "1_12_R1" to 8, + "1_13_R1" to 8, + "1_13_R2" to 8, + "1_14_R1" to 8, + "1_15_R1" to 8, + "1_16_R1" to 8, + "1_16_R2" to 8, + "1_16_R3" to 8, + "1_17_R1" to 16, + "1_18_R1" to 17, + "1_18_R2" to 17, + "1_19_R1" to 17, + "1_19_R2" to 17, + "1_19_R3" to 17, + "1_20_R1" to 17, + "1_20_R2" to 17, + "1_20_R3" to 17 ).forEach { - include(":starcosmetics-$it") - project(":starcosmetics-$it").projectDir = rootDir.resolve("nms/$it") + val id = it.key + val minJava = it.value + + if (JavaVersion.current().isCompatibleWith(JavaVersion.toVersion(minJava))) { + include(":starcosmetics-$id") + project(":starcosmetics-$id").projectDir = rootDir.resolve("nms/$id") + } } \ No newline at end of file