Compare commits

...

10 Commits

Author SHA1 Message Date
Teriuihi 1caef4bb83 Update Gradle and Java versions, refactor, and fix enchantments
Upgraded Gradle to v8.5, updated Java language version to 21, and replaced the Shadow plugin. Deprecated `MaterialData` was removed. Fixed enchantment from ARROW_INFINITE to INFINITY in GUI and particle actions.
2025-01-18 18:13:58 +01:00
Teriuihi 1862288183 Update config file paths
The file paths for DatabaseConfig, ParticleConfig, and Config have been updated. They no longer depend on "user.home" system property, instead they directly point to "/mnt/configs" location. This change is necessary for aligning with the new configuration directories.
2024-07-20 00:19:21 +02:00
Teriuihi e33a9ff5b9 idk what this is sorry me 2024-07-20 00:19:08 +02:00
Teriuihi d416ec80e1 Added a way to load extra data for particles and added a boolean to determine if all frames should spawn at the same location 2022-09-07 22:39:48 +02:00
Teriuihi be97b45833 Fixed frames not properly repeating at the right speed 2022-08-31 05:13:18 +02:00
Teriuihi 77dcd8862c Fixed loading colors incorrectly 2022-08-31 05:12:55 +02:00
Teriuihi 867d436d0a Converted to json for particle storage 2022-08-30 05:19:05 +02:00
Teriuihi f827d78bf9 Updated to 1.19 2022-06-09 18:36:53 +02:00
Teriuihi 33d95226a7 Fixed frame delay 2022-06-05 18:22:52 +02:00
Teriuihi 0a7b583424 Fixed frame delay 2022-06-05 18:21:57 +02:00
19 changed files with 372 additions and 450 deletions

View File

@ -1,8 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
plugins { plugins {
id("java") id("java")
id("com.github.johnrengelman.shadow") version "7.1.0" id("com.gradleup.shadow") version "9.0.0-beta4"
} }
group = "com.alttd" group = "com.alttd"
@ -13,7 +11,7 @@ apply<JavaLibraryPlugin>()
java { java {
toolchain { toolchain {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(JavaLanguageVersion.of(21))
} }
} }
@ -27,7 +25,6 @@ tasks {
} }
shadowJar { shadowJar {
dependsOn(getByName("relocateJars") as ConfigureShadowRelocation)
archiveFileName.set("${project.name}-${project.version}.jar") archiveFileName.set("${project.name}-${project.version}.jar")
minimize() minimize()
configurations = listOf(project.configurations.shadow.get()) configurations = listOf(project.configurations.shadow.get())
@ -36,14 +33,9 @@ tasks {
build { build {
dependsOn(shadowJar) dependsOn(shadowJar)
} }
create<ConfigureShadowRelocation>("relocateJars") {
target = shadowJar.get()
prefix = "${project.name}.lib"
}
} }
dependencies { dependencies {
compileOnly("com.alttd:Galaxy-API:1.18.2-R0.1-SNAPSHOT") compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT")
compileOnly("com.github.LeonMangler:PremiumVanishAPI:2.7.11-2") compileOnly("com.github.LeonMangler:PremiumVanishAPI:2.9.0-4")
} }

Binary file not shown.

View File

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

294
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 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.
@ -17,67 +17,99 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (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
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || 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
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC2039,SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC2039,SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=`save "$@"` # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# 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
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

31
gradlew.bat vendored
View File

@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -75,13 +76,15 @@ set CLASSPATH=%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
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

@ -1,14 +1,12 @@
package com.alttd; package com.alttd;
import com.alttd.commands.CommandManager; import com.alttd.commands.CommandManager;
import com.alttd.commands.subcommands.CommandReload;
import com.alttd.config.Config; import com.alttd.config.Config;
import com.alttd.config.DatabaseConfig; import com.alttd.config.DatabaseConfig;
import com.alttd.config.ParticleConfig; import com.alttd.config.ParticleConfig;
import com.alttd.database.Database; import com.alttd.database.Database;
import com.alttd.listeners.*; import com.alttd.listeners.*;
import com.alttd.objects.APartType; import com.alttd.objects.APartType;
import com.alttd.particles.InitParticles;
import com.alttd.util.Logger; import com.alttd.util.Logger;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -32,7 +30,6 @@ public class AltitudeParticles extends JavaPlugin {
Database.getDatabase().init(); Database.getDatabase().init();
new CommandManager(); new CommandManager();
registerEvents(); registerEvents();
InitParticles.init();
Logger.info("--------------------------------------------------"); Logger.info("--------------------------------------------------");
Logger.info("Altitude Particles started"); Logger.info("Altitude Particles started");
Logger.info("--------------------------------------------------"); Logger.info("--------------------------------------------------");

View File

@ -7,7 +7,7 @@ public final class Config extends AbstractConfig {
static Config config; static Config config;
static int version; static int version;
public Config() { public Config() {
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + "AltitudeParticles"), "config.yml"); super(new File(File.separator + "mnt" + File.separator + "configs" + File.separator + "AltitudeParticles"), "config.yml");
} }
public static void reload() { public static void reload() {

View File

@ -8,7 +8,7 @@ public class DatabaseConfig extends AbstractConfig {
static DatabaseConfig config; static DatabaseConfig config;
public DatabaseConfig() { public DatabaseConfig() {
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" super(new File(File.separator + "mnt" + File.separator + "configs"
+ File.separator + "AltitudeParticles"), "database.yml"); + File.separator + "AltitudeParticles"), "database.yml");
} }

View File

@ -1,5 +1,6 @@
package com.alttd.config; package com.alttd.config;
import com.alttd.objects.APartType; import com.alttd.objects.APartType;
import com.alttd.objects.AParticle; import com.alttd.objects.AParticle;
import com.alttd.objects.Frame; import com.alttd.objects.Frame;
@ -7,105 +8,133 @@ import com.alttd.objects.ParticleSet;
import com.alttd.storage.ParticleStorage; import com.alttd.storage.ParticleStorage;
import com.alttd.util.Logger; import com.alttd.util.Logger;
import com.destroystokyo.paper.ParticleBuilder; import com.destroystokyo.paper.ParticleBuilder;
import org.bukkit.Color;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.HexFormat;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class ParticleConfig extends AbstractConfig { public class ParticleConfig {
static ParticleConfig config; private static final File particlesDir = new File(File.separator + "mnt" + File.separator + "configs"
public ParticleConfig() { + File.separator + "AltitudeParticles" + File.separator + "particles");
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + "AltitudeParticles"), "particles.yml"); private static ParticleConfig instance = null;
private static ParticleConfig getInstance() {
if (instance == null)
instance = new ParticleConfig();
return instance;
}
/**
* Finds all files in particles directory that are valid .json files
* @return all files found
*/
private List<File> getJsonFiles() {
List<File> files = new ArrayList<>();
if (!particlesDir.exists()) {
if (!particlesDir.mkdir())
Logger.warning("Unable to create particles directory");
return files;
}
if (!particlesDir.isDirectory()) {
Logger.warning("Particles directory doesn't exist (it's a file??)");
return files;
}
File[] validFiles = particlesDir.listFiles(file -> file.isFile() && file.canRead() && file.getName().endsWith(".json"));
if (validFiles == null)
return files;
files.addAll(List.of(validFiles));
return files;
}
public ParticleSet loadParticle(JSONObject jsonObject) throws Exception {
String particleName = (String) jsonObject.get("particle_name");
String displayName = (String) jsonObject.get("display_name");
APartType aPartType = APartType.valueOf((String) jsonObject.get("particle_type"));
String lore = (String) jsonObject.get("lore");
ItemStack displayItem = new ItemStack(Material.valueOf((String) jsonObject.get("display_item")));
String permission = (String) jsonObject.get("permission");
String packagePermission = (String) jsonObject.get("package_permission");
int frameDelay = (int) (long) jsonObject.get("frame_delay");
int repeat = (int) (long) jsonObject.get("repeat");
int repeatDelay = (int) (long) jsonObject.get("repeat_delay");
double randomOffset = (double) jsonObject.get("random_offset");
boolean stationary = (boolean) jsonObject.get("stationary");
JSONObject frames = (JSONObject) jsonObject.get("frames");
List<Frame> loadedFrames = new ArrayList<>();
for (Object key : frames.keySet()) {
Object o = frames.get(key);
List<AParticle> aParticleList = new ArrayList<>();
for (Object o1 : ((JSONArray) o)) {
JSONObject pData = (JSONObject) o1;
Particle particleType = Particle.valueOf((String) pData.get("particle_type"));
double x = (double) pData.get("x");
double y = (double) pData.get("y");
double z = (double) pData.get("z");
ParticleBuilder particleBuilder = new ParticleBuilder(particleType);
if (particleType.getDataType().equals(Particle.DustOptions.class)) {
int rgb = HexFormat.fromHexDigits((String) pData.get("color"));
particleBuilder.data(new Particle.DustOptions(Color.fromRGB(rgb), 1));
}
// else if (particleType.getDataType().equals(MaterialData.class)) {
// //TODO implement
// }
else if (particleType.getDataType().equals(BlockData.class)) {
//TODO implement
} else if (particleType.getDataType().equals(Integer.class)) {
//TODO implement
} else if (particleType.getDataType().equals(Float.class)) {
//TODO implement
} else if (particleType.getDataType().equals(Particle.DustTransition.class)) {
//TODO implement
} else if (particleType.getDataType().equals(ItemStack.class)) {
//TODO implement
} else {
double data = (double) pData.get("extra");
particleBuilder.extra(data);
}
aParticleList.add(new AParticle(x, y, z, randomOffset, particleBuilder));
}
loadedFrames.add(new Frame(aParticleList));
}
return new ParticleSet(loadedFrames, displayName, List.of(lore.split("\n")), frameDelay, repeat, repeatDelay, stationary, aPartType, particleName, permission, packagePermission, displayItem);
} }
public static void reload() { public static void reload() {
config = new ParticleConfig();
config.readConfig(config.getClass(), null);
}
private static void loadParticles() {
ParticleStorage.clear(); ParticleStorage.clear();
ConfigurationSection particles = config.getConfigurationSection("particles"); ParticleConfig instance = getInstance();
if (particles == null) { for (File file : instance.getJsonFiles()) {
Logger.warning("No particles in particles config"); JSONParser parser = new JSONParser();
return;
}
for (String key : particles.getKeys(false)) {
ConfigurationSection cs = particles.getConfigurationSection(key);
if (cs == null)
continue;
APartType aPartType;
ParticleSet particleSet;
try { try {
aPartType = APartType.valueOf(cs.getString("part-type")); Object obj = parser.parse(new FileReader(file));
particleSet = new ParticleSet( ParticleSet particleSet = instance.loadParticle((JSONObject) obj);
getAParticle(cs), ParticleStorage.addParticleSet(particleSet.getAPartType(), particleSet);
cs.getString("name"), } catch (FileNotFoundException e) {
cs.getStringList("lore"),
cs.getInt("frame-delay"),
cs.getInt("repeat"),
cs.getInt("repeat-delay"),
aPartType,
cs.getString("unique-name"),
cs.getString("permission"),
cs.getString("package-permission"),
new ItemStack(Material.valueOf(cs.getString("material"))));
} catch (Exception e) {//Im lazy rn sorry
e.printStackTrace(); e.printStackTrace();
continue; } catch (IOException e) {
} e.printStackTrace();
ParticleStorage.addParticleSet(aPartType, particleSet); } catch (ParseException e) {
e.printStackTrace();
} catch (Exception exception) {
exception.printStackTrace();
} }
} }
private static List<Frame> getAParticle(ConfigurationSection configurationSection) { //TODO implement
List<Frame> list = new ArrayList<>();
ConfigurationSection frames = configurationSection.getConfigurationSection("frames");
if (frames == null) {
Logger.warning("Unable to find frames for something");
return null;
} }
for (String key : frames.getKeys(false)) {
ConfigurationSection cs = frames.getConfigurationSection(key);
if (cs == null) {
Logger.warning("Unable to load particle %", key);
return null;
}
int offset = frames.getInt("offset-range");
List<AParticle> aParticleList = new ArrayList<>();
List<Double> x = Arrays.stream(cs.getString("x").split(", ")).map(Double::valueOf).collect(Collectors.toList());
List<Double> y = Arrays.stream(cs.getString("y").split(", ")).map(Double::valueOf).collect(Collectors.toList());
List<Double> z = Arrays.stream(cs.getString("z").split(", ")).map(Double::valueOf).collect(Collectors.toList());
if (x.size() != y.size() || y.size() != z.size()) {
Logger.warning("Unable to load % xyz is not the same length", key);
}
ParticleBuilder particleBuilder = getParticleBuilder(cs);
for (int i = 0; i < x.size(); i++) {
aParticleList.add(new AParticle(x.get(i), y.get(i), z.get(i), offset, particleBuilder));
}
list.add(new Frame(aParticleList));
}
return list;
} }
private static ParticleBuilder getParticleBuilder(ConfigurationSection cs) {
cs.getString("particle");
ConfigurationSection color = cs.getConfigurationSection("color");
ParticleBuilder particle = new ParticleBuilder(Particle.valueOf(cs.getString("particle")));
// Class<?> dataType = particle.particle().getDataType();
// Logger.warning(dataType.getSimpleName());
particle.extra(cs.getDouble("extra"));
if (color != null) {
particle = particle.color(color.getInt("r"), color.getInt("g"), color.getInt("b"));
}
return particle.count(cs.getInt("count", 1));
}
}

View File

@ -1,5 +1,6 @@
package com.alttd.frameSpawners; package com.alttd.frameSpawners;
import com.alttd.AltitudeParticles;
import com.alttd.config.Config; import com.alttd.config.Config;
import com.alttd.objects.Frame; import com.alttd.objects.Frame;
import com.alttd.util.Logger; import com.alttd.util.Logger;
@ -12,39 +13,37 @@ import java.util.List;
public class FrameSpawnerLocation extends BukkitRunnable { public class FrameSpawnerLocation extends BukkitRunnable {
private int amount; private int amount;
private final long repeatDelay;
private final List<Frame> frames; private final List<Frame> frames;
private Iterator<Frame> iterator; private Iterator<Frame> iterator;
private final Location location; private final Location location;
private final float rotation; private final float rotation;
public FrameSpawnerLocation(int amount, int repeatDelay, List<Frame> frames, Location location, float rotation) { private final int frameDelay;
public FrameSpawnerLocation(int amount, List<Frame> frames, int frameDelay, Location location, float rotation) {
this.amount = amount; this.amount = amount;
this.repeatDelay = (repeatDelay * 1000L) / 20;
this.frames = frames; this.frames = frames;
this.iterator = frames.iterator(); this.iterator = frames.iterator();
this.location = location; this.location = location;
this.rotation = rotation; this.rotation = rotation;
this.frameDelay = frameDelay;
} }
@Override @Override
public void run() { public void run() {
if (iterator.hasNext()) if (amount == 0){
iterator.next().spawn(location, rotation);
else if (amount != 0) {
iterator = frames.iterator();
if (amount > 0)
amount--;
if (repeatDelay <= 0)
return;
try { //Wait before repeating the frames
Thread.sleep(repeatDelay); //TODO figure out why this isn't working and fix it
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
this.cancel(); this.cancel();
if (Config.DEBUG) if (Config.DEBUG)
Logger.info("Stopped repeating task due to end of frames"); Logger.info("Stopped repeating task due to end of frames");
} }
new BukkitRunnable() {
@Override
public void run() {
if (!iterator.hasNext())
this.cancel();
iterator.next().spawn(location, rotation);
}
}.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
iterator = frames.iterator();
if (amount != -1)
amount--;
} }
} }

View File

@ -1,11 +1,13 @@
package com.alttd.frameSpawners; package com.alttd.frameSpawners;
import com.alttd.AltitudeParticles;
import com.alttd.config.Config; import com.alttd.config.Config;
import com.alttd.objects.APartType; import com.alttd.objects.APartType;
import com.alttd.objects.Frame; import com.alttd.objects.Frame;
import com.alttd.objects.ParticleSet; 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 org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -15,22 +17,24 @@ import java.util.List;
public class FrameSpawnerPlayer extends BukkitRunnable { public class FrameSpawnerPlayer extends BukkitRunnable {
private int amount; private int amount;
private final long repeatDelay;
private final List<Frame> frames; private final List<Frame> frames;
private Iterator<Frame> iterator; 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;
private final String uniqueId; private final String uniqueId;
public FrameSpawnerPlayer(int amount, int repeatDelay, List<Frame> frames, Player player, PlayerSettings playerSettings, APartType aPartType, String uniqueId) { private final int frameDelay;
private final 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.repeatDelay = (repeatDelay * 1000L) / 20;
this.frames = frames; this.frames = frames;
this.iterator = frames.iterator(); this.iterator = frames.iterator();
this.player = player; this.player = player;
this.playerSettings = playerSettings; this.playerSettings = playerSettings;
this.aPartType = aPartType; this.aPartType = aPartType;
this.uniqueId = uniqueId; this.uniqueId = uniqueId;
this.frameDelay = frameDelay;
this.stationary = stationary;
} }
@Override @Override
@ -41,6 +45,8 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
Logger.info("Stopped repeating task due to player offline."); Logger.info("Stopped repeating task due to player offline.");
return; return;
} }
Location location = player.getLocation();
float yaw = location.getYaw();
ParticleSet activeParticleSet = playerSettings.getParticles(aPartType); ParticleSet activeParticleSet = playerSettings.getParticles(aPartType);
if (activeParticleSet == null || !activeParticleSet.getParticleId().equalsIgnoreCase(uniqueId) || !playerSettings.hasActiveParticles()) { if (activeParticleSet == null || !activeParticleSet.getParticleId().equalsIgnoreCase(uniqueId) || !playerSettings.hasActiveParticles()) {
this.cancel(); this.cancel();
@ -48,22 +54,27 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
Logger.info("Stopped repeating task due to player switching/disabling particles."); Logger.info("Stopped repeating task due to player switching/disabling particles.");
return; return;
} }
if (iterator.hasNext()) if (amount == 0) {
iterator.next().spawn(player.getLocation(), player.getLocation().getYaw());
else if (amount != 0) {
iterator = frames.iterator();
amount--;
if (repeatDelay <= 0)
return;
try { //Wait before repeating the frames
Thread.sleep(repeatDelay); //TODO figure out why this doesn't work and fix it
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
this.cancel(); this.cancel();
if (Config.DEBUG) if (Config.DEBUG)
Logger.info("Stopped repeating task due to end of frames."); Logger.info("Stopped repeating task due to end of frames.");
} }
new BukkitRunnable() {
@Override
public void run() {
if (!iterator.hasNext()) {
this.cancel();
return;
}
Frame next = iterator.next();
if (stationary)
next.spawn(location, yaw);
else
next.spawn(player.getLocation(), player.getLocation().getYaw());
}
}.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
iterator = frames.iterator();
if (amount != -1)
amount--;
} }
} }

View File

@ -58,7 +58,7 @@ public class ActivateParticleSet implements GUIAction {
meta.getEnchants().forEach((enchantment, integer) -> meta.removeEnchant(enchantment)); meta.getEnchants().forEach((enchantment, integer) -> meta.removeEnchant(enchantment));
item.setItemMeta(meta); item.setItemMeta(meta);
}); });
itemMeta.addEnchant(Enchantment.ARROW_INFINITE, 1, true); itemMeta.addEnchant(Enchantment.INFINITY, 1, true);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
Queries.addParticle(player.getUniqueId(), particleSet.getAPartType(), particleSet.getParticleId()); Queries.addParticle(player.getUniqueId(), particleSet.getAPartType(), particleSet.getParticleId());
enable = true; enable = true;

View File

@ -49,7 +49,7 @@ public class ChooseParticleGUI extends DefaultGUI {
if (activeParticleSet != null && playerSettings.getParticles(aPartType).equals(particleSet)) { if (activeParticleSet != null && playerSettings.getParticles(aPartType).equals(particleSet)) {
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.addEnchant(Enchantment.ARROW_INFINITE, 1, true); itemMeta.addEnchant(Enchantment.INFINITY, 1, true);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemStack.setItemMeta(itemMeta); itemStack.setItemMeta(itemMeta);
} }

View File

@ -27,8 +27,9 @@ public class ParticleSet {
private final String permission; private final String permission;
private final String packPermission; private final String packPermission;
private final ItemStack itemStack; private final ItemStack itemStack;
private final boolean stationary;
public ParticleSet(List<Frame> frames, String name, List<String> lore, int frameDelay, int repeat, int repeatDelay, APartType aPartType, String uniqueId, String permission, String packPermission,ItemStack itemStack) { public ParticleSet(List<Frame> frames, String name, List<String> lore, int frameDelay, int repeat, int repeatDelay, boolean stationary, APartType aPartType, String uniqueId, String permission, String packPermission, ItemStack itemStack) {
MiniMessage miniMessage = MiniMessage.miniMessage(); MiniMessage miniMessage = MiniMessage.miniMessage();
this.frames = frames; this.frames = frames;
this.frameDelay = frameDelay; this.frameDelay = frameDelay;
@ -38,6 +39,7 @@ public class ParticleSet {
this.uniqueId = uniqueId; this.uniqueId = uniqueId;
this.permission = permission; this.permission = permission;
this.packPermission = packPermission; this.packPermission = packPermission;
this.stationary = stationary;
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.displayName(miniMessage.deserialize(name)); itemMeta.displayName(miniMessage.deserialize(name));
itemMeta.lore(lore.stream().map(miniMessage::deserialize).collect(Collectors.toList())); itemMeta.lore(lore.stream().map(miniMessage::deserialize).collect(Collectors.toList()));
@ -48,8 +50,8 @@ 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()) || isVanished(player))
return; return;
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, repeatDelay, frames, location, player.getLocation().getYaw()); FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, frames, frameDelay, location, player.getLocation().getYaw());
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay); frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
} }
public void run(Player player, PlayerSettings playerSettings) { public void run(Player player, PlayerSettings playerSettings) {
@ -57,8 +59,8 @@ public class ParticleSet {
return; return;
if (Config.DEBUG) if (Config.DEBUG)
Logger.info("Starting particle set % for %.", uniqueId, player.getName()); Logger.info("Starting particle set % for %.", uniqueId, player.getName());
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, repeatDelay, frames, player, playerSettings, aPartType, uniqueId); FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, frameDelay, player, playerSettings, aPartType, uniqueId, stationary);
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay); frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
} }
private boolean isVanished(Player player) { private boolean isVanished(Player player) {

View File

@ -1,53 +0,0 @@
package com.alttd.particles;
import com.alttd.objects.APartType;
import com.alttd.objects.AParticle;
import com.alttd.objects.Frame;
import com.alttd.objects.ParticleSet;
import com.alttd.storage.ParticleStorage;
import com.destroystokyo.paper.ParticleBuilder;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class Alpha {
// private static final ItemStack itemStack;
//
// static {
// MiniMessage miniMessage = MiniMessage.miniMessage();
// itemStack = new ItemStack(Material.ANVIL);
// ItemMeta itemMeta = itemStack.getItemMeta();
// itemMeta.displayName(miniMessage.deserialize("<gold>Alpha Particles</gold>"));
// itemMeta.lore(List.of(
// miniMessage.deserialize("<dark_aqua>An exclusive particle</dark_aqua>"),
// miniMessage.deserialize("<dark_aqua>set for Alpha testers!</dark_aqua>")));
// itemStack.setItemMeta(itemMeta);
// }
//
// public Alpha() {
// List<Frame> frameList = new ArrayList<>();
//
// frameList.add(new Frame(frameOne()));
//
// ParticleStorage.addParticleSet(APartType.TELEPORT_ARRIVE, new ParticleSet(frameList, 5, 10, 10, APartType.TELEPORT_ARRIVE, "ALPHA_TELEPORT", "apart.particle.alpha", itemStack));
// ParticleStorage.addParticleSet(APartType.CLICK_BLOCK, new ParticleSet(frameList, 5, 10, 10, APartType.CLICK_BLOCK, "ALPHA_CLICK", "apart.particle.alpha", itemStack));
// }
//
//
// public List<AParticle> frameOne() {
// List<AParticle> list = new ArrayList<>();
// double[] xPts = {0.23, 0.21, 0.19, 0.17, 0.15, 0.13, 0.11, 0.09, 0.06, 0.02, -0.03, -0.08, -0.14, -0.19, -0.24, -0.26, -0.28, -0.28, -0.27, -0.25, -0.22, -0.18, -0.13, -0.08, -0.03, 0.00, 0.03, 0.06, 0.09, 0.11, 0.14, 0.15, 0.16, 0.18, 0.22, 0.26, 0.30, 0.32};
// double[] yPts = {0.91, 0.86, 0.81, 0.76, 0.70, 0.63, 0.58, 0.52, 0.47, 0.42, 0.39, 0.38, 0.39, 0.42, 0.47, 0.52, 0.58, 0.63, 0.69, 0.75, 0.81, 0.86, 0.89, 0.90, 0.89, 0.87, 0.83, 0.79, 0.74, 0.69, 0.57, 0.51, 0.46, 0.42, 0.40, 0.40, 0.42, 0.47};
//
// for(int i = 0; i < xPts.length; i++) {
// list.add(new AParticle(xPts[i] * 2, (yPts[i] * 2) + 1.5, 0.5, 0, new ParticleBuilder(Particle.REDSTONE).color(Color.GRAY).count(1)));
// }
// return list;
// }
}

View File

@ -1,59 +0,0 @@
package com.alttd.particles;
import com.alttd.objects.APartType;
import com.alttd.objects.AParticle;
import com.alttd.objects.Frame;
import com.alttd.objects.ParticleSet;
import com.alttd.storage.ParticleStorage;
import com.destroystokyo.paper.ParticleBuilder;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType;
import java.util.ArrayList;
import java.util.List;
public class Cupid {
// private static final ItemStack itemStack;
//
// static {
// MiniMessage miniMessage = MiniMessage.miniMessage();
// itemStack = new ItemStack(Material.PINK_TULIP);
// /*PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
// meta.setBasePotionData(new PotionData(PotionType.REGEN));
// itemStack.setItemMeta(meta);*/
// ItemMeta itemMeta = itemStack.getItemMeta();
// itemMeta.displayName(miniMessage.deserialize("<gold>Cupid Particles</gold>"));
// itemMeta.lore(List.of(
// miniMessage.deserialize("<dark_aqua>No one is immune</dark_aqua>"),
// miniMessage.deserialize("<dark_aqua>to Cupid's arrow...</dark_aqua>")));
// itemStack.setItemMeta(itemMeta);
// }
//
// public Cupid() {
// List<Frame> frameList = new ArrayList<>();
//
// frameList.add(new Frame(frameOne()));
//
// ParticleStorage.addParticleSet(APartType.HEAD, new ParticleSet(frameList, 10, 5, 40, APartType.HEAD, "CUPID_HEAD", "apart.particle.test", itemStack));
// ParticleStorage.addParticleSet(APartType.TELEPORT_ARRIVE, new ParticleSet(frameList, 10, 5, 40, APartType.TELEPORT_ARRIVE, "CUPID_TELEPORT", "apart.particle.test", itemStack));
// ParticleStorage.addParticleSet(APartType.CLICK_BLOCK, new ParticleSet(frameList, 10, 5, 40, APartType.CLICK_BLOCK, "CUPID_CLICK", "apart.particle.test", itemStack));
// }
//
//
// public List<AParticle> frameOne() {
// List<AParticle> list = new ArrayList<>();
//
// list.add(new AParticle((Math.random() * 2) - 1, (Math.random() * 2) - 1, (Math.random() * 2) - 1, 0.5, new ParticleBuilder(Particle.HEART).count(1)));
// list.add(new AParticle((Math.random() * 2) - 1, (Math.random() * 2) - 1, (Math.random() * 2) - 1, 0.5, new ParticleBuilder(Particle.HEART).count(1)));
// list.add(new AParticle((Math.random() * 2) - 1, (Math.random() * 2) - 1, (Math.random() * 2) - 1, 0.5,new ParticleBuilder(Particle.HEART).count(1)));
// return list;
// }
}

View File

@ -1,9 +0,0 @@
package com.alttd.particles;
public class InitParticles {
public static void init() {
// new Test();
// new Alpha();
// new Cupid();
}
}

View File

@ -1,56 +0,0 @@
package com.alttd.particles;
import com.alttd.objects.APartType;
import com.alttd.objects.AParticle;
import com.alttd.objects.Frame;
import com.alttd.objects.ParticleSet;
import com.alttd.storage.ParticleStorage;
import com.destroystokyo.paper.ParticleBuilder;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class Test {
//
// private static final ItemStack itemStack;
//
// static {
// MiniMessage miniMessage = MiniMessage.miniMessage();
// itemStack = new ItemStack(Material.BUCKET);
// ItemMeta itemMeta = itemStack.getItemMeta();
// itemMeta.displayName(miniMessage.deserialize("<gold>TestParticles</gold>"));
// itemMeta.lore(List.of(
// miniMessage.deserialize("<dark_aqua>A particle to test</dark_aqua>"),
// miniMessage.deserialize("<dark_aqua>the functionality of this plugin</dark_aqua>")));
// itemStack.setItemMeta(itemMeta);
// }
//
// public Test() {
// APartType test = APartType.BREAK_PLACE_BLOCK;
// List<Frame> frameList = new ArrayList<>();
// //
// frameList.add(new Frame(frameOne()));
// //....
// ParticleStorage.addParticleSet(test, new ParticleSet(frameList, 5, 5, 0, test, "UNIQUE_NAME_TEST", "apart.particle.test", itemStack));
// ParticleStorage.addParticleSet(APartType.TRAIL, new ParticleSet(frameList, 5, -1, 40, APartType.TRAIL, "UNIQUE_NAME_TEST", "apart.particle.test", itemStack));
// ParticleStorage.addParticleSet(APartType.DEATH, new ParticleSet(frameList, 5, 2, 10, APartType.DEATH, "UNIQUE_NAME_TEST", "apart.particle.test", itemStack));
// ParticleStorage.addParticleSet(APartType.KILL, new ParticleSet(frameList, 5, -1, 10, APartType.KILL, "UNIQUE_NAME_TEST", "apart.particle.test", itemStack));
// ParticleStorage.addParticleSet(APartType.TELEPORT_ARRIVE, new ParticleSet(frameList, 5, 5, 40, APartType.TELEPORT_ARRIVE, "UNIQUE_NAME_TEST", "apart.particle.test", itemStack));
// ParticleStorage.addParticleSet(APartType.CLICK_BLOCK, new ParticleSet(frameList, 5, 5, 40, APartType.CLICK_BLOCK, "UNIQUE_NAME_TEST", "apart.particle.test", itemStack));
// }
//
//
// public List<AParticle> frameOne() {
// List<AParticle> list = new ArrayList<>();
// list.add(new AParticle(0, 2, 0, 0.3, new ParticleBuilder(Particle.TOTEM)));
// list.add(new AParticle(0, 2, 0, 0.3, new ParticleBuilder(Particle.TOTEM)));
// list.add(new AParticle(0, 2, 0, 0.3, new ParticleBuilder(Particle.TOTEM)));
// list.add(new AParticle(0, 2, 0, 0.3, new ParticleBuilder(Particle.TOTEM)));
// return list;
// }
}