Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
Update to v1.3.2 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory authored Feb 4, 2024
2 parents 5fb87f8 + 0feea6c commit 4e36916
Show file tree
Hide file tree
Showing 47 changed files with 338 additions and 156 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ of this software and associated documentation files (the "Software"), to deal
*/
public final class StarAnimator {

public static Set<StarAnimator> animators = new HashSet<>();
public static final Set<StarAnimator> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ static StructureReader getStructureReader(Reader r) {
}
}

int getCommandVersion();
default int getCommandVersion() {
return 2;
}

boolean isItem(Material m);

Expand Down Expand Up @@ -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));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class MockStarInventory implements StarInventory {

private final Map<String, Object> attributes = new HashMap<>();
private String key;
private final String key;

public MockStarInventory(String key) {
this.key = key;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<CosmeticLocation<?>> 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);

/**
* <p>Enables all cosmetics with the parent. This method will silently fail if the cosmetic is not disabled.</p>
* <p>If any cosmetic locations are explicity disabled with this parent, they will be removed.</p>
* @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
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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)!



Expand Down
2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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!



2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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!



2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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!



2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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!
2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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!



Expand Down
2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics_pt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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!



2 changes: 2 additions & 0 deletions api/src/main/resources/lang/starcosmetics_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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!


4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

val pGroup = "me.gamercoder215.starcosmetics"
val pVersion = "1.3.1"
val pVersion = "1.3.2"
val pAuthor = "GamerCoder215"

sonarqube {
Expand Down Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class Wrapper1_10_R1 implements Wrapper {

@Override
public int getCommandVersion() {
return 2;
return 1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class Wrapper1_11_R1 implements Wrapper {

@Override
public int getCommandVersion() {
return 2;
return 1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Wrapper1_12_R1 implements Wrapper {

@Override
public int getCommandVersion() {
return 2;
return 1;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion nms/1_13_R2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
val mcVersion = "1.13.2"
val lampVersion = "3.1.5"
val lampVersion = "3.1.8"

dependencies {
api(project(":starcosmetics-abstraction"))
Expand Down
Loading

0 comments on commit 4e36916

Please sign in to comment.