Compare commits

8 Commits
Author SHA1 Message Date
Len 4bd7b6a2cd Update to 26.2 2026-07-31 08:38:44 -05:00
Len 9a775b2702 Remove Java Toolchain 2026-07-31 08:32:18 -05:00
Len e65b4759b4 Update Gradle Stage in Jenkinsfile 2026-07-31 08:31:44 -05:00
Len f4320de479 Update gradle 2026-07-31 08:31:32 -05:00
stijn b60df9dc8d Fix frame iterator resetting mid run, improved logging
Frame iterator was resetting every run due to a shared iterator between runs, this is now unique per run.
Include frame keys for logging, log the frame spawning in debug logs.
2026-02-08 19:48:20 +01:00
stijn f6ee8eacf5 Change size type from int to float and remove validation for size greater than 1 in ParticleConfig 2026-02-07 23:25:32 +01:00
stijn caebd1fed3 Validate particle size 2026-02-07 22:50:23 +01:00
stijn 26cb4474c4 Refactor vanish handling by moving logic to FrameSpawnerPlayer and improving debug logging 2026-01-05 02:10:53 +01:00
12 changed files with 86 additions and 52 deletions
Vendored
+7 -1
View File
@@ -3,7 +3,13 @@ pipeline {
stages { stages {
stage('Gradle') { stage('Gradle') {
steps { steps {
sh 'bash gradlew shadowJar' withCredentials([usernamePassword(credentialsId: 'alttd-snapshot-user', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh '''
set +x
chmod +x gradlew
./gradlew build -PalttdSnapshotUsername=$USERNAME -PalttdSnapshotPassword=$PASSWORD
'''
}
} }
} }
stage('Archive') { stage('Archive') {
+5 -13
View File
@@ -1,20 +1,14 @@
plugins { plugins {
id("java") id("java")
id("com.gradleup.shadow") version "9.0.0-beta4" id("com.gradleup.shadow") version "9.6.1"
} }
group = "com.alttd" group = "com.alttd"
version = "1.0.0-SNAPSHOT" version = System.getenv("BUILD_NUMBER") ?: "1.0.0-SNAPSHOT"
description = "Altitude Particles plugin." description = "Altitude Particles plugin."
apply<JavaLibraryPlugin>() apply<JavaLibraryPlugin>()
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks { tasks {
withType<JavaCompile> { withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
@@ -38,12 +32,10 @@ tasks {
dependencies { dependencies {
// Cosmos // Cosmos
compileOnly("com.alttd.cosmos:cosmos-api:1.21.10-R0.1-SNAPSHOT") { compileOnly("com.alttd.cosmos:cosmos-api:26.2.build.17-stable")
isChanging = true
}
// Lombok // Lombok
compileOnly("org.projectlombok:lombok:1.18.32") compileOnly("org.projectlombok:lombok:1.18.38")
annotationProcessor("org.projectlombok:lombok:1.18.32") annotationProcessor("org.projectlombok:lombok:1.18.38")
// Premium vanish // Premium vanish
compileOnly("com.github.LeonMangler:PremiumVanishAPI:2.9.0-4") compileOnly("com.github.LeonMangler:PremiumVanishAPI:2.9.0-4")
// Jackson/Dynamic Beans Integration // Jackson/Dynamic Beans Integration
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
Vendored
+7 -8
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -112,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -170,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -203,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped. # and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.
Vendored
+3 -2
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@@ -68,11 +70,10 @@ goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
+7
View File
@@ -16,6 +16,13 @@ dependencyResolutionManagement {
password = nexusPass password = nexusPass
} }
} }
maven {
url = uri("https://repo.alttd.com/repository/alttd/")
credentials {
username = nexusUser
password = nexusPass
}
}
maven("https://repo.destro.xyz/snapshots") // Galaxy maven("https://repo.destro.xyz/snapshots") // Galaxy
maven("https://papermc.io/repo/repository/maven-public/") // Paper maven("https://papermc.io/repo/repository/maven-public/") // Paper
maven("https://jitpack.io") //PremiumVanish maven("https://jitpack.io") //PremiumVanish
@@ -150,7 +150,7 @@ public class ParticleConfig {
* @return A ParticleSet created from the ParticleData * @return A ParticleSet created from the ParticleData
*/ */
public ParticleSet convertToParticleSet(ParticleData particleData) { public ParticleSet convertToParticleSet(ParticleData particleData) {
log.info("Converting ParticleData to ParticleSet for {}", particleData.getParticleName()); log.info("Converting ParticleData to ParticleSet for [{}]", particleData.getParticleName());
List<Frame> loadedFrames = new ArrayList<>(); List<Frame> loadedFrames = new ArrayList<>();
double randomOffset = particleData.getRandomOffset(); double randomOffset = particleData.getRandomOffset();
@@ -175,7 +175,11 @@ public class ParticleConfig {
aParticleList.add(new AParticle(x, y + 0.2, z, randomOffset, particleBuilder)); aParticleList.add(new AParticle(x, y + 0.2, z, randomOffset, particleBuilder));
} }
loadedFrames.add(new Frame(aParticleList)); loadedFrames.add(new Frame(entry.getKey(), aParticleList));
}
if (Config.DEBUG) {
log.info("Loaded {} frames for [{}]", loadedFrames.size(), particleData.getParticleName());
} }
// Create and return the ParticleSet // Create and return the ParticleSet
@@ -202,6 +206,7 @@ public class ParticleConfig {
if (color != null) { if (color != null) {
particleBuilder.color(getColor(color), particleBuilder.color(getColor(color),
particleInfo.getSize()); particleInfo.getSize());
log.info("Dust particle color: {} with size: {}", color, particleInfo.getSize());
} else { } else {
log.error("Dust particle must have a color"); log.error("Dust particle must have a color");
} }
@@ -210,6 +215,7 @@ public class ParticleConfig {
particleBuilder.colorTransition(getColor(color), particleBuilder.colorTransition(getColor(color),
getColor(particleInfo.getColorGradientEnd()), getColor(particleInfo.getColorGradientEnd()),
particleInfo.getSize()); particleInfo.getSize());
log.info("Dust transition particle color start: {} with size: {}", color, particleInfo.getSize());
} else { } else {
log.error("Dust transition particle must have a color gradient start and end"); log.error("Dust transition particle must have a color gradient start and end");
} }
@@ -8,7 +8,9 @@ import com.alttd.objects.ParticleSet;
import com.alttd.storage.PlayerSettings; import com.alttd.storage.PlayerSettings;
import com.alttd.util.Logger; import com.alttd.util.Logger;
import com.destroystokyo.paper.ParticleBuilder; import com.destroystokyo.paper.ParticleBuilder;
import de.myzelyam.api.vanish.VanishAPI;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -22,7 +24,6 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
private int amount; private int amount;
private final List<Frame> frames; private final List<Frame> frames;
private Iterator<Frame> iterator;
private final Player player; private final Player player;
private final PlayerSettings playerSettings; private final PlayerSettings playerSettings;
private final APartType aPartType; private final APartType aPartType;
@@ -32,7 +33,6 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
public FrameSpawnerPlayer(int amount, List<Frame> frames, int frameDelay, Player player, PlayerSettings playerSettings, APartType aPartType, String uniqueId, boolean stationary) { public FrameSpawnerPlayer(int amount, List<Frame> frames, int frameDelay, Player player, PlayerSettings playerSettings, APartType aPartType, String uniqueId, boolean stationary) {
this.amount = amount; this.amount = amount;
this.frames = frames; this.frames = frames;
this.iterator = frames.iterator();
this.player = player; this.player = player;
this.playerSettings = playerSettings; this.playerSettings = playerSettings;
this.aPartType = aPartType; this.aPartType = aPartType;
@@ -49,36 +49,57 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
log.info("Stopped repeating task due to player offline."); log.info("Stopped repeating task due to player offline.");
return; return;
} }
if (isVanished(player)) {
log.debug("Player {} is vanished, skipping frame spawn.", player.getName());
return;
}
Location location = player.getLocation(); Location location = player.getLocation();
float yaw = location.getYaw(); float yaw = location.getYaw();
ParticleSet activeParticleSet = playerSettings.getParticles(aPartType); ParticleSet activeParticleSet = playerSettings.getParticles(aPartType);
if (activeParticleSet == null || !activeParticleSet.getParticleId().equalsIgnoreCase(uniqueId) || !playerSettings.hasActiveParticles()) { if (shouldStopTask(activeParticleSet)) return;
this.cancel();
if (Config.DEBUG)
log.info("Stopped repeating task due to player switching/disabling particles.");
return;
}
if (amount == 0) { if (amount == 0) {
this.cancel(); this.cancel();
if (Config.DEBUG) if (Config.DEBUG)
log.info("Stopped repeating task due to end of frames."); log.info("Stopped repeating task due to end of frames.");
} }
iterator = frames.iterator(); final Iterator<Frame> iterator = frames.iterator();
if (Config.DEBUG) {
log.info("Starting frame spawn for player {}.", player.getName());
}
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
if (!iterator.hasNext()) { if (!iterator.hasNext() || shouldStopTask(activeParticleSet)) {
this.cancel(); this.cancel();
return; return;
} }
Frame next = iterator.next(); Frame next = iterator.next();
if (stationary) if (Config.DEBUG) {
log.info("Spawning frame with {} particles at {} for player {}", next.getKey(), location, player.getName());
}
if (stationary) {
next.spawn(location, yaw); next.spawn(location, yaw);
else }
else {
next.spawn(player.getLocation(), player.getLocation().getYaw()); next.spawn(player.getLocation(), player.getLocation().getYaw());
}
} }
}.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay); }.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
if (amount != -1) if (amount != -1)
amount--; amount--;
} }
private boolean shouldStopTask(ParticleSet activeParticleSet) {
if (activeParticleSet == null || !activeParticleSet.getParticleId().equalsIgnoreCase(uniqueId) || !playerSettings.hasActiveParticles()) {
this.cancel();
if (Config.DEBUG)
log.info("Stopped repeating task due to player switching/disabling particles.");
return true;
}
return false;
}
private boolean isVanished(Player player) {
return VanishAPI.isInvisible(player) || player.getGameMode().equals(GameMode.SPECTATOR);
}
} }
@@ -37,7 +37,7 @@ public class ParticleInfo {
// For DustOptions // For DustOptions
@JsonProperty(value = "size", defaultValue = "1") @JsonProperty(value = "size", defaultValue = "1")
private int size = 1; private float size = 1;
// For other particle types // For other particle types
private Double extra; private Double extra;
+6 -2
View File
@@ -1,6 +1,7 @@
package com.alttd.objects; package com.alttd.objects;
import com.alttd.storage.PlayerSettings; import com.alttd.storage.PlayerSettings;
import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -11,9 +12,12 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Frame { public class Frame {
List<AParticle> aParticles; @Getter
private final String key;
private final List<AParticle> aParticles;
public Frame(List<AParticle> aParticles) { public Frame(String key, List<AParticle> aParticles) {
this.key = key;
this.aParticles = aParticles; this.aParticles = aParticles;
} }
@@ -8,6 +8,7 @@ import com.alttd.storage.PlayerSettings;
import com.alttd.util.Logger; import com.alttd.util.Logger;
import de.myzelyam.api.vanish.VanishAPI; import de.myzelyam.api.vanish.VanishAPI;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
@@ -19,6 +20,7 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j
public class ParticleSet { public class ParticleSet {
private final List<Frame> frames; private final List<Frame> frames;
@@ -53,7 +55,7 @@ public class ParticleSet {
} }
public void run(Location location, Player player) { public void run(Location location, Player player) {
if (tooSoon(player.getUniqueId()) || isVanished(player)) if (tooSoon(player.getUniqueId()))
return; return;
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, frames, frameDelay, location, player.getLocation().getYaw()); FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, frames, frameDelay, location, player.getLocation().getYaw());
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay); frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
@@ -62,20 +64,16 @@ public class ParticleSet {
public void run(Player player, PlayerSettings playerSettings) { public void run(Player player, PlayerSettings playerSettings) {
if (tooSoon(player.getUniqueId()) && !player.hasPermission("apart.bypass-cooldown")) if (tooSoon(player.getUniqueId()) && !player.hasPermission("apart.bypass-cooldown"))
return; return;
if (Config.DEBUG) if (Config.DEBUG) {
Logger.info("Starting particle set % for %.", uniqueId, player.getName()); log.info("Starting particle set {} for {}.", uniqueId, player.getName());
}
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, frameDelay, player, playerSettings, aPartType, uniqueId, stationary); FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, frameDelay, player, playerSettings, aPartType, uniqueId, stationary);
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay); frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
} }
private boolean isVanished(Player player) {
return VanishAPI.isInvisible(player) || player.getGameMode().equals(GameMode.SPECTATOR);
}
private boolean tooSoon(UUID uuid) { private boolean tooSoon(UUID uuid) {
PlayerSettings ps = PlayerSettings.getPlayer(uuid); PlayerSettings ps = PlayerSettings.getPlayer(uuid);
if (ps.canRun(aPartType)) if (ps.canRun(aPartType)) {
{
ps.run(aPartType); ps.run(aPartType);
return false; return false;
} }