13
0

Commits vergleichen

..

1 Commits

Autor SHA1 Nachricht Datum
Chaos
e23d2f9163 feat(youtube): Add Image Request
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2022-03-26 23:09:30 +01:00
121 geänderte Dateien mit 2092 neuen und 154229 gelöschten Zeilen

16
.gitignore vendored
Datei anzeigen

@ -1,15 +1,9 @@
# Package Files
*.jar
# Gradle
.gradle
**/build/
!gradle/wrapper/gradle-wrapper.jar
steamwar.properties
# Maven
/target
# IntelliJ IDEA
.idea
/.idea
*.iml
# Other
lib
/lib

50
LobbySystem.iml Normale Datei
Datei anzeigen

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Maven: steamwar:Spigot:1.15">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/Spigot-1.15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: steamwar:WorldEdit:1.15">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/WorldEdit-1.15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: steamwar:SpigotCore:1.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/SpigotCore.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
</component>
</module>

Datei anzeigen

@ -1,68 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'de.steamwar.gradle' version 'RELEASE'
}
group 'de.steamwar'
version ''
mainClassName = ''
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 11
targetCompatibility = 11
sourceSets {
main {
java {
srcDirs = ['src/']
}
resources {
srcDirs = ['src/']
exclude '**/*.java', '**/*.kt'
}
}
}
repositories {
mavenCentral()
maven {
url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT'
compileOnly swdep("Spigot-1.20")
compileOnly swdep("WorldEdit-1.15")
compileOnly swdep("SpigotCore")
compileOnly 'org.projectlombok:lombok:1.18.22'
testCompileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
}

Binäre Datei nicht angezeigt.

Datei anzeigen

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored
Datei anzeigen

@ -1,185 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# 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"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
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.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# 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
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored
Datei anzeigen

@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

91
pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file is a part of the SteamWar software.
~
~ Copyright (C) 2021 SteamWar.de-Serverteam
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.steamwar</groupId>
<artifactId>LobbySystem</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<url>https://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.basedir>${project.basedir}</main.basedir>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgs>-Xlint</compilerArgs>
</configuration>
</plugin>
</plugins>
<finalName>lobbysystem</finalName>
</build>
<dependencies>
<dependency>
<groupId>steamwar</groupId>
<artifactId>Spigot</artifactId>
<version>1.15</version>
<scope>system</scope>
<systemPath>${main.basedir}/lib/Spigot-1.15.jar</systemPath>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>WorldEdit</artifactId>
<version>1.15</version>
<scope>system</scope>
<systemPath>${main.basedir}/lib/WorldEdit-1.15.jar</systemPath>
</dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SpigotCore</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${main.basedir}/lib/SpigotCore.jar</systemPath>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist

Datei anzeigen

@ -20,15 +20,10 @@
package de.steamwar.lobby;
import de.steamwar.lobby.display.Hologram;
import de.steamwar.lobby.jumpandrun.JumpAndRun;
import de.steamwar.lobby.portal.Portal;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.List;
public class Config {
static {
@ -44,11 +39,6 @@ public class Config {
yml.getList("portals", Portal.getPortals());
yml.getList("holograms", Hologram.getHolograms());
JumpAndRun.actualPoints = (List<Vector>) yml.getList("jumpPoints", new ArrayList<>());
JumpAndRun.points.addAll(JumpAndRun.actualPoints);
// Remove 2 Blocks in Tree
JumpAndRun.points.remove(141);
JumpAndRun.points.remove(140);
waitingHallSpawn = yml.getLocation("waitingHallSpawn");
}
@ -65,7 +55,6 @@ public class Config {
yml.set("portals", Portal.getPortals());
yml.set("holograms", Hologram.getHolograms());
yml.set("waitingHallSpawn", waitingHallSpawn);
yml.set("jumpPoints", JumpAndRun.actualPoints);
LobbySystem.getPlugin().saveConfig();
}

Datei anzeigen

@ -20,8 +20,10 @@
package de.steamwar.lobby;
import com.google.common.io.ByteArrayDataInput;
import de.steamwar.comms.BungeeReceiver;
import de.steamwar.comms.PacketIdManager;
import de.steamwar.comms.packets.FightInfoPacket;
import de.steamwar.lobby.portal.FightserverPortal;
import de.steamwar.network.packets.common.FightInfoPacket;
import org.bukkit.Bukkit;
import java.time.Instant;
@ -34,15 +36,17 @@ public class Fightserver {
private static final Map<String, Fightserver> servers = new HashMap<>();
public static void init() {
BungeeReceiver.registerHandler(PacketIdManager.FIGHT_INFO, Fightserver::newFightInfo);
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), Fightserver::removeStopped, 20, 20);
}
public static void newFightInfo(FightInfoPacket in) {
Fightserver server = servers.get(in.getServerName());
private static void newFightInfo(ByteArrayDataInput in) {
FightInfoPacket fightInfo = new FightInfoPacket(in);
Fightserver server = servers.get(fightInfo.getServerName());
if (server == null) {
new Fightserver(in);
new Fightserver(fightInfo);
} else {
server.update(in);
server.update(fightInfo);
}
}

Datei anzeigen

@ -19,17 +19,12 @@
package de.steamwar.lobby;
import de.steamwar.entity.REntityServer;
import de.steamwar.lobby.command.FlyCommand;
import de.steamwar.lobby.command.HologramCommand;
import de.steamwar.lobby.command.ModifyCommand;
import de.steamwar.lobby.command.PortalCommand;
import de.steamwar.lobby.jumpandrun.JumpAndRun;
import de.steamwar.lobby.jumpandrun.JumpAndRunCommand;
import de.steamwar.lobby.listener.*;
import de.steamwar.lobby.map.CustomMap;
import de.steamwar.lobby.particle.ParticleListener;
import de.steamwar.lobby.special.advent.AdventsCalendar;
import de.steamwar.lobby.map.CustomMapCommand;
import de.steamwar.lobby.team.TeamPlayer;
import de.steamwar.message.Message;
import org.bukkit.plugin.java.JavaPlugin;
@ -39,8 +34,6 @@ public class LobbySystem extends JavaPlugin {
private static Message message;
private static LobbySystem plugin;
private static Config config;
private static REntityServer entityServer;
private static REntityServer debugEntityServer;
@Override
public void onLoad() {
@ -50,20 +43,15 @@ public class LobbySystem extends JavaPlugin {
@Override
public void onEnable() {
message = new Message("de.steamwar.lobby.LobbySystem", getClassLoader());
entityServer = new REntityServer();
debugEntityServer = new REntityServer();
CustomMap.init();
Fightserver.init();
new WaitingHall();
new Portals();
new PortalCommand();
new HologramCommand();
new FlyCommand();
new ModifyCommand();
new JumpAndRun();
new JumpAndRunCommand();
new CustomMapCommand();
config = new Config(getConfig());
new PlayerSpawn();
@ -76,18 +64,15 @@ public class LobbySystem extends JavaPlugin {
new TeleporterListener();
new TeamPlayer();
// EggHunt.init();
AdventsCalendar.init();
new AlphaWall(l -> l.getX() > 999, AlphaWall.REFLECT_X);
new AlphaWall(l -> l.getX() > 1199, AlphaWall.REFLECT_X);
new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X);
new AlphaWall(l -> l.getZ() > 892, AlphaWall.REFLECT_Z);
new AlphaWall(l -> l.getZ() < 1794, AlphaWall.REFLECT_Z);
new LobbyPacketHandler().register();
}
@Override
public void onDisable() {
TeamPlayer.cleanup();
}
public static LobbySystem getPlugin() {
@ -101,8 +86,4 @@ public class LobbySystem extends JavaPlugin {
public static Message getMessage() {
return message;
}
public static REntityServer getEntityServer(boolean debug) {
return debug ? debugEntityServer : entityServer;
}
}

Datei anzeigen

@ -4,272 +4,81 @@ DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
# ServerTeamNPC's
NPC_CHAT_1 = §fHello, I''m {0} and I''m a(n) {1}.
NPC_CHAT_2 = §fWelcome on §eSteam§8War§f, have fun.
NPC_CHAT_1 = §fHallo, ich bin {0} und bin ein {1}.
NPC_CHAT_2 = §fWillkommen auf §eSteam§8War§f, viel Spaß dir.
# Portal Command
PORTAL_COMMAND_LIST_HELP = §8/§7portal §elist §8- §7Lists all portals
PORTAL_COMMAND_ADD_HELP = §8/§7portal §ecreate §8[§7PortalType§8] §8[§7PortalName§8] §8- §7Adds a portal
PORTAL_COMMAND_REMOVE_HELP = §8/§7portal §eremove §8[§7PortalName§8] §8- §7Removes a portal
PORTAL_COMMAND_LIST_HELP = §8/§7portal §elist §8- §7Listet alle Portale auf
PORTAL_COMMAND_ADD_HELP = §8/§7portal §ecreate §8[§7PortalType§8] §8[§7PortalName§8] §8- §7Fügt ein Portal hinzu
PORTAL_COMMAND_REMOVE_HELP = §8/§7portal §eremove §8[§7PortalName§8] §8- §7Entfernt ein Portal
PORTAL_COMMAND_LIST_SHORT_INFO = §e{0} §8- §7{1} §7Pos1§8(§7{2}§8) §7Pos2§8(§7{3}§8)
PORTAL_NO_WORLDEDIT_SELECTION = §cNo WorldEdit selection
PORTAL_NO_WORLDEDIT_SELECTION = §cKeine WorldEdit Selection
# Particle
PARTICLE_INVENTORY = §0Particle
PARTICLE_DESELECT = §8No particle
PARTICLE_INVENTORY = §6Partikel
PARTICLE_DESELECT = §8Keine Partikel
PARTICLE_LOCKED = {0} §8- §c§lGesperrt
PARTICLE_SHOW_HAS_ALL = §8You have all particles
PARTICLE_SHOW_ALL = §aShow all
PARTICLE_SHOW_UNLOCKED = §cShow unlocked
PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt
PARTICLE_UNLOCKED_BY_EVENT = §fEventteilnahme
PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServerteam
PARTICLE_UNLOCKED_BY = §eUnlocked by
PARTICLE_UNLOCKED_BY_TEAM = §fJoin a team
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0}
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM_EASTER = §fTeam {0} (Easter Egg Hunt)
PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0}
PARTICLE_UNLOCKED_BY_SPECIFIC_USER_EASTER = §fUser {0} (Easter Egg Hunt)
PARTICLE_UNLOCKED_BY_EVENT = §fEvent participation
PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServer Team
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. or 3. Place
PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION = §f{0}
PARTICLE_UNLOCKED_BY_EASTER_EGG_HUNT_HALF = §fFind 45 Easter Eggs
PARTICLE_UNLOCKED_BY_EASTER_EGG_HUNT_DIFFICULTY = §fFind all Easter Eggs with difficulty {0}
PARTICLE_ATTRIBUTE = §eAttributes§7:
PARTICLE_ATTRIBUTE_CIRCLE = §8-§f Ring
PARTICLE_ATTRIBUTE_BI_CIRCLE = §8-§f Double ring
PARTICLE_ATTRIBUTE_CLOUD = §8-§f Cloud
PARTICLE_ATTRIBUTE_TICK = §8-§f Always active
PARTICLE_ATTRIBUTE_NON_FLOOR = §8-§f In air
PARTICLE_ATTRIBUTE_FLOOR = §8-§f On ground
PARTICLE_ATTRIBUTE_NON_FLYING = §8-§f Not flying
PARTICLE_ATTRIBUTE_FLYING = §8-§f Flying
PARTICLE_ATTRIBUTE_WING = §8-§f Wings
PARTICLE_ATTRIBUTE_SNEAKING = §8-§f Sneaking
PARTICLE_ATTRIBUTE_NON_MOVING = §8-§f Not moving
PARTICLE_ATTRIBUTE_SEPARATOR = §f
PARTICLE_ATTRIBUTE_BI_CIRCLE = §8-§f Doppelring
PARTICLE_ATTRIBUTE_CLOUD = §8-§f Wolke
PARTICLE_ATTRIBUTE_TICK = §8-§f Immer aktiv
PARTICLE_ATTRIBUTE_NON_FLOOR = §8-§f in Luft
PARTICLE_ATTRIBUTE_WING = §8-§f Flügel
PARTICLE_ATTRIBUTE = §eAttribute§7:
PARTICLE_SELECT = §eClick to select
PARTICLE_LOCKED = §c§lLocked
PARTICLE_DEACTIVATED = §cThere are too many players online, particles are deactivated
PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch
PARTICLE_SELECT = §eZum Auswählen klicken
PARTICLE_SNEEZE = §aSneeze
PARTICLE_SMOKE = §7Smoke
PARTICLE_FIRE = §cFire
PARTICLE_WATER = §bWater
PARTICLE_HEART = §cHearts
PARTICLE_NOTES = §eNotes
PARTICLE_SMOKE = §7Rauch
PARTICLE_FIRE = §cFeuer
PARTICLE_WATER = §bWasser
PARTICLE_HEART = §cHerzen
PARTICLE_NOTES = §eNoten
PARTICLE_NAUTILUS = §aNautilus
PARTICLE_SNOWBALL = §fSnowball
PARTICLE_EFFECT = §5Effect
PARTICLE_CAMPFIRE = §7Smoke
PARTICLE_MAGIC = §5Magic
PARTICLE_ANGRY = §4Angry
PARTICLE_SLIME = §aSlime
PARTICLE_SNOWBALL = §fSchneeball
PARTICLE_EFFECT = §5Effekt
PARTICLE_CAMPFIRE = §7Rauch
PARTICLE_MAGIC = §5Magie
PARTICLE_ANGRY = §4Wut
PARTICLE_SLIME = §aSchleim
PARTICLE_MOB = §7Mob
PARTICLE_SQUID = §8Squid
PARTICLE_BUBBLE = §aBubbles
PARTICLE_HONEY = §6Honey
PARTICLE_NECTAR = §6Nectar
PARTICLE_FIREWORK = §7Firework
PARTICLE_DRAGON_BREATH = §5Dragon breath
PARTICLE_DAMAGE = §5Damage
PARTICLE_DOLPHIN = §dDolphin
PARTICLE_WITCH = §5Witch
PARTICLE_ENCHANTING = §eEnchantment
PARTICLE_HAPPY = §2Joy
PARTICLE_FLAME = §7Flames
PARTICLE_SQUID = §8Tintenfisch
PARTICLE_BUBBLE = §aBlasen
PARTICLE_HONEY = §6Honig
PARTICLE_NECTAR = §6Nektar
PARTICLE_FIREWORK = §7Feuerwerk
PARTICLE_DRAGON_BREATH = §5Drachenatem
PARTICLE_DAMAGE = §5Schaden
PARTICLE_DOLPHIN = §dDelphin
PARTICLE_WITCH = §5Hexe
PARTICLE_ENCHANTING = §eZauber
PARTICLE_HAPPY = §2Freude
PARTICLE_FLAME = §7Flammen
PARTICLE_END_ROD = §fEnd Rod
PARTICLE_CLOUD = §7Cloud
PARTICLE_CLOUD = §7Wolke
PARTICLE_TOTEM = §aTotem
PARTICLE_TOWN = §5Town
PARTICLE_ENCHANTING_CIRCLE = §fEnchanted
PARTICLE_WATER_FIRE = §bWater§7/§cFire
PARTICLE_MAGIC_ENCHANTING = §5Magic/Enchantment
PARTICLE_WINGS_EVIL = §5Purple wings
PARTICLE_ENCHANTING_CIRCLE = §fVerzaubert
PARTICLE_WATER_FIRE = §bWasser§7/§cFeuer
PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber
PARTICLE_WINGS_EVIL = §5Lila Flügel
PARTICLE_PLAYER_HAYLIM_AURA = §fHaylim\'s Aura
PARTICLE_PLAYER_RONGAMER99091_AURA = §7Smoke Granade
PARTICLE_PLAYER_PLOMPA = §9ECAL
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz
PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION = §f{0}
PARTICLE_TEAM_PULSE_AURA_1 = §fPulse Aura §cFlame
PARTICLE_TEAM_PULSE_AURA_2 = §fPulse Aura §7End Rod
PARTICLE_TEAM_PULSE_AURA_3 = §fPulse Aura §fEnchanted
PARTICLE_TEAM_PULSE_LOGO = §fPulse Logo
PARTICLE_TEAM_PULSE_HEART_BEAT = §cHeart Beat
PARTICLE_RAINCLOUD_NORMAL = §fRaincloud
PARTICLE_RAINCLOUD_RED = §fLava cloud
PARTICLE_RAINCLOUD_YELLOW = §fNectar cloud
PARTICLE_RAINCLOUD_ORANGE = §fHoney cloud
PARTICLE_RAINCLOUD_GREEN = §fSpore Blossom cloud
PARTICLE_RAINCLOUD_PURPLE = §fObsidian Tears cloud
PARTICLE_RAINCLOUD_NAUTILUS = §fNautilus cloud
PARTICLE_RAINCLOUD_ENCHANTMENT = §fEnchantment cloud
PARTICLE_RAINCLOUD_SLIME = §fSlime cloud
PARTICLE_RAINCLOUD_HAIL = §fHail cloud
PARTICLE_RAINCLOUD_SNOW = §fSnow cloud
PARTICLE_RAINCLOUD_TOTEM = §fTotem cloud
PARTICLE_EVENT_ENCHANTING = §cEnchantment
PARTICLE_EVENT_CLOUD = §fClouds
PARTICLE_EVENT_SMOKE = §7Smoke
PARTICLE_EVENT_WATER = §bWater
PARTICLE_EVENT_WINGS = §fWings
PARTICLE_EVENT_RAIN_CLOUD = §fRandom Raincloud
PARTICLE_EVENT_ENCHANTING = §cVerzaubert
PARTICLE_EVENT_CLOUD = §fWolken
PARTICLE_EVENT_SMOKE = §7Rauch
PARTICLE_EVENT_WATER = §bWasser
PARTICLE_EVENT_WINGS = §fFlügel
PARTICLE_EVENT_RAIN_CLOUD = §fRegenwolke
PARTICLE_EVENT_WGS = §fWGS
PARTICLE_EVENT_WARGEARCLASH = §fClash
PARTICLE_EGG_HUNT_EASY = §aGreenery
PARTICLE_EGG_HUNT_MEDIUM = §eHide and Seek
PARTICLE_EGG_HUNT_HARD = §cOrbit
PARTICLE_EGG_HUNT_EXTREME = §5Purple rain
PARTICLE_EGG_HUNT_ADVANCED = §5Lift off
PARTICLE_EGG_HUNT_HALF = §fThe hunt is on
JUMP_AND_RUN_PROGRESS = §e{0}§8/§f{1} §c{2} §7{3}
JUMP_AND_RUN_CANCEL = {0}
JUMP_AND_RUN_TIME = mm:ss,SSS
JUMP_AND_RUN_FINISHED = §aFinished in {0} with {1} fails
JUMP_AND_RUN_PERSONAL_BEST = §aNice! You beat your personal best by {0}
JUMP_AND_RUN_PERSONAL_BEST_TIME = §aPersonal best in {0}
JUMP_AND_RUN_PERSONAL_BEST_NO_TIME = §cNo personal best
JUMP_AND_RUN_REPLAY_ENABLED = §aReplay enabled
JUMP_AND_RUN_REPLAY_DISABLED = §cReplay disabled
# Games
GAMES_TICTACTOE = TicTacToe
GAMES_CONNECT_4 = Connect 4
GAMES_ALREADY_PRESENT = §cYou already have an open invitation
GAMES_NO_SELF = §cYou can\'t play against yourself
GAMES_CHALLENGED_BY = §e{0} §7challenged you to a game of §e{1}
GAMES_CHALLENGED_BY_HOVER = §7Click to accept
GAMES_WON = §6{0} has won!
GAMES_DRAW = §6Draw!
GAMES_TURN = {0}\'s turn
GAMES_LEFT = §7{0} left the game
BOAT_RACE_TIME = §7Finished in §e{0}
BOAT_RACE_NEW_BEST = §aNew best time!
BOAT_RACE_TITLE = §6Checkpoint {0}/6§7: {1} §8• §e{2}km/h
# Easter Egg Hunt
DIFFICULTY_EASY = §aEasy
DIFFICULTY_MEDIUM = §eMedium
DIFFICULTY_HARD = §cHard
DIFFICULTY_EXTREME = §5Extreme
DIFFICULTY_ADVANCED = §5Advanced
EASTER_EGG_MENU = §0Easter Egg Hunt {0}/{1}
EASTER_EGG_SELECTION_ALL = §eAll
EASTER_EGG_SELECTION_FOUND = §aFound
EASTER_EGG_SELECTION_NOT_FOUND = §cNot found
EASTER_EGG_0 = Where everything began
EASTER_EGG_1 = Jump and Run
EASTER_EGG_2 = Carry me please
EASTER_EGG_3 = The crane
EASTER_EGG_4 = Trust fall
EASTER_EGG_5 = Run forrest run
EASTER_EGG_6 = Important Delivery
EASTER_EGG_7 = Ei believe I can fly
EASTER_EGG_8 = Paper airplane differently
EASTER_EGG_9 = How did we get here?
EASTER_EGG_10 = Carving the pumpkin
EASTER_EGG_11 = Flying into sunset
EASTER_EGG_12 = Just a bunch of NPCs
EASTER_EGG_13 = Ei'm waiting
EASTER_EGG_14 = Secret Santa
EASTER_EGG_15 = Emergency Meeting
EASTER_EGG_16 = WGS2022
EASTER_EGG_17 = The world in Preditors hands
EASTER_EGG_18 = Split personalities
EASTER_EGG_19 = The emperor traveling
EASTER_EGG_20 = Guinness
EASTER_EGG_21 = Gulsch Kanone
EASTER_EGG_22 = Ei mit Bard
EASTER_EGG_23 = Mines of Moria
EASTER_EGG_24 = Heart of the mountain
EASTER_EGG_25 = Fly me to the moon
EASTER_EGG_26 = Visitors from another world
EASTER_EGG_27 = Sewage
EASTER_EGG_28 = Sewage Valley
EASTER_EGG_29 = Beginning of the End
EASTER_EGG_30 = Egghaust
EASTER_EGG_31 = Touchdown
EASTER_EGG_32 = Advanced Rocketry
EASTER_EGG_33 = Borderlands
EASTER_EGG_34 = Kiss the frog
EASTER_EGG_35 = Niagara Falls
EASTER_EGG_36 = The Escapist
EASTER_EGG_37 = Mini Egg
EASTER_EGG_38 = Goblin Cave
EASTER_EGG_39 = Asse
EASTER_EGG_40 = Yggdrasil
EASTER_EGG_41 = Bridge Review
EASTER_EGG_42 = May the cucumber be with you
EASTER_EGG_43 = Most hard working builder on SW
EASTER_EGG_44 = There is another
EASTER_EGG_45 = Frozen
EASTER_EGG_46 = In front of the forrest
EASTER_EGG_47 = Yes Mr. President
EASTER_EGG_48 = [PL]ague and Pain
EASTER_EGG_49 = Elevator music
EASTER_EGG_50 = Blue (Da Ba Dee)
EASTER_EGG_51 = Peak niveau
EASTER_EGG_52 = wuuuzzzzuuuuup
EASTER_EGG_53 = Point Plank
EASTER_EGG_54 = §eSteam§8War
EASTER_EGG_55 = Read the fineprint
EASTER_EGG_56 = The same we do every night Pinky
EASTER_EGG_57 = (Don\'t) JUMP
EASTER_EGG_58 = Yin and Yang
EASTER_EGG_59 = Just hanging around
EASTER_EGG_60 = Chick-fil-A
EASTER_EGG_61 = Today in the interview
EASTER_EGG_62 = Ahoy cadets
EASTER_EGG_63 = This is the way
EASTER_EGG_64 = Hamburg meine Perle
EASTER_EGG_65 = Icicle
EASTER_EGG_66 = Easter Rock
EASTER_EGG_67 = Eurasia
EASTER_EGG_68 = Kola-Bohrung
EASTER_EGG_69 = The hobbit
EASTER_EGG_70 = Jungle camp
EASTER_EGG_71 = Nutshell
EASTER_EGG_72 = Fisherman´s Friend
EASTER_EGG_73 = Point nemo
EASTER_EGG_74 = I'm Groot
EASTER_EGG_75 = Crossing
EASTER_EGG_76 = Breakthrough
EASTER_EGG_77 = Doomsday Valley
EASTER_EGG_78 = North Carolina
EASTER_EGG_79 = 16 inches of power
EASTER_EGG_80 = Melons
EASTER_EGG_81 = Maintainance
EASTER_EGG_82 = Map Room
EASTER_EGG_83 = The World upside down
EASTER_EGG_84 = Dirty Chamber
EASTER_EGG_85 = Old server Team
EASTER_EGG_86 = Union
EASTER_EGG_87 = Mushroom
EASTER_EGG_88 = Advertisement
EASTER_EGG_89 = Stairway to heaven
# Advent Calendar
ADVENT_CALENDAR_TITLE=§eAdvent Calendar
ADVENT_CALENDAR_DAY=§7Day§8: §e{0}
ADVENT_CALENDAR_MESSAGE=§eDid you already open your advent calendar? Click the Big Presents to claim!
ADVENT_CALENDAR_OPEN=§7You got §e{0} §7from the advent calendar!
PARTICLE_EVENT_WARGEARCLASH = §fClash

Datei anzeigen

@ -1,264 +0,0 @@
PREFIX = §eLobby§8System§8»
TIME = HH:mm:ss
DATE=........
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---
# ServerTeamNPC's
NPC_CHAT_1 = §fHallo, ich bin {0} und bin ein {1}.
NPC_CHAT_2 = §fWillkommen auf §eSteam§8War§f, viel Spaß dir.
# Portal Command
PORTAL_COMMAND_LIST_HELP = §8/§7portal §elist §8- §7Listet alle Portale auf
PORTAL_COMMAND_ADD_HELP = §8/§7portal §ecreate §8[§7PortalType§8] §8[§7PortalName§8] §8- §7Fügt ein Portal hinzu
PORTAL_COMMAND_REMOVE_HELP = §8/§7portal §eremove §8[§7PortalName§8] §8- §7Entfernt ein Portal
PORTAL_COMMAND_LIST_SHORT_INFO = §e{0} §8- §7{1} §7Pos1§8(§7{2}§8) §7Pos2§8(§7{3}§8)
PORTAL_NO_WORLDEDIT_SELECTION = §cKeine WorldEdit Selection
# Particle
PARTICLE_INVENTORY = §0Partikel
PARTICLE_DESELECT = §8Keine Partikel
PARTICLE_SHOW_HAS_ALL = §8Du hast alle Partikel
PARTICLE_SHOW_ALL = §aZeige alle
PARTICLE_SHOW_UNLOCKED = §cZeige freigeschaltete
PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch
PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0}
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM_EASTER = §fTeam {0} (Oster-Eierer-Suche)
PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0}
PARTICLE_UNLOCKED_BY_SPECIFIC_USER_EASTER = §fUser {0} (Oster-Eierer-Suche)
PARTICLE_UNLOCKED_BY_EVENT = §fEventteilnahme
PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServerteam
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz
PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION = §f{0}
PARTICLE_UNLOCKED_BY_EASTER_EGG_HUNT_HALF = §fFinde 45 Oster-Eierer
PARTICLE_UNLOCKED_BY_EASTER_EGG_HUNT_DIFFICULTY = §fAlle Eierer mit Schwierigkeit {0} finden
PARTICLE_ATTRIBUTE_CIRCLE = §8-§f Ring
PARTICLE_ATTRIBUTE_BI_CIRCLE = §8-§f Doppelring
PARTICLE_ATTRIBUTE_CLOUD = §8-§f Wolke
PARTICLE_ATTRIBUTE_TICK = §8-§f Immer aktiv
PARTICLE_ATTRIBUTE_NON_FLOOR = §8-§f In der Luft
PARTICLE_ATTRIBUTE_FLOOR = §8-§f Auf dem Boden
PARTICLE_ATTRIBUTE_NON_FLYING = §8-§f Nicht am Fliegen
PARTICLE_ATTRIBUTE_FLYING = §8-§f Am Fliegen
PARTICLE_ATTRIBUTE_WING = §8-§f Flügel
PARTICLE_ATTRIBUTE_SNEAKING = §8-§f Ducken
PARTICLE_ATTRIBUTE_NON_MOVING = §8-§f Beim Stehen
PARTICLE_ATTRIBUTE = §eAttribute§7:
PARTICLE_SELECT = §eZum Auswählen klicken
PARTICLE_LOCKED = §c§lGesperrt
PARTICLE_DEACTIVATED = §cEs sind zu viele Spieler online! Partikel sind deaktiviert.
PARTICLE_SNEEZE = §aSneeze
PARTICLE_SMOKE = §7Rauch
PARTICLE_FIRE = §cFeuer
PARTICLE_WATER = §bWasser
PARTICLE_HEART = §cHerzen
PARTICLE_NOTES = §eNoten
PARTICLE_NAUTILUS = §aNautilus
PARTICLE_SNOWBALL = §fSchneeball
PARTICLE_EFFECT = §5Effekt
PARTICLE_CAMPFIRE = §7Rauch
PARTICLE_MAGIC = §5Magie
PARTICLE_ANGRY = §4Wut
PARTICLE_SLIME = §aSchleim
PARTICLE_MOB = §7Mob
PARTICLE_SQUID = §8Tintenfisch
PARTICLE_BUBBLE = §aBlasen
PARTICLE_HONEY = §6Honig
PARTICLE_NECTAR = §6Nektar
PARTICLE_FIREWORK = §7Feuerwerk
PARTICLE_DRAGON_BREATH = §5Drachenatem
PARTICLE_DAMAGE = §5Schaden
PARTICLE_DOLPHIN = §dDelphin
PARTICLE_WITCH = §5Hexe
PARTICLE_ENCHANTING = §eZauber
PARTICLE_HAPPY = §2Freude
PARTICLE_FLAME = §7Flammen
PARTICLE_END_ROD = §fEnd Rod
PARTICLE_CLOUD = §7Wolke
PARTICLE_TOTEM = §aTotem
PARTICLE_TOWN = §5Town
PARTICLE_ENCHANTING_CIRCLE = §fVerzaubert
PARTICLE_WATER_FIRE = §bWasser§7/§cFeuer
PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber
PARTICLE_WINGS_EVIL = §5Lila Flügel
PARTICLE_PLAYER_RONGAMER99091_AURA = §7Rauchgranate
PARTICLE_TEAM_PULSE_HEART_BEAT = §cHerzschlag
PARTICLE_RAINCLOUD_NORMAL = §fRegenwolke
PARTICLE_RAINCLOUD_RED = §fLavawolke
PARTICLE_RAINCLOUD_YELLOW = §fNektarwolke
PARTICLE_RAINCLOUD_ORANGE = §fHonigwolke
PARTICLE_RAINCLOUD_GREEN = §fSporenwolke
PARTICLE_RAINCLOUD_PURPLE = §fObsidanwolke
PARTICLE_RAINCLOUD_NAUTILUS = §fNautiluswolke
PARTICLE_RAINCLOUD_ENCHANTMENT = §fVerzauberungswolke
PARTICLE_RAINCLOUD_SLIME = §fSchleimwolke
PARTICLE_RAINCLOUD_HAIL = §fHagelwolke
PARTICLE_RAINCLOUD_SNOW = §fSchneewolke
PARTICLE_RAINCLOUD_TOTEM = §fTotemwolke
PARTICLE_EVENT_ENCHANTING = §cVerzaubert
PARTICLE_EVENT_CLOUD = §fWolken
PARTICLE_EVENT_SMOKE = §7Rauch
PARTICLE_EVENT_WATER = §bWasser
PARTICLE_EVENT_WINGS = §fFlügel
PARTICLE_EVENT_RAIN_CLOUD = §fRegenwolke
PARTICLE_EVENT_WGS = §fWGS
PARTICLE_EVENT_WARGEARCLASH = §fClash
PARTICLE_EGG_HUNT_EASY = §aGrünplfanzen
PARTICLE_EGG_HUNT_MEDIUM = §eVersteckspiel
PARTICLE_EGG_HUNT_HARD = §cOrbit
PARTICLE_EGG_HUNT_EXTREME = §5Lila regen
PARTICLE_EGG_HUNT_ADVANCED = §5Abheben
PARTICLE_EGG_HUNT_HALF = §fDie Jagd ist eröffnet
JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails
JUMP_AND_RUN_PERSONAL_BEST = §aNice! Du hast deinen Rekord um {0} verbessert!
JUMP_AND_RUN_PERSONAL_BEST_TIME = §aDein Rekord ist {0}
JUMP_AND_RUN_PERSONAL_BEST_NO_TIME = §cDu hast noch keinen Rekord
JUMP_AND_RUN_REPLAY_ENABLED = §aReplay aktiviert
JUMP_AND_RUN_REPLAY_DISABLED = §cReplay deaktiviert
# Games
GAMES_TICTACTOE = TicTacToe
GAMES_CONNECT_4 = Vier Gewinnt
GAMES_ALREADY_PRESENT = §cDu hast bereits eine Herausforderung!
GAMES_NO_SELF = §cDu kannst dich nicht selbst herausfordern!
GAMES_CHALLENGED_BY = §e{0} §7hat dich zu einem Spiel §e{1}§7 herausgefordert!
GAMES_CHALLENGED_BY_HOVER = §7Klicke hier, um das Spiel zu bestätigen
GAMES_WON = §6{0} hat das Spiel gewonnen!
GAMES_DRAW = §6Unentschieden!
GAMES_TURN = {0} ist dran
GAMES_LEFT = §7{0} hat das Spiel verlassen
BOAT_RACE_TIME = §7Abgeschlossen in {0}
BOAT_RACE_NEW_BEST = §aNeue Bestzeit!
# Easter Egg Hunt
DIFFICULTY_EASY = §aLeicht
DIFFICULTY_MEDIUM = §eMedium
DIFFICULTY_HARD = §cHart
DIFFICULTY_EXTREME = §5Extrem
DIFFICULTY_ADVANCED = §5Advanced
EASTER_EGG_MENU = §0Oster Eier Suche {0}/{1}
EASTER_EGG_SELECTION_ALL = §eAlle
EASTER_EGG_SELECTION_FOUND = §aGefunden
EASTER_EGG_SELECTION_NOT_FOUND = §cNicht gefunden
EASTER_EGG_0 = Wo alles begann
EASTER_EGG_1 = Jump and Run
EASTER_EGG_2 = Carry me please
EASTER_EGG_3 = Der Kran
EASTER_EGG_4 = Trust fall
EASTER_EGG_5 = Run forrest run
EASTER_EGG_6 = Wichtige Zustellung
EASTER_EGG_7 = Ei believe I can fly
EASTER_EGG_8 = Papierflieger mal anders
EASTER_EGG_9 = Wie sind wir hier hingekommen?
EASTER_EGG_10 = Kürbisschnitzen
EASTER_EGG_11 = Flug in den Sonnentunergang
EASTER_EGG_12 = Ein haufen NPCs
EASTER_EGG_13 = Ei'm waiting
EASTER_EGG_14 = Secret Santa
EASTER_EGG_15 = Emergency Meeting
EASTER_EGG_16 = WGS2022
EASTER_EGG_17 = Die Welt in den Händen von Preditors
EASTER_EGG_18 = Gespaltene Persönlichkeiten
EASTER_EGG_19 = Der Kaiser auf reisen
EASTER_EGG_20 = Guinness
EASTER_EGG_21 = Gulsch Kanone
EASTER_EGG_22 = Ei mit Bard
EASTER_EGG_23 = Die Minen von Moria
EASTER_EGG_24 = Das Herz des Berges
EASTER_EGG_25 = Fly me to the moon
EASTER_EGG_26 = Besucher aus einer anderen Welt
EASTER_EGG_27 = Abwasser
EASTER_EGG_28 = Tal der Abwässer
EASTER_EGG_29 = Der Anfang vom Ende
EASTER_EGG_30 = Egghaust
EASTER_EGG_31 = Touchdown
EASTER_EGG_32 = Advanced Rocketry
EASTER_EGG_33 = Borderlands
EASTER_EGG_34 = Küss den Frosch
EASTER_EGG_35 = Niagara Fälle
EASTER_EGG_36 = The Escapist
EASTER_EGG_37 = Mini Ei
EASTER_EGG_38 = Koboldhöhle
EASTER_EGG_39 = Asse
EASTER_EGG_40 = Yggdrasil
EASTER_EGG_41 = Bridge Review
EASTER_EGG_42 = Möge die Gurke mit dir sein
EASTER_EGG_43 = Most hard working builder on SW
EASTER_EGG_44 = There is another
EASTER_EGG_45 = Frozen
EASTER_EGG_46 = Vor dem Wald
EASTER_EGG_47 = Yes Mr. President
EASTER_EGG_48 = [PL]ague and Pain
EASTER_EGG_49 = Elevator music
EASTER_EGG_50 = Blue (Da Ba Dee)
EASTER_EGG_51 = Peak niveau
EASTER_EGG_52 = wuuuzzzzuuuuup
EASTER_EGG_53 = Point Plank
EASTER_EGG_54 = §eSteam§8War
EASTER_EGG_55 = Lese das Kleingedruckte
EASTER_EGG_56 = The same we do every night Pinky
EASTER_EGG_57 = (Nicht) SPRINGEN
EASTER_EGG_58 = Yin und Yang
EASTER_EGG_59 = Just hanging around
EASTER_EGG_60 = Chick-fil-A
EASTER_EGG_61 = Heute im Interview
EASTER_EGG_62 = Ahoi Kadetten
EASTER_EGG_63 = Das ist der Weg
EASTER_EGG_64 = Hamburg meine Perle
EASTER_EGG_65 = Eiszapfen
EASTER_EGG_66 = Easter Rock
EASTER_EGG_67 = Eurasia
EASTER_EGG_68 = Kola-Bohrung
EASTER_EGG_69 = Der hobbit
EASTER_EGG_70 = Jungel Kamp
EASTER_EGG_71 = Nussschale
EASTER_EGG_72 = Fisherman´s Friend
EASTER_EGG_73 = Point nemo
EASTER_EGG_74 = Ich bin Groot
EASTER_EGG_75 = Kreuzung
EASTER_EGG_76 = Durchbruch
EASTER_EGG_77 = Doomsday Valley
EASTER_EGG_78 = North Carolina
EASTER_EGG_79 = 16 inches of power
EASTER_EGG_80 = Melonen
EASTER_EGG_81 = Wartungsarbeiten
EASTER_EGG_82 = Kartenraum
EASTER_EGG_83 = Die Welt steht Kopf
EASTER_EGG_84 = Schmutziges Kabuff
EASTER_EGG_85 = Altes Serverteam
EASTER_EGG_86 = Union
EASTER_EGG_87 = Mushroom
EASTER_EGG_88 = Werbung
EASTER_EGG_89 = Stairway to heaven
# Advent Calendar
ADVENT_CALENDAR_TITLE=§eAdventskalender
ADVENT_CALENDAR_DAY=§7Tag§8: §e{0}
ADVENT_CALENDAR_MESSAGE=§eHast du heute schon dein Geschenk geholt? Klicke die großen Geschenke zum erhalten!
ADVENT_CALENDAR_OPEN=§7Du hast §e{0}§7 aus dem Adventskalender erhalten!

Datei anzeigen

@ -19,30 +19,19 @@
package de.steamwar.lobby;
import de.steamwar.lobby.jumpandrun.JumpAndRun;
import de.steamwar.network.packets.PacketHandler;
import de.steamwar.network.packets.common.FightInfoPacket;
import de.steamwar.network.packets.server.StartingServerPacket;
import com.google.common.io.ByteArrayDataInput;
import de.steamwar.comms.BungeeReceiver;
import de.steamwar.comms.PacketIdManager;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
import java.util.Objects;
public class LobbyPacketHandler extends PacketHandler {
@Handler
public void handleFightserver(FightInfoPacket packet) {
Fightserver.newFightInfo(packet);
public class WaitingHall {
public WaitingHall() {
BungeeReceiver.registerHandler(PacketIdManager.STARTING_SERVER, this::serverStarting);
}
@Handler
public void serverStarting(StartingServerPacket packet) {
Player player = Objects.requireNonNull(Bukkit.getPlayer(SteamwarUser.get(packet.getUser()).getUUID()));
player.teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN);
if (JumpAndRun.isPlayerInJumpAndRun(player)) {
JumpAndRun.reset(player);
}
private void serverStarting(ByteArrayDataInput in) {
Bukkit.getPlayer(SteamwarUser.get(in.readInt()).getUUID()).teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN);
}
}

Datei anzeigen

@ -1,161 +0,0 @@
package de.steamwar.lobby.boatrace;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.util.Leaderboard;
import de.steamwar.sql.UserConfig;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.event.vehicle.VehicleMoveEvent;
import org.bukkit.scheduler.BukkitTask;
import java.util.EventListener;
import static de.steamwar.lobby.util.Leaderboard.renderTime;
public class BoatRace implements EventListener, Listener {
private static final double MIN_HEIGHT = 4.3;
public static final REntityServer boatNpcServer;
private static boolean oneNotStarted = false;
private static final Leaderboard leaderboard;
static {
boatNpcServer = new REntityServer();
REntity starter = new REntity(boatNpcServer, EntityType.VILLAGER, BoatRacePositions.NPC);
boatNpcServer.setCallback((player, rEntity, entityAction) -> {
if (rEntity != starter) return;
Bukkit.getWorlds().get(0).getEntities().stream().filter(entity -> entity.getType() == EntityType.ENDER_CRYSTAL).forEach(Entity::remove);
if (entityAction == REntityServer.EntityAction.INTERACT && !oneNotStarted) {
oneNotStarted = true;
new BoatRace(player);
}
});
leaderboard = new Leaderboard(boatNpcServer, "lobby@boatrace", BoatRacePositions.LEADERBOARD, 5);
}
private final Player player;
private Boat boat;
private int nextCheckpoint = 0;
private long startTime;
private final BukkitTask task;
private final BossBar bossBar;
private boolean hasBacked = false;
private double lastDistance;
@EventHandler
public void onBoatMove(VehicleMoveEvent event) {
if (event.getVehicle() != boat) return;
lastDistance = event.getFrom().distance(event.getTo());
if(nextCheckpoint == 0 && inRegion(player, BoatRacePositions.BACKWARDS[0], BoatRacePositions.BACKWARDS[1])) {
player.eject();
player.teleport(BoatRacePositions.END);
oneNotStarted = false;
return;
}
if(player.getLocation().getY() < MIN_HEIGHT) {
Location[] backTo = BoatRacePositions.CHECKPOINTS[nextCheckpoint - 1];
Location avg = new Location(backTo[0].getWorld(), (backTo[0].getX() + backTo[1].getX()) / 2, Math.max(backTo[0].getY(), backTo[1].getY()), (backTo[0].getZ() + backTo[1].getZ()) / 2, backTo[0].getYaw(), backTo[0].getPitch());
Boat nboat = Bukkit.getWorlds().get(0).spawn(avg, Boat.class);
nboat.setBoatType(boat.getBoatType());
hasBacked = true;
player.eject();
boat.remove();
boat = nboat;
boat.addPassenger(player);
player.playSound(avg, Sound.ENTITY_ENDERMAN_TELEPORT, 1, 1);
return;
}
Location[] checkpoint = BoatRacePositions.CHECKPOINTS[nextCheckpoint];
if(inRegion(player, checkpoint[0], checkpoint[1])) {
if(nextCheckpoint == 0) {
oneNotStarted = false;
startTime = System.currentTimeMillis();
bossBar.addPlayer(player);
bossBar.setVisible(true);
}
nextCheckpoint++;
if (nextCheckpoint == BoatRacePositions.CHECKPOINTS.length) {
long time = System.currentTimeMillis() - startTime;
boat.remove();
player.eject();
player.teleport(BoatRacePositions.END);
player.playSound(player.getLocation(), Sound.UI_TOAST_CHALLENGE_COMPLETE, 1, 1);
bossBar.removeAll();
HandlerList.unregisterAll(this);
task.cancel();
LobbySystem.getMessage().send("BOAT_RACE_TIME", player, renderTime(time));
String conf = UserConfig.getConfig(player.getUniqueId(), "lobby@boatrace");
long best = Long.parseLong(conf == null ? String.valueOf(Long.MAX_VALUE) : conf);
if (time < best) {
LobbySystem.getMessage().send("BOAT_RACE_NEW_BEST", player);
UserConfig.updatePlayerConfig(player.getUniqueId(), "lobby@boatrace", String.valueOf(time));
leaderboard.update();
}
} else {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
}
}
}
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
if (event.getVehicle() != boat) return;
if (event.getExited() != player) return;
if (hasBacked) return;
HandlerList.unregisterAll(this);
task.cancel();
bossBar.removeAll();
boat.remove();
player.teleport(BoatRacePositions.END);
oneNotStarted = false;
}
public BoatRace(Player player) {
this.player = player;
boat = Bukkit.getWorlds().get(0).spawn(BoatRacePositions.START, Boat.class);
// boat.setBoatType(Boat.Type.values()[new Random().nextInt(Boat.Type.values().length)]);
boat.addPassenger(player);
bossBar = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SOLID);
task = Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
hasBacked = false;
if (nextCheckpoint != 0) {
double kmh = lastDistance * 20 * 3.6;
bossBar.setProgress((nextCheckpoint - 1d) / (BoatRacePositions.CHECKPOINTS.length - 1d));
bossBar.setTitle(LobbySystem.getMessage().parse("BOAT_RACE_TITLE", player, nextCheckpoint, renderTime(System.currentTimeMillis() - startTime), (int) kmh));
}
}, 0, 1);
Bukkit.getPluginManager().registerEvents(this, LobbySystem.getPlugin());
}
private boolean inRegion(Player p, Location loc1, Location loc2) {
double x1 = Math.min(loc1.getX(), loc2.getX());
double y1 = Math.min(loc1.getY(), loc2.getY());
double z1 = Math.min(loc1.getZ(), loc2.getZ());
double x2 = Math.max(loc1.getX(), loc2.getX()) + 1;
double y2 = Math.max(loc1.getY(), loc2.getY()) + 1;
double z2 = Math.max(loc1.getZ(), loc2.getZ()) + 1;
return p.getLocation().getX() >= x1 && p.getLocation().getY() >= y1 && p.getLocation().getZ() >= z1 && p.getLocation().getX() < x2 && p.getLocation().getY() < y2 && p.getLocation().getZ() < z2;
}
}

Datei anzeigen

@ -1,55 +0,0 @@
package de.steamwar.lobby.boatrace;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class BoatRacePositions {
public static final Location LEADERBOARD = loc(2414, 7, 1542.5);
public static final Location NPC = loc(2424.5, 5, 1544.5, -180, 0);
public static final Location START = loc(2410.5, 6, 1537.5, -90, 0);
public static final Location[][] CHECKPOINTS = new Location[][] {
new Location[] {
loc(2414, 4, 1528, -90, 0),
loc(2415, 8, 1542),
},
new Location[] {
loc(2484, 4, 1456, -180, 0),
loc(2494, 8, 1459),
},
new Location[] {
loc(2310, 4, 1475, 0, 0),
loc(2321, 8, 1477),
},
new Location[] {
loc(2428, 4, 1448, -90, 0),
loc(2430, 8, 1458),
},
new Location[] {
loc(2392, 4, 1492, 90, 0),
loc(2394, 8, 1502),
},
new Location[] {
loc(2414, 4, 1528, -90, 0),
loc(2416, 8, 1542),
},
};
public static final Location[] BACKWARDS = new Location[] {
loc(2407, 3,1526),
loc(2408, 9,1544)
};
public static final Location END = loc(2449.5, 6, 1550, -180, 0);
private static Location loc(double x, double y, double z) {
return new Location(Bukkit.getWorlds().get(0), x, y, z);
}
private static Location loc(double x, double y, double z, float yaw, float pitch) {
return new Location(Bukkit.getWorlds().get(0), x, y, z, yaw, pitch);
}
}

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.lobby.command;
import de.steamwar.command.SWCommand;
import de.steamwar.lobby.util.LobbyPlayer;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import de.steamwar.sql.UserGroup;
import org.bukkit.entity.Player;
public class FlyCommand extends SWCommand {
@ -33,9 +33,10 @@ public class FlyCommand extends SWCommand {
@Register
public void genericCommand(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if (!user.hasPerm(UserPerm.TEAM)) {
if (userGroup == UserGroup.Member) {
player.sendMessage("§cUnbekannter Befehl.");
return;
}

Datei anzeigen

@ -43,7 +43,7 @@ public class HologramCommand extends SWCommand {
public void portalCreate(Player player, String id, String... text) {
if (PortalCommand.noPermissions(player)) return;
new Hologram(id, player.getLocation(), String.join(" ", text).replace("&", "§"), false);
new Hologram(id, player.getLocation(), String.join(" ", text), false);
LobbySystem.config().save();
}

Datei anzeigen

@ -21,9 +21,7 @@ package de.steamwar.lobby.command;
import de.steamwar.command.SWCommand;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.listener.PlayerSpawn;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.HumanEntity;
@ -51,38 +49,21 @@ public class ModifyCommand extends SWCommand implements Listener {
@Register
public void modify(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(!user.hasPerm(UserPerm.ADMINISTRATION)) {
if(!user.getUserGroup().isTeamGroup())
return;
}
if(modifying(player)) {
modifying.remove(player);
LobbySystem.getEntityServer(true).removePlayer(player);
player.setGameMode(GameMode.ADVENTURE);
player.setOp(false);
PlayerSpawn.giveItems(player);
}else {
modifying.add(player);
LobbySystem.getEntityServer(true).addPlayer(player);
player.setGameMode(GameMode.CREATIVE);
player.setOp(true);
}
modifying.add(player);
player.setGameMode(GameMode.CREATIVE);
player.setOp(true);
}
@EventHandler
public void onLeave(PlayerQuitEvent event) {
Player player = event.getPlayer();
modifying.remove(player);
player.setOp(false);
modifying.remove(event.getPlayer());
}
@Register("waitinghallspawn")
public void setWaitingHallSpawn(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(!user.hasPerm(UserPerm.ADMINISTRATION))
return;
LobbySystem.config().setWaitingHallSpawn(player.getLocation());
}
}

Datei anzeigen

@ -11,12 +11,11 @@ import de.steamwar.command.TypeMapper;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.portal.*;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import lombok.Data;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
@ -30,10 +29,10 @@ public class PortalCommand extends SWCommand {
public static boolean noPermissions(Player player) {
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
return !steamwarUser.hasPerm(UserPerm.ADMINISTRATION);
return !steamwarUser.getUserGroup().isTeamGroup();
}
@Register
@Register(help = true)
public void genericHelp(Player player, String... args) {
if (noPermissions(player)) return;
LobbySystem.getMessage().sendPrefixless("COMMAND_HELP_HEAD", player, "portal");
@ -103,8 +102,7 @@ public class PortalCommand extends SWCommand {
private Location locationOfPlayer(Player player) {
Location l = player.getLocation();
l.setYaw(((CraftPlayer)player).getHandle().cm());
l.setYaw(((CraftPlayer)player).getHandle().getHeadRotation());
return l;
}

Datei anzeigen

@ -0,0 +1,119 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.display;
import de.steamwar.lobby.listener.BasicListener;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
public class Displayable extends BasicListener {
private final Set<Player> visible = new HashSet<>();
private int chunkX;
private int chunkZ;
private final Consumer<Player> show;
private final Consumer<Player> hide;
private final Consumer<Player> move;
private final Function<Player, Boolean> playerFilter;
public Displayable(Location location, Consumer<Player> show, Consumer<Player> hide, Consumer<Player> move) {
this(location, show, hide, move, player -> true);
}
public Displayable(Location location, Consumer<Player> show, Consumer<Player> hide, Function<Player, Boolean> playerFilter) {
this(location, show, hide, player -> {}, playerFilter);
}
public Displayable(Location location, Consumer<Player> show, Consumer<Player> hide, Consumer<Player> move, Function<Player, Boolean> playerFilter) {
this.show = show;
this.hide = hide;
this.move = move;
this.playerFilter = playerFilter;
setLocation(location);
}
public void setLocation(Location location) {
chunkX = posToChunk(location.getX());
chunkZ = posToChunk(location.getZ());
Bukkit.getOnlinePlayers().forEach(this::checkLocation);
visible.forEach(move);
}
public Set<Player> getVisitors() {
return visible;
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
checkLocation(e.getPlayer());
}
@EventHandler
public void onMove(PlayerMoveEvent e) {
checkLocation(e.getPlayer());
}
public void checkLocation(Player player) {
if(!playerFilter.apply(player))
return;
Location at = player.getLocation();
boolean shown = visible.contains(player);
int viewDistance = player.getClientViewDistance() / 2;
boolean see = Math.abs(chunkX - posToChunk(at.getX())) < viewDistance && Math.abs(chunkZ - posToChunk(at.getZ())) < viewDistance;
if(!shown && see) {
show.accept(player);
visible.add(player);
}
if(shown && !see) {
hide.accept(player);
visible.remove(player);
}
}
@EventHandler
public void onQuit(PlayerQuitEvent e) {
visible.remove(e.getPlayer());
}
public void delete() {
visible.forEach(hide);
visible.clear();
HandlerList.unregisterAll(this);
}
private int posToChunk(double coord) {
return (int)(coord / 16) - (coord < 0 ? 1 : 0);
}
}

Datei anzeigen

@ -19,30 +19,100 @@
package de.steamwar.lobby.display;
import de.steamwar.entity.RArmorStand;
import de.steamwar.lobby.LobbySystem;
import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.lobby.command.ModifyCommand;
import org.bukkit.Location;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.*;
public class Hologram implements ConfigurationSerializable {
private static final Class<?> dataWatcherObject = Reflection.getClass("{nms}.DataWatcherObject");
private static final Class<?> dataWatcherRegistry = Reflection.getClass("{nms}.DataWatcherRegistry");
private static final Class<?> dataWatcherSerializer = Reflection.getClass("{nms}.DataWatcherSerializer");
private static final Reflection.ConstructorInvoker dataWatcherObjectConstructor = Reflection.getConstructor(dataWatcherObject, int.class, dataWatcherSerializer);
private static Object getDataWatcherObject(int index, Class<?> type) {
for(Field field : dataWatcherRegistry.getFields()) {
if(dataWatcherSerializer.isAssignableFrom(field.getType()) && type.equals(((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0])) {
try {
return dataWatcherObjectConstructor.invoke(index, field.get(null));
} catch (IllegalAccessException e) {
throw new SecurityException("Could not get field", e);
}
}
}
throw new SecurityException("Could not find Serializer for " + type.getName());
}
private static Object getDataWatcherObject(int index, int fieldIndex) {
try {
return dataWatcherObjectConstructor.invoke(index, dataWatcherRegistry.getFields()[fieldIndex].get(null));
} catch (IllegalAccessException e) {
throw new SecurityException("Could not get field", e);
}
}
private static final Class<?> spawnLivingPacket = Reflection.getClass("{nms}.PacketPlayOutSpawnEntityLiving");
private static final Reflection.ConstructorInvoker spawnLivingPacketConstructor = Reflection.getConstructor(spawnLivingPacket);
private static final Reflection.FieldAccessor<Integer> spawnLivingEntityId = Reflection.getField(spawnLivingPacket, int.class, 0);
private static final Reflection.FieldAccessor<UUID> spawnLivingUUID = Reflection.getField(spawnLivingPacket, UUID.class, 0);
private static final Reflection.FieldAccessor<Integer> spawnLivingEntityType = Reflection.getField(spawnLivingPacket, int.class, 1);
private static final Reflection.FieldAccessor<Double> spawnLivingEntityX = Reflection.getField(spawnLivingPacket, double.class, 0);
private static final Reflection.FieldAccessor<Double> spawnLivingEntityY = Reflection.getField(spawnLivingPacket, double.class, 1);
private static final Reflection.FieldAccessor<Double> spawnLivingEntityZ = Reflection.getField(spawnLivingPacket, double.class, 2);
private static final Class<?> metadataPacket = Reflection.getClass("{nms}.PacketPlayOutEntityMetadata");
private static final Reflection.ConstructorInvoker metadataConstructor = Reflection.getConstructor(metadataPacket);
private static final Reflection.FieldAccessor<Integer> metadataEntity = Reflection.getField(metadataPacket, int.class, 0);
private static final Reflection.FieldAccessor<List> metadataMetadata = Reflection.getField(metadataPacket, List.class, 0);
private static final Class<?> item = Reflection.getClass("{nms}.DataWatcher$Item");
private static final Reflection.ConstructorInvoker itemConstructor = Reflection.getConstructor(item, dataWatcherObject, Object.class);
private static final Object invisibleWatcher = getDataWatcherObject(0, Byte.class);
private static final Object nameWatcher = getDataWatcherObject(2, 5);
private static final Object nameVisibleWatcher = getDataWatcherObject(3, Boolean.class);
private static final Object sizeWatcher = getDataWatcherObject(14, Byte.class);
private static final Class<?> chatComponentText = Reflection.getClass("{nms}.ChatComponentText");
private static final Reflection.ConstructorInvoker chatComponentTextConstructor = Reflection.getConstructor(chatComponentText, String.class);
private static final Class<?> destroyPacket = Reflection.getClass("{nms}.PacketPlayOutEntityDestroy");
private static final Reflection.ConstructorInvoker destoryPacketConstructor = Reflection.getConstructor(destroyPacket);
private static final Reflection.FieldAccessor<int[]> destroyIds = Reflection.getField(destroyPacket, int[].class, 0);
public static Object destroyPacket(int entityId) {
Object destroy = destoryPacketConstructor.invoke();
destroyIds.set(destroy, new int[]{entityId});
return destroy;
}
private static int entityIds = -1;
public static int createEntityId() {
return entityIds--;
}
private static final Map<String, Hologram> holograms = new HashMap<>();
private static final Random random = new Random();
public static List<Hologram> getHolograms() {
return new ArrayList<>(holograms.values());
}
public static Hologram getHologram(String id) {
return holograms.get(id);
}
private final Displayable display;
private final int entityId;
private final Object spawnLiving;
private Object metadata;
private final Object destroy;
private final String id;
private final Location location;
private final RArmorStand entity;
private String text;
public Hologram(Map<String, Object> map) {
this((String) map.get("id"), (Location) map.get("location"), (String) map.get("text"), false);
@ -51,17 +121,53 @@ public class Hologram implements ConfigurationSerializable {
public Hologram(String id, Location location, String text, boolean debugHologram) {
this.id = id;
this.location = location;
this.entity = new RArmorStand(LobbySystem.getEntityServer(debugHologram), location, RArmorStand.Size.MARKER);
this.text = text;
entityId = createEntityId();
entity.setInvisible(true);
entity.setDisplayName(text);
spawnLiving = spawnLivingPacketConstructor.invoke();
spawnLivingEntityId.set(spawnLiving, entityId);
spawnLivingUUID.set(spawnLiving, new UUID(random.nextLong() & -61441L | 16384L, random.nextLong() & 4611686018427387903L | -9223372036854775808L));
spawnLivingEntityType.set(spawnLiving, 1);
spawnLivingEntityX.set(spawnLiving, location.getX());
spawnLivingEntityY.set(spawnLiving, location.getY());
spawnLivingEntityZ.set(spawnLiving, location.getZ());
constructMetadataPacket();
destroy = destroyPacket(entityId);
display = new Displayable(location, this::show, this::hide, debugHologram ? ModifyCommand::modifying : player -> true);
if(id != null)
holograms.put(id, this);
}
public void updateText(String text) {
entity.setDisplayName(text);
this.text = text;
constructMetadataPacket();
for(Player player : display.getVisitors()) {
TinyProtocol.instance.sendPacket(player, metadata);
}
}
private void constructMetadataPacket() {
metadata = metadataConstructor.invoke();
metadataEntity.set(metadata, entityId);
List<Object> watchers = new ArrayList<>();
watchers.add(itemConstructor.invoke(invisibleWatcher, (byte) 0x20));
watchers.add(itemConstructor.invoke(nameWatcher, Optional.of(chatComponentTextConstructor.invoke(text))));
watchers.add(itemConstructor.invoke(nameVisibleWatcher, true));
watchers.add(itemConstructor.invoke(sizeWatcher, (byte) 0x10));
metadataMetadata.set(metadata, watchers);
}
private void show(Player player) {
TinyProtocol.instance.sendPacket(player, spawnLiving);
TinyProtocol.instance.sendPacket(player, metadata);
}
private void hide(Player player) {
TinyProtocol.instance.sendPacket(player, destroy);
}
@Override
@ -69,18 +175,18 @@ public class Hologram implements ConfigurationSerializable {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("location", location);
map.put("text", entity.getDisplayName());
map.put("text", text);
return map;
}
public void delete() {
entity.die();
display.delete();
if(id != null)
holograms.remove(id);
}
@Override
public String toString() {
return id + " " + entity.getDisplayName();
return id + " " + text;
}
}

Datei anzeigen

@ -19,19 +19,138 @@
package de.steamwar.lobby.display;
import de.steamwar.entity.RPlayer;
import de.steamwar.lobby.LobbySystem;
import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class NPC {
private static final Class<?> playerInfoPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo");
private static final Reflection.ConstructorInvoker playerInfoConstructor = Reflection.getConstructor(playerInfoPacket);
private static final Class<?> playerInfoActionClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$EnumPlayerInfoAction");
private static final Object addPlayer = playerInfoActionClass.getEnumConstants()[0];
private static final Reflection.FieldAccessor<?> playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0);
private static final Object removePlayer = playerInfoActionClass.getEnumConstants()[4];
private static final Reflection.FieldAccessor<List> playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0);
private static final Class<?> playerInfoDataClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$PlayerInfoData");
private static final Class<?> enumGamemode = Reflection.getClass("{nms.world.level}.EnumGamemode");
private static final Object creative = enumGamemode.getEnumConstants()[2];
private static final Class<?> iChatBaseComponent = Reflection.getClass("{nms.network.chat}.IChatBaseComponent");
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
private static Object playerInfoPacket(Object action, GameProfile profile) {
Object packet = playerInfoConstructor.invoke();
playerInfoAction.set(packet, action);
playerInfoData.set(packet, Collections.singletonList(playerInfoDataConstructor.invoke(packet, profile, 0, creative, null)));
return packet;
}
private static final Class<?> namedSpawnPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutNamedEntitySpawn");
private static final Reflection.ConstructorInvoker namedSpawnConstructor = Reflection.getConstructor(namedSpawnPacket);
private static final Reflection.FieldAccessor<Integer> namedSpawnEntity = Reflection.getField(namedSpawnPacket, int.class, 0);
private static final Reflection.FieldAccessor<UUID> namedSpawnUUID = Reflection.getField(namedSpawnPacket, UUID.class, 0);
private static final Reflection.FieldAccessor<Double> namedSpawnX = Reflection.getField(namedSpawnPacket, double.class, 0);
private static final Reflection.FieldAccessor<Double> namedSpawnY = Reflection.getField(namedSpawnPacket, double.class, 1);
private static final Reflection.FieldAccessor<Double> namedSpawnZ = Reflection.getField(namedSpawnPacket, double.class, 2);
private static final Reflection.FieldAccessor<Byte> namedSpawnYaw = Reflection.getField(namedSpawnPacket, byte.class, 0);
private static final Reflection.FieldAccessor<Byte> namedSpawnPitch = Reflection.getField(namedSpawnPacket, byte.class, 1);
private static final Class<?> headRotationPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityHeadRotation");
private static final Reflection.ConstructorInvoker headRotationConstructor = Reflection.getConstructor(headRotationPacket);
private static final Reflection.FieldAccessor<Integer> headRotationEntity = Reflection.getField(headRotationPacket, int.class, 0);
private static final Reflection.FieldAccessor<Byte> headRotationYaw = Reflection.getField(headRotationPacket, byte.class, 0);
private static final Class<?> movePacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityTeleport");
private static final Reflection.ConstructorInvoker movePacketConstructor = Reflection.getConstructor(movePacket);
private static final Reflection.FieldAccessor<Integer> movePacketEntity = Reflection.getField(movePacket, int.class, 0);
private static final Reflection.FieldAccessor<Double> movePacketX = Reflection.getField(movePacket, double.class, 0);
private static final Reflection.FieldAccessor<Double> movePacketY = Reflection.getField(movePacket, double.class, 1);
private static final Reflection.FieldAccessor<Double> movePacketZ = Reflection.getField(movePacket, double.class, 2);
private static final Reflection.FieldAccessor<Byte> movePacketYaw = Reflection.getField(movePacket, byte.class, 0);
private static final Reflection.FieldAccessor<Byte> movePacketPitch = Reflection.getField(movePacket, byte.class, 1);
private static final Reflection.FieldAccessor<Boolean> movePacketOnGround = Reflection.getField(movePacket, boolean.class, 0);
private static final Class<?> dataWatcherObject = Reflection.getClass("{nms.network.syncher}.DataWatcherObject");
private static final Class<?> dataWatcherRegistry = Reflection.getClass("{nms.network.syncher}.DataWatcherRegistry");
private static final Class<?> dataWatcherSerializer = Reflection.getClass("{nms.network.syncher}.DataWatcherSerializer");
private static final Reflection.ConstructorInvoker dataWatcherObjectConstructor = Reflection.getConstructor(dataWatcherObject, int.class, dataWatcherSerializer);
private static Object getDataWatcherObject(int index, Class<?> type) {
for(Field field : dataWatcherRegistry.getFields()) {
if(dataWatcherSerializer.isAssignableFrom(field.getType()) && type.equals(((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0])) {
try {
return dataWatcherObjectConstructor.invoke(index, field.get(null));
} catch (IllegalAccessException e) {
throw new SecurityException("Could not get field", e);
}
}
}
throw new SecurityException("Could not find Serializer for " + type.getName());
}
private static final Class<?> item = Reflection.getClass("{nms.network.syncher}.DataWatcher$Item");
private static final Reflection.ConstructorInvoker itemConstructor = Reflection.getConstructor(item, dataWatcherObject, Object.class);
private static Object getDataWatcherItem(Object dwo, Object value) {
return itemConstructor.invoke(dwo, value);
}
private static final Class<?> metadataPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityMetadata");
private static final Reflection.FieldAccessor<Integer> metadataEntity = Reflection.getField(metadataPacket, int.class, 0);
private static final Reflection.FieldAccessor<List> metadataMetadata = Reflection.getField(metadataPacket, List.class, 0);
private Object getDataWatcherPacket(Object dataWatcherObject, Object value) {
Object packet = Reflection.newInstance(metadataPacket);
metadataEntity.set(packet, entityId);
metadataMetadata.set(packet, Collections.singletonList(getDataWatcherItem(dataWatcherObject, value)));
return packet;
}
private static Object skinPartsDataWatcherObject = getDataWatcherObject(16, Byte.class);
private final Displayable display;
private final int entityId;
private final UUID uuid;
private final String name;
private Location location;
private final RPlayer entity;
private final Object addPlayerInfo;
private final Object namedSpawn;
private final Object skinParts;
private final Object headRotation;
private final Object removePlayerInfo;
private final Object destroy;
private Object move;
public NPC(Location location, UUID uuid, String name) {
this.entityId = Hologram.createEntityId();
this.uuid = uuid;
this.name = name;
this.location = location;
this.entity = new RPlayer(LobbySystem.getEntityServer(false), uuid, name, location);
GameProfile profile = new GameProfile(uuid, name);
addPlayerInfo = playerInfoPacket(addPlayer, profile);
removePlayerInfo = playerInfoPacket(removePlayer, profile);
destroy = Hologram.destroyPacket(entityId);
skinParts = getDataWatcherPacket(skinPartsDataWatcherObject, (byte) 0x7F);
namedSpawn = namedSpawnConstructor.invoke();
namedSpawnEntity.set(namedSpawn, entityId);
namedSpawnUUID.set(namedSpawn, uuid);
headRotation = headRotationConstructor.invoke();
headRotationEntity.set(headRotation, entityId);
move = movePacketConstructor.invoke();
movePacketEntity.set(move, entityId);
setPackets(location);
display = new Displayable(location, this::show, this::hide, this::move);
}
public void setLocation(Location location) {
@ -39,7 +158,25 @@ public class NPC {
return;
}
this.location = location;
entity.move(location);
setPackets(location);
display.setLocation(location);
}
private void setPackets(Location location) {
byte yaw = (byte)(int)(location.getYaw() * 256.0 / 360.0);
byte pitch = (byte)(int)(location.getPitch() * 256.0 / 360.0);
headRotationYaw.set(headRotation, yaw);
movePacketX.set(move, location.getX());
movePacketY.set(move, location.getY());
movePacketZ.set(move, location.getZ());
movePacketYaw.set(move, yaw);
movePacketPitch.set(move, pitch);
movePacketOnGround.set(move, true);
namedSpawnX.set(namedSpawn, location.getX());
namedSpawnY.set(namedSpawn, location.getY());
namedSpawnZ.set(namedSpawn, location.getZ());
namedSpawnYaw.set(namedSpawn, yaw);
namedSpawnPitch.set(namedSpawn, pitch);
}
private boolean isSimilarLocation(Location location) {
@ -66,10 +203,29 @@ public class NPC {
}
public UUID getUuid() {
return entity.getUuid();
return uuid;
}
private void show(Player player) {
TinyProtocol.instance.sendPacket(player, addPlayerInfo);
TinyProtocol.instance.sendPacket(player, namedSpawn);
TinyProtocol.instance.sendPacket(player, headRotation);
TinyProtocol.instance.sendPacket(player, skinParts);
}
private void hide(Player player) {
if (Bukkit.getOnlinePlayers().stream().noneMatch(p -> p.getUniqueId().equals(uuid))) {
TinyProtocol.instance.sendPacket(player, removePlayerInfo);
}
TinyProtocol.instance.sendPacket(player, destroy);
}
private void move(Player player) {
TinyProtocol.instance.sendPacket(player, headRotation);
TinyProtocol.instance.sendPacket(player, move);
}
public void delete() {
entity.die();
display.delete();
}
}

Datei anzeigen

@ -1,180 +0,0 @@
package de.steamwar.lobby.jumpandrun;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.listener.BasicListener;
import de.steamwar.lobby.listener.PlayerSpawn;
import de.steamwar.lobby.util.Leaderboard;
import de.steamwar.sql.UserConfig;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.text.SimpleDateFormat;
import java.util.*;
public class JumpAndRun extends BasicListener {
public static final String JUMP_AND_RUN_CONFIG = "jump_and_run";
private static final String BAR_EMPTY = "||||||||||||||||||||||||||||||";
public static List<Vector> points = new ArrayList<>();
public static List<Vector> actualPoints = new ArrayList<>();
private static final Map<Player, Integer> CURRENT_POS = new HashMap<>();
private static final Map<Player, Integer> FAILS = new HashMap<>();
private static final Map<Player, Long> START = new HashMap<>();
private static final Map<Player, Long> CLICKED = new HashMap<>();
private static final Map<Player, Integer> CLICKED_COUNT = new HashMap<>();
private static final Leaderboard LEADERBOARD = new Leaderboard(LobbySystem.getEntityServer(false), JUMP_AND_RUN_CONFIG, new Location(Bukkit.getWorlds().get(0), 2338.5, 42.5, 1231.5), 5);
{
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
Set<Player> toReset = new HashSet<>();
CURRENT_POS.forEach((player, index) -> {
if (System.currentTimeMillis() - CLICKED.getOrDefault(player, 0L) > 500) {
CLICKED.remove(player);
CLICKED_COUNT.remove(player);
} else {
CLICKED_COUNT.put(player, CLICKED_COUNT.getOrDefault(player, -1) + 1);
}
Location location = player.getLocation();
Vector point = points.get(index);
if (index < points.size() - 1) {
Vector nextPoint = points.get(index + 1);
double y = Math.min(point.getY(), nextPoint.getY()) - 2;
if (location.getY() < y) {
location.setX(point.getX());
location.setY(point.getY());
location.setZ(point.getZ());
player.teleport(location);
player.playSound(location, Sound.ENTITY_ENDERMAN_TELEPORT, 1, 1);
FAILS.put(player, FAILS.getOrDefault(player, 0) + 1);
}
}
int count = CLICKED_COUNT.getOrDefault(player, -1);
if (count >= 0) {
if (count > 60) {
toReset.add(player);
return;
}
count = Math.min(count / 2, 30);
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_CANCEL", player, ChatMessageType.ACTION_BAR, "§e" + BAR_EMPTY.substring(0, count) + "§7" + BAR_EMPTY.substring(count));
} else {
long time = System.currentTimeMillis() - START.get(player);
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", player), Locale.ROOT);
String parsed = format.format(new Date(time));
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PROGRESS", player, ChatMessageType.ACTION_BAR, index + 1, points.size(), FAILS.get(player), parsed);
}
});
toReset.forEach(player -> {
reset(player);
player.teleport(Bukkit.getWorlds().get(0).getSpawnLocation().clone().add(0.5, 0, 0.5));
});
}, 1, 1);
}
public static boolean isPlayerInJumpAndRun(Player player) {
return CURRENT_POS.containsKey(player);
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Location location = event.getTo();
Location checkLocation = location.clone();
checkLocation.setY(checkLocation.getY() - 0.1);
if (checkLocation.getBlock().getType() == Material.AIR) {
return;
}
int index = CURRENT_POS.getOrDefault(event.getPlayer(), -1) + 1;
if (index >= points.size()) {
return;
}
Vector point = points.get(index);
if (location.getY() < point.getY()) {
return;
}
if (location.toVector().distanceSquared(point) >= 12.25) {
return;
}
CURRENT_POS.put(event.getPlayer(), index);
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 0.4F, 1);
if (index < points.size() - 1) {
event.getPlayer().setCompassTarget(points.get(index + 1).toLocation(location.getWorld()));
}
if (index == 0) {
event.getPlayer().setAllowFlight(false);
event.getPlayer().getInventory().clear();
event.getPlayer().updateInventory();
event.getPlayer().getInventory().setItem(4, new ItemStack(Material.COMPASS, 1));
FAILS.put(event.getPlayer(), 0);
START.put(event.getPlayer(), System.currentTimeMillis());
}
if (index == points.size() - 1) {
long time = System.currentTimeMillis() - START.get(event.getPlayer());
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", event.getPlayer()), Locale.ROOT);
String parsed = format.format(new Date(time));
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_FINISHED", event.getPlayer(), parsed, FAILS.get(event.getPlayer()));
updateJumpAndRunTime(event.getPlayer(), time);
reset(event.getPlayer());
}
}
private void updateJumpAndRunTime(Player player, long time) {
String jumpAndRunTimeConfig = UserConfig.getConfig(player.getUniqueId(), JUMP_AND_RUN_CONFIG);
if (jumpAndRunTimeConfig == null) {
UserConfig.updatePlayerConfig(player.getUniqueId(), JUMP_AND_RUN_CONFIG, time + "");
} else {
long jumpAndRunTime = Long.parseLong(jumpAndRunTimeConfig);
if (time < jumpAndRunTime) {
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", player), Locale.ROOT);
String parsed = format.format(new Date(jumpAndRunTime - time));
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST", player, parsed);
UserConfig.updatePlayerConfig(player.getUniqueId(), JUMP_AND_RUN_CONFIG, time + "");
LEADERBOARD.update();
}
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
CURRENT_POS.remove(player);
START.remove(player);
FAILS.remove(player);
CLICKED.remove(player);
CLICKED_COUNT.remove(player);
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getItem() == null) return;
if (event.getItem().getType() != Material.COMPASS) return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
event.setCancelled(true);
CLICKED.put(event.getPlayer(), System.currentTimeMillis());
}
public static void reset(Player player) {
PlayerSpawn.giveItems(player);
player.setAllowFlight(true);
CURRENT_POS.remove(player);
START.remove(player);
FAILS.remove(player);
CLICKED.remove(player);
CLICKED_COUNT.remove(player);
}
}

Datei anzeigen

@ -1,30 +0,0 @@
package de.steamwar.lobby.jumpandrun;
import de.steamwar.command.SWCommand;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.sql.UserConfig;
import org.bukkit.entity.Player;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class JumpAndRunCommand extends SWCommand {
public JumpAndRunCommand() {
super("jumpandrun");
}
@Register
public void genericCommand(Player player, String... args) {
String time = UserConfig.getConfig(player.getUniqueId(), JumpAndRun.JUMP_AND_RUN_CONFIG);
if (time == null) {
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST_NO_TIME", player);
return;
}
long timeLong = Long.parseLong(time);
SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", player), Locale.ROOT);
String parsed = format.format(new Date(timeLong));
LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST_TIME", player, parsed);
}
}

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.jumpandrun.JumpAndRun;
import de.steamwar.lobby.util.LobbyPlayer;
import org.bukkit.GameMode;
import org.bukkit.Material;
@ -45,7 +44,6 @@ public class DoubleJumpListener extends BasicListener {
@EventHandler
public void handlePlayerToggleFlight(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
if (player.getGameMode() != GameMode.ADVENTURE && player.getGameMode() != GameMode.SURVIVAL) {
return;
}
@ -69,7 +67,6 @@ public class DoubleJumpListener extends BasicListener {
@EventHandler
public void handlePlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
if(player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) return;
if (LobbyPlayer.getLobbyPlayer(player).isFlying()) return;

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.command.ModifyCommand;
import de.steamwar.lobby.special.advent.AdventsCalendar;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
@ -43,15 +42,8 @@ public class InventoryInteraction extends BasicListener {
return;
if(item.getType() == Material.FIREWORK_ROCKET && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
int offset;
if (AdventsCalendar.active()) {
offset = -1;
} else {
offset = 0;
}
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> {
event.getPlayer().getInventory().setItem(PlayerSpawn.FIREWORK_SLOT + offset, PlayerSpawn.FIREWORK);
event.getPlayer().getInventory().setItem(PlayerSpawn.FIREWORK_SLOT, PlayerSpawn.FIREWORK);
}, 1L);
return;
}

Datei anzeigen

@ -17,15 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
package de.steamwar.lobby.listener;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.jumpandrun.JumpAndRun;
import de.steamwar.lobby.listener.BasicListener;
import de.steamwar.lobby.listener.PlayerSpawn;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleInventory;
import de.steamwar.lobby.particle.particles.ParticleEnum;
import de.steamwar.lobby.util.LobbyPlayer;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -33,36 +32,22 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.Map;
public class ParticleListener extends BasicListener {
private static final int PLAYER_MAX_SIZE = 20;
private static final int SERVER_TEAM_MAX_SIZE = 40;
private static double deg = 0;
private static Map<Player, Integer> movingPlayers = new HashMap<>();
public ParticleListener() {
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
movingPlayers.replaceAll((player, integer) -> integer - 1);
movingPlayers.entrySet().removeIf(entry -> entry.getValue() <= 0);
deg += 0.1;
if (deg > 360) deg = 0;
Bukkit.getOnlinePlayers().forEach(player -> {
if (disabled(player)) return;
if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
ParticleEnum particle = lobbyPlayer.getParticle();
if (particle == null) return;
ParticleData particleData = particle.getParticle();
ParticleElement particleElement = particleData.getParticleElement();
if (particleElement.tickType() == ParticleTickType.ALWAYS) {
particleElement.tick(new ParticleTickData(player.getWorld(), player, deg, movingPlayers.containsKey(player)));
BaseParticle baseParticle = particle.getParticle();
if (baseParticle.needsTick()) {
baseParticle.particle(new ParticleData(player.getWorld(), player, deg));
}
});
}, 0, 1);
@ -71,35 +56,22 @@ public class ParticleListener extends BasicListener {
@EventHandler(priority = EventPriority.NORMAL)
public void handlePlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
if (!PlayerSpawn.PARTICLE.equals(event.getItem())) return;
event.setCancelled(true);
ParticleInventory.openInventory(player, true);
ParticleInventory.openParticleInventory(player);
}
@EventHandler
public void handlePlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (disabled(player)) return;
if (JumpAndRun.isPlayerInJumpAndRun(player)) return;
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
ParticleEnum particle = lobbyPlayer.getParticle();
if (particle == null) return;
ParticleData particleData = particle.getParticle();
ParticleElement particleElement = particleData.getParticleElement();
if (particleElement.tickType() == ParticleTickType.MOVE) {
particleElement.tick(new ParticleTickData(player.getWorld(), player, deg, true));
}
if (event.getFrom().getX() != event.getTo().getX() || event.getFrom().getY() != event.getTo().getY() || event.getFrom().getZ() != event.getTo().getZ()) {
movingPlayers.put(player, 5);
}
}
@EventHandler(ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
movingPlayers.remove(event.getPlayer());
BaseParticle baseParticle = particle.getParticle();
if (baseParticle.needsTick()) return;
baseParticle.particle(new ParticleData(player.getWorld(), player, deg));
}
@EventHandler
@ -108,10 +80,4 @@ public class ParticleListener extends BasicListener {
event.setCancelled(true);
}
}
public static boolean disabled(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if (Bukkit.getOnlinePlayers().size() > SERVER_TEAM_MAX_SIZE) return true;
return Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE && !user.hasPerm(UserPerm.TEAM);
}
}

Datei anzeigen

@ -56,9 +56,6 @@ public class PlayerSeatListener extends BasicListener{
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getPlayer().isGliding())
return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;

Datei anzeigen

@ -19,12 +19,9 @@
package de.steamwar.lobby.listener;
import de.steamwar.comms.packets.ImALobbyPacket;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.boatrace.BoatRace;
import de.steamwar.lobby.special.advent.AdventsCalendar;
import de.steamwar.lobby.util.ItemBuilder;
import de.steamwar.network.NetworkSender;
import de.steamwar.network.packets.client.ImALobbyPacket;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
@ -51,6 +48,7 @@ public class PlayerSpawn extends BasicListener {
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
e.setJoinMessage(null);
player.getInventory().clear();
player.setGameMode(GameMode.ADVENTURE);
player.setWalkSpeed(0.5f);
@ -59,29 +57,19 @@ public class PlayerSpawn extends BasicListener {
player.setFoodLevel(20);
giveItems(player);
LobbySystem.getEntityServer(false).addPlayer(player);
BoatRace.boatNpcServer.addPlayer(player);
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> NetworkSender.send(new ImALobbyPacket(), player), 20);
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> new ImALobbyPacket().send(player), 20);
}
public static void giveItems(Player player) {
private void giveItems(Player player) {
PlayerInventory inventory = player.getInventory();
inventory.clear();
inventory.setItem(EquipmentSlot.CHEST, ELYTRA);
int offset = 0;
if (AdventsCalendar.active()) {
offset = -1;
}
player.getInventory().setItem(FIREWORK_SLOT, FIREWORK);
player.getInventory().setItem(FIREWORK_SLOT + offset, FIREWORK);
player.getInventory().setItem(PARTICLE_SLOT, PARTICLE);
player.getInventory().setItem(PARTICLE_SLOT + offset, PARTICLE);
player.getInventory().setItem(NETHER_STAR_SLOT + offset, NETHER_STAR);
player.getInventory().setItem(NETHER_STAR_SLOT, NETHER_STAR);
}
@EventHandler(priority = EventPriority.HIGH)

Datei anzeigen

@ -32,7 +32,7 @@ public class TeleporterListener extends BasicListener {
private static final World world = Bukkit.getWorlds().get(0);
private static final Location spawn = world.getSpawnLocation().clone().add(0.5, 0, 0.5);
private static final Location team = new Location(world,2719.5, 59, 1311.5);
private static final Location team = new Location(world,1524.5,55,1440.5);
private static final Location map = new Location(world,2336.5,38,1423.5);
private static final Location bau = new Location(world,1951,66.1,1337, -38, -5);
private static final Location arenen = new Location(world,2255.5,21,1450.5);

Datei anzeigen

@ -34,7 +34,6 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.server.MapInitializeEvent;
import org.bukkit.util.Vector;
@ -88,9 +87,6 @@ public class WorldInteraction extends BasicListener {
@EventHandler
public void handleGoldenPressurePlate(PlayerInteractEvent event) {
if(!ModifyCommand.modifying(event.getPlayer()) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK))
event.setCancelled(true);
if(!event.hasBlock() || event.getAction() != Action.PHYSICAL || event.getClickedBlock().getType() != Material.LIGHT_WEIGHTED_PRESSURE_PLATE)
return;
@ -102,11 +98,5 @@ public class WorldInteraction extends BasicListener {
public void onBlockPhysics(BlockPhysicsEvent event) {
event.setCancelled(true);
}
@EventHandler
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
if(!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true);
}
}

Datei anzeigen

@ -1,41 +0,0 @@
package de.steamwar.lobby.map;
import org.bukkit.map.MapPalette;
import java.awt.*;
import java.io.InputStream;
public class ColorInit {
private static final byte[] colors;
public static int getColor(int r, int g, int b) {
return colors[(r << 16) + (g << 8) + b] & 0xFF;
}
public static byte getColorByte(int r, int g, int b) {
return colors[(r << 16) + (g << 8) + b];
}
static {
long time = System.currentTimeMillis();
InputStream inputStream = ColorInit.class.getResourceAsStream("/colors.nearest");
if (inputStream == null) {
colors = new byte[256 * 256 * 256];
for (int i = 0; i < colors.length; i++) {
colors[i] = MapPalette.matchColor(new Color(i));
}
} else {
try {
byte[] bytes = inputStream.readAllBytes();
if (bytes.length != 256*256*256) {
throw new RuntimeException("Invalid colors.nearest file");
}
colors = bytes;
} catch (Exception e) {
throw new RuntimeException("Failed to read colors.nearest file", e);
}
}
System.out.println("[ColorInit] Initialization took " + (System.currentTimeMillis() - time) + "ms");
}
}

Datei anzeigen

@ -1,362 +1,110 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.map;
import de.steamwar.lobby.LobbySystem;
import net.minecraft.server.v1_15_R1.WorldMap;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.ItemFrame;
import org.bukkit.craftbukkit.v1_15_R1.map.CraftMapView;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.MapMeta;
import org.bukkit.map.MapCanvas;
import org.bukkit.map.MapPalette;
import org.bukkit.map.MapRenderer;
import org.bukkit.map.MapView;
import org.bukkit.util.Vector;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.lang.reflect.Field;
public class CustomMap implements Listener {
public class CustomMap {
public static void init() {
}
private static final CustomMap LEFT = new CustomMap(new File(System.getProperty("user.home") + "/lobbyBanner/left.png"),
new Vector(2346, 48, 1297), new Vector(2345, 48, 1297), new Vector(2344, 48, 1297), new Vector(2343, 48, 1297), new Vector(2342, 48, 1297), new Vector(2341, 48, 1297), new Vector(2340, 48, 1297),
new Vector(2346, 47, 1297), new Vector(2345, 47, 1297), new Vector(2344, 47, 1297), new Vector(2343, 47, 1297), new Vector(2342, 47, 1297), new Vector(2341, 47, 1297), new Vector(2340, 47, 1297),
new Vector(2346, 46, 1297), new Vector(2345, 46, 1297), new Vector(2344, 46, 1297), new Vector(2343, 46, 1297), new Vector(2342, 46, 1297), new Vector(2341, 46, 1297), new Vector(2340, 46, 1297),
new Vector(2346, 45, 1297), new Vector(2345, 45, 1297), new Vector(2344, 45, 1297), new Vector(2343, 45, 1297), new Vector(2342, 45, 1297), new Vector(2341, 45, 1297), new Vector(2340, 45, 1297)
);
private static final CustomMap RIGHT = new CustomMap(new File(System.getProperty("user.home") + "/lobbyBanner/right.png"),
new Vector(2330, 48, 1297), new Vector(2329, 48, 1297), new Vector(2328, 48, 1297), new Vector(2327, 48, 1297), new Vector(2326, 48, 1297), new Vector(2325, 48, 1297), new Vector(2324, 48, 1297),
new Vector(2330, 47, 1297), new Vector(2329, 47, 1297), new Vector(2328, 47, 1297), new Vector(2327, 47, 1297), new Vector(2326, 47, 1297), new Vector(2325, 47, 1297), new Vector(2324, 47, 1297),
new Vector(2330, 46, 1297), new Vector(2329, 46, 1297), new Vector(2328, 46, 1297), new Vector(2327, 46, 1297), new Vector(2326, 46, 1297), new Vector(2325, 46, 1297), new Vector(2324, 46, 1297),
new Vector(2330, 45, 1297), new Vector(2329, 45, 1297), new Vector(2328, 45, 1297), new Vector(2327, 45, 1297), new Vector(2326, 45, 1297), new Vector(2325, 45, 1297), new Vector(2324, 45, 1297)
);
private File mapFile;
private Map<Vector, Integer> itemFrameIndex = new HashMap<>();
private ItemFrame[] itemFrames;
private long lastModified = Long.MAX_VALUE;
public CustomMap(File mapFile, Vector... itemFrames) {
this.mapFile = mapFile;
this.itemFrames = new ItemFrame[itemFrames.length];
for (int i = 0; i < itemFrames.length; i++) {
itemFrameIndex.put(itemFrames[i], i);
public CustomMap(Player player, BufferedImage image) {
if (image.getWidth() % 128 != 0) {
throw new IllegalArgumentException("Image width must be a multiple of 128");
}
if (image.getHeight() % 128 != 0) {
throw new IllegalArgumentException("Image height must be a multiple of 128");
}
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
long modified = mapFile.lastModified();
if (modified > lastModified) {
lastModified = modified;
System.out.println("Updating Banner: " + mapFile.getName());
Bukkit.getScheduler().runTaskAsynchronously(LobbySystem.getPlugin(), () -> {
try {
run();
} catch (IOException e) {
// Ignore
BufferedImage bufferedImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB);
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
Color oldPixel = new Color(image.getRGB(x, y));
Color newPixel = getNearest(oldPixel);
bufferedImage.setRGB(x, y, newPixel.getRGB());
int quantErrorRed = oldPixel.getRed() - newPixel.getRed();
int quantErrorGreen = oldPixel.getGreen() - newPixel.getGreen();
int quantErrorBlue = oldPixel.getBlue() - newPixel.getBlue();
if (x < image.getWidth() - 1) {
image.setRGB(x + 1, y, updateViaQuantError(new Color(image.getRGB(x + 1, y)), quantErrorRed, quantErrorGreen, quantErrorBlue, 7 / 16.0).getRGB());
}
if (x > 0) {
image.setRGB(x - 1, y, updateViaQuantError(new Color(image.getRGB(x - 1, y)), quantErrorRed, quantErrorGreen, quantErrorBlue, 3 / 16.0).getRGB());
}
if (y < image.getHeight() - 1) {
image.setRGB(x, y + 1, updateViaQuantError(new Color(image.getRGB(x, y + 1)), quantErrorRed, quantErrorGreen, quantErrorBlue, 5 / 16.0).getRGB());
if (x < image.getWidth() - 1) {
image.setRGB(x + 1, y + 1, updateViaQuantError(new Color(image.getRGB(x + 1, y + 1)), quantErrorRed, quantErrorGreen, quantErrorBlue, 1 / 16.0).getRGB());
}
});
}
}
}, 200L, 200L);
Bukkit.getPluginManager().registerEvents(this, LobbySystem.getPlugin());
}
}
@EventHandler
public void onChunkLoad(ChunkLoadEvent event) {
for (Entity entity : event.getChunk().getEntities()) {
if (!(entity instanceof ItemFrame)) continue;
ItemFrame itemFrame = (ItemFrame) entity;
ItemStack itemStack = itemFrame.getItem();
if (itemStack.getType() != Material.FILLED_MAP) continue;
Vector vector = itemFrame.getLocation().getBlock().getLocation().toVector();
if (itemFrameIndex.containsKey(vector)) {
if (itemFrames[itemFrameIndex.get(vector)] != null) continue;
itemFrames[itemFrameIndex.get(vector)] = itemFrame;
lastModified = 0;
MapView mapView = ((MapMeta) itemFrame.getItem().getItemMeta()).getMapView();
new ArrayList<>(mapView.getRenderers()).forEach(mapView::removeRenderer);
mapView.addRenderer(new MapRenderer() {
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
for (int x = 0; x < 128; x++) {
for (int y = 0; y < 128; y++) {
canvas.setPixel(x, y, (byte) 32);
}
for (int x = 0; x < bufferedImage.getWidth(); x += 128) {
for (int y = 0; y < bufferedImage.getHeight(); y += 128) {
BufferedImage subImage = bufferedImage.getSubimage(x, y, 128, 128);
CraftMapView craftMapView = (CraftMapView) Bukkit.createMap(player.getWorld());
try {
Field field = CraftMapView.class.getDeclaredField("worldMap");
field.setAccessible(true);
WorldMap worldMap = (WorldMap) field.get(craftMapView);
for (int sx = 0; sx < 128; sx++) {
for (int sy = 0; sy < 128; sy++) {
byte color = MapPalette.matchColor(new Color(subImage.getRGB(sx, sy)));
worldMap.colors[sx + sy * 128] = color;
}
}
});
craftMapView.setLocked(true);
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new SecurityException(e.getMessage(), e);
}
ItemStack itemStack = new ItemStack(Material.FILLED_MAP, 1);
MapMeta mapMeta = (MapMeta) itemStack.getItemMeta();
mapMeta.setMapView(craftMapView);
itemStack.setItemMeta(mapMeta);
player.getInventory().addItem(itemStack);
}
}
}
private void run() throws IOException {
BufferedImage bufferedImage = ImageIO.read(mapFile);
Set<Integer>[] patches = new Set[256];
for (int patch = 0; patch < patches.length; patch++) {
patches[patch] = new HashSet<>();
}
for (int y = 0; y < bufferedImage.getHeight(); y++) {
for (int x = 0; x < bufferedImage.getWidth(); x++) {
Color color = new Color(bufferedImage.getRGB(x, y));
double red = color.getRed() / 255.0;
double green = color.getGreen() / 255.0;
double blue = color.getBlue() / 255.0;
double luminance = Math.sqrt(0.299 * red * red + 0.587 * green * green + 0.114 * blue * blue);
luminance *= 255;
patches[(int) luminance].add(x << 16 | y);
}
}
for (int patch = 0; patch < patches.length; patch++) {
Set<Integer> points = patches[patch];
if (points.isEmpty()) continue;
BufferedImage patchImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
points.forEach(point -> {
int x = point >>> 16;
int y = point & 0xFFFF;
patchImage.setRGB(x, y, bufferedImage.getRGB(x, y));
});
floodFill(patchImage);
dither(patchImage);
points.forEach(point -> {
int x = point >>> 16;
int y = point & 0xFFFF;
bufferedImage.setRGB(x, y, patchImage.getRGB(x, y));
});
}
for (int y = 0; y < bufferedImage.getHeight(); y += 128) {
for (int x = 0; x < bufferedImage.getWidth(); x += 128) {
ItemFrame itemFrame = itemFrames[y / 128 * 7 + x / 128];
if (itemFrame == null) continue;
int finalX = x;
int finalY = y;
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> {
ItemStack itemStack = itemFrame.getItem();
MapMeta mapMeta = (MapMeta) itemStack.getItemMeta();
MapView mapView = mapMeta.getMapView();
new ArrayList<>(mapView.getRenderers()).forEach(mapView::removeRenderer);
mapView.addRenderer(new MapRenderer() {
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
for (int dy = 0; dy < 128; dy++) {
for (int dx = 0; dx < 128; dx++) {
int ax = dx + finalX;
int ay = dy + finalY;
Color color = new Color(bufferedImage.getRGB(ax, ay));
canvas.setPixel(dx, dy, ColorInit.getColorByte(color.getRed(), color.getGreen(), color.getBlue()));
}
}
}
});
mapMeta.setMapView(mapView);
itemStack.setItemMeta(mapMeta);
itemFrame.setItem(itemStack);
}, 1);
}
}
private Color updateViaQuantError(Color color, int quantErrorRed, int quantErrorGreen, int quantErrorBlue, double multiplier) {
int newRed = (int) (color.getRed() + quantErrorRed * multiplier);
int newGreen = (int) (color.getGreen() + quantErrorGreen * multiplier);
int newBlue = (int) (color.getBlue() + quantErrorBlue * multiplier);
return new Color(clamp(newRed), clamp(newGreen), clamp(newBlue));
}
private static void floodFill(BufferedImage bufferedImage) {
WritableRaster alpha = bufferedImage.getAlphaRaster();
int[] data = alpha.getPixels(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(), new int[bufferedImage.getWidth() * bufferedImage.getHeight()]);
for (int i = 0; i < 5; i++) {
Set<Integer> changes = new HashSet<>();
for (int y = 0; y < bufferedImage.getHeight(); y++) {
for (int x = 0; x < bufferedImage.getWidth(); x++) {
if (data[y * bufferedImage.getWidth() + x] == 0) continue;
int color = bufferedImage.getRGB(x, y);
if (x > 0 && data[y * bufferedImage.getWidth() + x - 1] == 0) {
bufferedImage.setRGB(x - 1, y, color);
changes.add((x - 1) << 16 | y);
}
if (x < bufferedImage.getWidth() - 1 && data[y * bufferedImage.getWidth() + x + 1] == 0) {
bufferedImage.setRGB(x + 1, y, color);
changes.add((x + 1) << 16 | y);
}
if (y > 0 && data[(y - 1) * bufferedImage.getWidth() + x] == 0) {
bufferedImage.setRGB(x, y - 1, color);
changes.add(x << 16 | (y - 1));
}
if (y < bufferedImage.getHeight() - 1 && data[(y + 1) * bufferedImage.getWidth() + x] == 0) {
bufferedImage.setRGB(x, y + 1, color);
changes.add(x << 16 | (y + 1));
}
}
}
if (changes.isEmpty()) return;
changes.forEach(point -> {
int x = point >>> 16;
int y = point & 0xFFFF;
data[y * bufferedImage.getWidth() + x] = 255;
});
}
private int clamp(int value) {
return Math.max(0, Math.min(255, value));
}
private static BufferedImage dither(BufferedImage image) {
final double multiplier1 = 7 / 48.0;
final double multiplier2 = 3 / 48.0;
final double multiplier3 = 5 / 48.0;
final double multiplier4 = 1 / 48.0;
WritableRaster alphaRaster = image.getAlphaRaster();
WritableRaster raster = image.getRaster();
int numBands = raster.getNumBands();
int[] pixels = raster.getPixels(0, 0, image.getWidth(), image.getHeight(), new int[image.getWidth() * image.getHeight() * numBands]);
int width = image.getWidth();
int height = image.getHeight();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if (alphaRaster.getPixel(x, y, new int[1])[0] == 0) continue;
int red = pixels[(y * width + x) * numBands];
int i2 = (y * width + x) * numBands + 1;
int green = pixels[i2];
int i3 = (y * width + x) * numBands + 2;
int blue = pixels[i3];
Color nearest = MapPalette.getColor(ColorInit.getColorByte(red, green, blue));
pixels[(y * width + x) * numBands] = nearest.getRed();
pixels[i2] = nearest.getGreen();
pixels[i3] = nearest.getBlue();
int quantErrorRed = red - nearest.getRed();
int quantErrorGreen = green - nearest.getGreen();
int quantErrorBlue = blue - nearest.getBlue();
int mr1 = (int) (quantErrorRed * multiplier1);
int mg1 = (int) (quantErrorGreen * multiplier1);
int mb1 = (int) (quantErrorBlue * multiplier1);
int mr2 = (int) (quantErrorRed * multiplier2);
int mg2 = (int) (quantErrorGreen * multiplier2);
int mb2 = (int) (quantErrorBlue * multiplier2);
int mr3 = (int) (quantErrorRed * multiplier3);
int mg3 = (int) (quantErrorGreen * multiplier3);
int mb3 = (int) (quantErrorBlue * multiplier3);
int mr4 = (int) (quantErrorRed * multiplier4);
int mg4 = (int) (quantErrorGreen * multiplier4);
int mb4 = (int) (quantErrorBlue * multiplier4);
if (x < width - 1) {
int i = (y * width + x + 1) * numBands;
pixels[i] = clamp(pixels[i] + mr1);
pixels[i + 1] = clamp(pixels[i + 1] + mg1);
pixels[i + 2] = clamp(pixels[i + 2] + mb1);
}
if (x < width - 2) {
int i = (y * width + x + 2) * numBands;
pixels[i] = clamp(pixels[i] + mr3);
pixels[i + 1] = clamp(pixels[i + 1] + mg3);
pixels[i + 2] = clamp(pixels[i + 2] + mb3);
}
if (y < height - 1) {
if (x > 1) {
int i = ((y + 1) * width + x - 2) * numBands;
pixels[i] = clamp(pixels[i] + mr2);
pixels[i + 1] = clamp(pixels[i + 1] + mg2);
pixels[i + 2] = clamp(pixels[i + 2] + mb2);
}
if (x > 0) {
int i = ((y + 1) * width + x - 1) * numBands;
pixels[i] = clamp(pixels[i] + mr3);
pixels[i + 1] = clamp(pixels[i + 1] + mg3);
pixels[i + 2] = clamp(pixels[i + 2] + mb3);
}
if (x < width - 1) {
int i = ((y + 1) * width + x + 1) * numBands;
pixels[i] = clamp(pixels[i] + mr3);
pixels[i + 1] = clamp(pixels[i + 1] + mg3);
pixels[i + 2] = clamp(pixels[i + 2] + mb3);
}
if (x < width - 2) {
int i = ((y + 1) * width + x + 2) * numBands;
pixels[i] = clamp(pixels[i] + mr2);
pixels[i + 1] = clamp(pixels[i + 1] + mg2);
pixels[i + 2] = clamp(pixels[i + 2] + mb2);
}
int i = (y * width + x) * numBands;
pixels[i] = clamp(pixels[i] + mr1);
pixels[i + 1] = clamp(pixels[i + 1] + mg1);
pixels[i + 2] = clamp(pixels[i + 2] + mb1);
}
if (y < height - 2) {
if (x > 1) {
int i = ((y + 2) * width + x - 2) * numBands;
pixels[i] = clamp(pixels[i] + mr4);
pixels[i + 1] = clamp(pixels[i + 1] + mg4);
pixels[i + 2] = clamp(pixels[i + 2] + mb4);
}
if (x > 0) {
int i = ((y + 2) * width + x - 1) * numBands;
pixels[i] = clamp(pixels[i] + mr2);
pixels[i + 1] = clamp(pixels[i + 1] + mg2);
pixels[i + 2] = clamp(pixels[i + 2] + mb2);
}
if (x < width - 1) {
int i = ((y + 2) * width + x + 1) * numBands;
pixels[i] = clamp(pixels[i] + mr2);
pixels[i + 1] = clamp(pixels[i + 1] + mg2);
pixels[i + 2] = clamp(pixels[i + 2] + mb2);
}
if (x < width - 2) {
int i = ((y + 2) * width + x + 2) * numBands;
pixels[i] = clamp(pixels[i] + mr4);
pixels[i + 1] = clamp(pixels[i + 1] + mg4);
pixels[i + 2] = clamp(pixels[i + 2] + mb4);
}
int i = (y * width + x) * numBands;
pixels[i] = clamp(pixels[i] + mr3);
pixels[i + 1] = clamp(pixels[i + 1] + mg3);
pixels[i + 2] = clamp(pixels[i + 2] + mb3);
}
}
}
raster.setPixels(0, 0, width, height, pixels);
return image;
}
private static int clamp(int value) {
return Math.max(0, Math.min(value, 255));
private static Color getNearest(Color color) {
return MapPalette.getColor(MapPalette.matchColor(color));
}
}

Datei anzeigen

@ -0,0 +1,80 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.map;
import de.steamwar.command.GuardChecker;
import de.steamwar.command.GuardResult;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import lombok.SneakyThrows;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import javax.imageio.ImageIO;
import java.io.File;
import java.util.List;
public class CustomMapCommand extends SWCommand {
public CustomMapCommand() {
super("map");
}
@Register
@SneakyThrows
public void render(@Guard Player p, File file) {
if (SteamwarUser.get(p).getUserGroup() != UserGroup.Developer) {
return;
}
if (!file.exists()) {
p.sendMessage("§cDiese Datei existiert nicht!");
return;
}
new CustomMap(p, ImageIO.read(file));
}
@ClassGuard(value = Player.class, local = true)
public GuardChecker getGuardChecker() {
return (commandSender, guardCheckType, strings, s) -> {
Player player = (Player) commandSender;
if (SteamwarUser.get(player).getUserGroup() == UserGroup.Developer) {
return GuardResult.ALLOWED;
}
return GuardResult.DENIED;
};
}
@ClassMapper(value = File.class, local = true)
public TypeMapper<File> getTypeMapper() {
return new TypeMapper<File>() {
@Override
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
return null;
}
@Override
public File map(CommandSender commandSender, String[] previousArguments, String s) {
return new File(s);
}
};
}
}

Datei anzeigen

@ -0,0 +1,63 @@
package de.steamwar.lobby.map;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Optional;
public class YouTubeLatest {
private static final String YOUTUBE_LATEST_URL = "https://tools.tastethecode.com/youtube-latest/r/steamwar";
private static final URI YOUTUBE_LATEST_URI = URI.create(YOUTUBE_LATEST_URL);
public static BufferedImage getLatestImage() {
HttpClient client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER).build();
HttpRequest request = HttpRequest.newBuilder().uri(YOUTUBE_LATEST_URI).GET().build();
try {
HttpResponse res = client.send(request, HttpResponse.BodyHandlers.discarding());
Optional<String> ou = res.headers().firstValue("Location");
if(ou.isPresent()) {
String url = ou.get();
String videoId = getVideoId(url);
if(videoId != null) {
String thumbnailUrl = getThumbnailUrl(videoId);
return getImage(thumbnailUrl);
} else {
throw new SecurityException("Could not get latest image from YouTube");
}
} else {
throw new IOException("No redirect header found");
}
} catch (Exception e) {
throw new SecurityException("Could not get latest image from YouTube", e);
}
}
private static String getVideoId(String url) {
if(url.startsWith("https://www.youtube.com/watch?v=")) {
return url.substring("https://www.youtube.com/watch?v=".length());
}
return null;
}
private static String getThumbnailUrl(String videoId) {
return "https://img.youtube.com/vi/" + videoId + "/maxresdefault.jpg";
}
private static BufferedImage getImage(String url) {
HttpClient client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER).build();
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(url)).GET().build();
try {
HttpResponse<InputStream> res = client.send(request, HttpResponse.BodyHandlers.ofInputStream());
return ImageIO.read(res.body());
} catch (Exception e) {
throw new SecurityException("Could not get latest image from YouTube", e);
}
}
}

Datei anzeigen

@ -0,0 +1,49 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Color;
import org.bukkit.Particle;
import java.util.Random;
public interface BaseParticle {
Random RANDOM = new Random();
default Color randomColor() {
return Color.fromRGB(RANDOM.nextInt(256), RANDOM.nextInt(256), RANDOM.nextInt(256));
}
default float randomSize() {
return RANDOM.nextFloat() / 2 + 1;
}
default Particle.DustOptions getParticleDust() {
return new Particle.DustOptions(randomColor(), randomSize());
}
ParticleItem getItem();
default boolean needsTick() {
return false;
}
void particle(ParticleData particleData);
}

Datei anzeigen

@ -0,0 +1,60 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
public class DustSimpleParticle implements BaseParticle {
private final ParticleItem particleItem;
private final Particle particle;
private float vx;
private float vy;
private float vz;
private double time = 1;
private int count = 5;
public DustSimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time) {
this.particleItem = particleItem;
this.particle = particle;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
}
@Override
public ParticleItem getItem() {
return particleItem;
}
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation().add(0.0, 0.2, 0.0);
Bukkit.getOnlinePlayers().forEach(player -> {
int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
player.spawnParticle(particle, location, count, vx, vy, vz, time, getParticleDust());
}
});
}
}

Datei anzeigen

@ -0,0 +1,74 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.sql.Event;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class EventParticleItem extends ParticleItem {
public static EventParticleItem participation(Material material, String name, int eventId) {
return new EventParticleItem(material, name, "PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION", eventId);
}
public static EventParticleItem placement(Material material, String name, int eventId) {
return new EventParticleItem(material, name, "PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT", eventId);
}
private final String eventName;
public EventParticleItem(Material material, String name, int eventId) {
this(material, name, null, eventId);
}
public EventParticleItem(Material material, String name, String unlockedBy, int eventId) {
super(material, name, unlockedBy);
eventName = Event.get(eventId).getEventName();
}
public EventParticleItem addAttribute(String attribute) {
super.addAttribute(attribute);
return this;
}
public SWItem toSWItem(Player player) {
String translatedName = LobbySystem.getMessage().parse(name, player);
List<String> lore = new ArrayList<>();
lore.add("");
if (!attributes.isEmpty()) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_ATTRIBUTE", player));
attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player)));
lore.add("");
}
if (unlockedBy != null) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player));
lore.add(LobbySystem.getMessage().parse(unlockedBy, player, eventName));
lore.add("");
}
lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player));
return new SWItem(material, translatedName, lore, false, clickType -> {});
}
}

Datei anzeigen

@ -1,76 +1,54 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.sql.SteamwarUser;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import lombok.RequiredArgsConstructor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@RequiredArgsConstructor
@AllArgsConstructor
@Getter
public class ParticleData {
private final World world;
private final Player player;
private Location location;
private final double deg;
private final Material material;
private final String name;
private final List<String> attributes = new ArrayList<>();
@Getter
private final ParticleRequirement requirement;
@Getter
private final ParticleElement particleElement;
public ParticleData(Material material, String name, ParticleElement particleElement) {
this.material = material;
this.name = name;
this.requirement = ParticleRequirement.NO_REQUIRMENT;
this.particleElement = particleElement;
particleElement.aggregateAttributes(this);
public ParticleData withLocation(Location location) {
ParticleData particleData = copy();
particleData.location = location;
return particleData;
}
public ParticleData(Material material, String name, ParticleRequirement requirement, ParticleElement particleElement) {
this.material = material;
this.name = name;
this.requirement = requirement;
this.particleElement = particleElement;
particleElement.aggregateAttributes(this);
public Location getLocation() {
if (location == null) {
return player.getLocation();
}
return location;
}
public ParticleData add(String attribute) {
attributes.add(attribute);
return this;
}
public SWItem toSWItem(Player player, SteamwarUser user, Set<Integer> eventTeilnahme, String eggHuntConfig) {
String translatedName;
try {
translatedName = LobbySystem.getMessage().parse(name, player);
} catch (Exception e) {
translatedName = name;
}
List<String> lore = new ArrayList<>();
lore.add("");
if (!attributes.isEmpty()) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_ATTRIBUTE", player));
attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player)));
lore.add("");
}
String unlockedBy = requirement.getRequirementName(player);
if (unlockedBy != null) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player));
lore.add(unlockedBy);
lore.add("");
}
if (requirement.test(user, eventTeilnahme, eggHuntConfig)) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player));
} else {
lore.add(LobbySystem.getMessage().parse("PARTICLE_LOCKED", player));
}
return new SWItem(material, translatedName, lore, false, clickType -> {});
public ParticleData copy() {
return new ParticleData(world, player, location, deg);
}
}

Datei anzeigen

@ -1,51 +0,0 @@
package de.steamwar.lobby.particle;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import java.util.Random;
import java.util.function.Consumer;
public interface ParticleElement {
Random RANDOM = new Random();
default Color randomColor() {
return Color.fromRGB(RANDOM.nextInt(255), RANDOM.nextInt(255), RANDOM.nextInt(255));
}
default float randomSize() {
return RANDOM.nextFloat() / 2 + 1;
}
default Particle.DustOptions randomParticleDust() {
return new Particle.DustOptions(randomColor(), randomSize());
}
default void display(Location location, Player root, boolean onlySelf, boolean onlyOther, Consumer<Player> consumer) {
if (onlySelf) {
consumer.accept(root);
return;
}
Bukkit.getOnlinePlayers().forEach(player -> {
if (onlyOther && player == root) {
return;
}
int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
consumer.accept(player);
}
});
}
default void aggregateAttributes(ParticleData particleData) {
}
default ParticleTickType tickType() {
return ParticleTickType.MOVE;
}
void tick(ParticleTickData particleTickData);
}

Datei anzeigen

@ -1,5 +0,0 @@
package de.steamwar.lobby.particle;
public interface ParticleEnum {
ParticleData getParticle();
}

Datei anzeigen

@ -1,16 +1,34 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.particle.particles.*;
import de.steamwar.lobby.particle.particles.custom.CustomEasterParticle;
import de.steamwar.lobby.particle.particles.custom.CustomPlayerParticle;
import de.steamwar.lobby.particle.particles.custom.CustomTeamParticle;
import de.steamwar.lobby.special.easter.EggHunt;
import de.steamwar.lobby.util.LobbyPlayer;
import de.steamwar.sql.*;
import lombok.experimental.UtilityClass;
import de.steamwar.sql.Event;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.TeamTeilnahme;
import de.steamwar.sql.UserGroup;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -18,106 +36,79 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@UtilityClass
public class ParticleInventory {
private final Class<?>[] PARTICLES = {
PlayerParticle.class,
CustomPlayerParticle.class,
TeamParticle.class,
CustomTeamParticle.class,
RainCloudParticle.class,
ServerTeamParticle.class,
EventParticle.class,
EventParticlePlacement.class,
EventParticleParticipation.class,
EasterParticle.class,
CustomEasterParticle.class,
};
public String convertToString(ParticleEnum particleEnum) {
return particleEnum.getClass().getSimpleName() + "@" + ((Enum<?>)particleEnum).name();
private ParticleInventory() {
}
public ParticleEnum convertFromString(String string) {
String[] split = string.split("@");
Class<?> clazz = null;
for (Class<?> aClass : PARTICLES) {
if (aClass.getSimpleName().equals(split[0])) {
clazz = aClass;
break;
}
private static void calculateParticles(ParticleEnum[] particles, Player player, List<SWListInv.SWListEntry<ParticleEnum>> particleList) {
for (ParticleEnum particle : particles) {
particleList.add(new SWListInv.SWListEntry<>(particle.getParticle().getItem().toSWItem(player), particle));
}
if (clazz != null) {
try {
return (ParticleEnum) Enum.valueOf((Class<? extends Enum>) clazz, split[1]);
} catch (Exception e) {
return null;
}
}
return null;
}
public void openInventory(Player player, boolean onlyUnlocked) {
private static SWInventory createInventory(Player player) {
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
Set<Integer> events = user.getTeam() == 0 ? new HashSet<>() : TeamTeilnahme.getEvents(user.getTeam()).stream().map(Event::getEventID).collect(Collectors.toSet());
String eggHuntConfig = UserConfig.getConfig(user.getId(), EggHunt.EGG_HUNT_CONFIG_KEY);
AtomicBoolean hasOneLocked = new AtomicBoolean(false);
List<SWListInv.SWListEntry<ParticleEnum>> particleList = new ArrayList<>();
for (Class<?> clazz : PARTICLES) {
addParticles(particleList, (ParticleEnum[]) clazz.getEnumConstants(), player, onlyUnlocked, hasOneLocked, user, events, eggHuntConfig);
calculateParticles(PlayerParticle.particles, player, particleList);
if (steamwarUser.getTeam() != 0 || userGroup != UserGroup.Member) {
calculateParticles(TeamParticle.particles, player, particleList);
}
for (int i = 0; i < particleList.size() % 45; i++) {
particleList.add(new SWListInv.SWListEntry<>(new SWItem(Material.BLACK_STAINED_GLASS_PANE, " "), null));
if (userGroup != UserGroup.Member) {
calculateParticles(ServerTeamParticle.particles, player, particleList);
}
Set<Integer> events = steamwarUser.getTeam() == 0 ? new HashSet<>() : TeamTeilnahme.getEvents(steamwarUser.getTeam()).stream().map(Event::getEventID).collect(Collectors.toSet());
if (!events.isEmpty()) {
calculateParticles(EventParticle.particles, player, particleList);
}
for (EventParticlePlacement particle : EventParticlePlacement.particles) {
boolean clickable = userGroup.isTeamGroup();
clickable |= (steamwarUser.getTeam() != 0 && contains(particle.getPlacementTeams(), steamwarUser.getTeam()));
addParticle(particleList, particle, clickable, player);
}
for (EventParticleParticipation particle : EventParticleParticipation.particles) {
boolean clickable = userGroup.isTeamGroup();
clickable |= events.contains(particle.getEvent());
addParticle(particleList, particle, clickable, player);
}
SWListInv<ParticleEnum> particleSWListInv = new SWListInv<>(player, LobbySystem.getMessage().parse("PARTICLE_INVENTORY", player), false, particleList, (clickType, particle) -> {
if (particle == null) return;
lobbyPlayer.setParticle(particle);
player.closeInventory();
if (ParticleListener.disabled(player)) {
LobbySystem.getMessage().send("PARTICLE_DEACTIVATED", player);
}
});
particleSWListInv.setItem(48, Material.BARRIER, LobbySystem.getMessage().parse("PARTICLE_DESELECT", player), new ArrayList<>(), false, clickType -> {
particleSWListInv.setItem(49, Material.BARRIER, LobbySystem.getMessage().parse("PARTICLE_DESELECT", player), new ArrayList<>(), false, clickType -> {
lobbyPlayer.setParticle(null);
});
if (!hasOneLocked.get()) {
particleSWListInv.setItem(50, Material.GRAY_BANNER, LobbySystem.getMessage().parse("PARTICLE_SHOW_HAS_ALL", player), new ArrayList<>(), false, clickType -> {
});
} else if (onlyUnlocked) {
particleSWListInv.setItem(50, Material.LIME_BANNER, LobbySystem.getMessage().parse("PARTICLE_SHOW_ALL", player), new ArrayList<>(), false, clickType -> {
openInventory(player, false);
});
} else {
particleSWListInv.setItem(50, Material.RED_BANNER, LobbySystem.getMessage().parse("PARTICLE_SHOW_UNLOCKED", player), new ArrayList<>(), false, clickType -> {
openInventory(player, true);
});
}
particleSWListInv.open();
return particleSWListInv;
}
private void addParticles(List<SWListInv.SWListEntry<ParticleEnum>> particleList, ParticleEnum[] particleEnums, Player player, boolean onlyUnlocked, AtomicBoolean hasOneLocked, SteamwarUser user, Set<Integer> events, String eggHuntConfig) {
for (ParticleEnum particle : particleEnums) {
ParticleData particleData = particle.getParticle();
SWItem swItem = particleData.toSWItem(player, user, events, eggHuntConfig);
if (particleData.getRequirement().test(user, events, eggHuntConfig)) {
particleList.add(new SWListInv.SWListEntry<>(swItem, particle));
} else {
hasOneLocked.set(true);
if (!onlyUnlocked) {
particleList.add(new SWListInv.SWListEntry<>(swItem, null));
}
}
}
for (int i = 0; i < particleList.size() % 9; i++) {
particleList.add(new SWListInv.SWListEntry<>(new SWItem(Material.BLACK_STAINED_GLASS_PANE, " "), null));
private static void addParticle(List<SWListInv.SWListEntry<ParticleEnum>> particleList, ParticleEnum particle, boolean clickable, Player player) {
if (clickable) {
particleList.add(new SWListInv.SWListEntry<>(particle.getParticle().getItem().toSWItem(player), particle));
} else {
SWItem swItem = particle.getParticle().getItem().toSWItem(player);
swItem.setName(LobbySystem.getMessage().parse("PARTICLE_LOCKED", player, swItem.getItemMeta().getDisplayName()));
particleList.add(new SWListInv.SWListEntry<>(swItem, null));
}
}
private static boolean contains(int[] ints, int element) {
for (int i : ints) {
if (i == element) return true;
}
return false;
}
public static void openParticleInventory(Player player) {
createInventory(player).open();
}
}

Datei anzeigen

@ -0,0 +1,69 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import de.steamwar.lobby.LobbySystem;
import lombok.RequiredArgsConstructor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@RequiredArgsConstructor
public class ParticleItem {
protected final Material material;
protected final String name;
protected final Set<String> attributes = new LinkedHashSet<>();
protected String unlockedBy;
public ParticleItem(Material material, String name, String unlockedBy) {
this.material = material;
this.name = name;
this.unlockedBy = unlockedBy;
}
public ParticleItem addAttribute(String attribute) {
this.attributes.add(attribute);
return this;
}
public SWItem toSWItem(Player player) {
String translatedName = LobbySystem.getMessage().parse(name, player);
List<String> lore = new ArrayList<>();
lore.add("");
if (!attributes.isEmpty()) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_ATTRIBUTE", player));
attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player)));
lore.add("");
}
if (unlockedBy != null) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player));
lore.add(LobbySystem.getMessage().parse(unlockedBy, player));
lore.add("");
}
lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player));
return new SWItem(material, translatedName, lore, false, clickType -> {});
}
}

Datei anzeigen

@ -1,227 +0,0 @@
package de.steamwar.lobby.particle;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.special.easter.EggDifficulty;
import de.steamwar.lobby.special.easter.EggHunt;
import de.steamwar.sql.*;
import org.bukkit.entity.Player;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
public interface ParticleRequirement {
String getRequirementName(Player player);
boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig);
ParticleRequirement SERVER_TEAM = new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_SERVER_TEAM", player);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return user.hasPerm(UserPerm.TEAM);
}
};
ParticleRequirement NO_REQUIRMENT = new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return null;
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return true;
}
};
ParticleRequirement HAS_TEAM = new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_TEAM", player);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return user.getTeam() != 0;
}
}.or(SERVER_TEAM);
ParticleRequirement EVENT_PARTICIPATION = new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_EVENT", player);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return !eventTeilname.isEmpty();
}
}.or(SERVER_TEAM);
ParticleRequirement EGG_HUNT_EASY = _easterEggHuntDifficulty(EggDifficulty.EASY);
ParticleRequirement EGG_HUNT_MEDIUM = _easterEggHuntDifficulty(EggDifficulty.MEDIUM);
ParticleRequirement EGG_HUNT_HARD = _easterEggHuntDifficulty(EggDifficulty.HARD);
ParticleRequirement EGG_HUNT_EXTREME = _easterEggHuntDifficulty(EggDifficulty.EXTREME);
ParticleRequirement EGG_HUNT_ADVANCED = _easterEggHuntDifficulty(EggDifficulty.ADVANCED);
ParticleRequirement EGG_HUNT_FOUND_HALF = new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_EASTER_EGG_HUNT_HALF", player);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
if (eggHuntConfig == null) return false;
int count = 0;
for (int i = 0; i < eggHuntConfig.length(); i++) {
if (eggHuntConfig.charAt(i) == '1') {
count++;
}
}
return count >= EggHunt.getEggList().size() / 2;
}
};
static ParticleRequirement specificTeam(int teamId) {
if (teamId == 0) return NO_REQUIRMENT;
String teamKuerzel = Team.get(teamId).getTeamKuerzel();
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM", player, teamKuerzel);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return user.getTeam() == teamId;
}
}.or(SERVER_TEAM);
}
static ParticleRequirement eventParticipation(int eventId) {
String eventName = Event.get(eventId).getEventName();
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION", player, eventName);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return eventTeilname.contains(eventId);
}
}.or(SERVER_TEAM);
}
static ParticleRequirement eventPlacement(int eventId, int... placementTeams) {
String eventName = Event.get(eventId).getEventName();
Set<Integer> teams = new HashSet<>();
for (int i : placementTeams) teams.add(i);
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT", player, eventName);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
if (!eventTeilname.contains(eventId)) return false;
return teams.contains(user.getTeam());
}
}.or(SERVER_TEAM);
}
static ParticleRequirement _easterEggHuntDifficulty(EggDifficulty difficulty) {
AtomicInteger count = new AtomicInteger();
List<Integer> eggs = EggHunt.getEggList()
.stream()
.map(egg -> {
int id = count.getAndIncrement();
if (egg.getDifficulty() == difficulty) {
return id;
} else {
return null;
}
})
.filter(Objects::nonNull)
.collect(Collectors.toList());
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_EASTER_EGG_HUNT_DIFFICULTY", player, LobbySystem.getMessage().parse(difficulty.getMessage(), player));
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
if (eggHuntConfig == null) return false;
return eggs.stream().allMatch(id -> eggHuntConfig.length() > id && eggHuntConfig.charAt(id) == '1');
}
};
}
static ParticleRequirement specificPlayer(int userId) {
String userName = SteamwarUser.get(userId).getUserName();
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_SPECIFIC_USER", player, userName);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return user.getId() == userId;
}
}.or(SERVER_TEAM);
}
static ParticleRequirement easterEventSpecificPlayer(int userId) {
String userName = SteamwarUser.get(userId).getUserName();
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_SPECIFIC_USER_EASTER", player, userName);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return user.getId() == userId;
}
}.or(SERVER_TEAM);
}
static ParticleRequirement easterEventSpecificTeam(int teamId) {
if (teamId == 0) return NO_REQUIRMENT;
String teamKuerzel = Team.get(teamId).getTeamKuerzel();
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM_EASTER", player, teamKuerzel);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return user.getTeam() == teamId;
}
}.or(SERVER_TEAM);
}
default ParticleRequirement or(ParticleRequirement particleRequirement) {
return new ParticleRequirement() {
@Override
public String getRequirementName(Player player) {
return ParticleRequirement.this.getRequirementName(player);
}
@Override
public boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig) {
return ParticleRequirement.this.test(user, eventTeilname, eggHuntConfig) || particleRequirement.test(user, eventTeilname, eggHuntConfig);
}
};
}
}

Datei anzeigen

@ -1,51 +0,0 @@
package de.steamwar.lobby.particle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@RequiredArgsConstructor
@AllArgsConstructor
@Getter
public class ParticleTickData {
private final World world;
private final Player player;
private Location location;
private final double deg;
private final boolean isMoving;
private boolean onlySelf = false;
private boolean onlyOthers = false;
public ParticleTickData withLocation(Location location) {
ParticleTickData particleTickData = copy();
particleTickData.location = location;
return particleTickData;
}
public ParticleTickData onlySelf() {
ParticleTickData particleTickData = copy();
particleTickData.onlySelf = true;
return particleTickData;
}
public ParticleTickData onlyOthers() {
ParticleTickData particleTickData = copy();
particleTickData.onlyOthers = true;
return particleTickData;
}
public Location getLocation() {
if (location == null) {
return player.getLocation();
}
return location;
}
public ParticleTickData copy() {
return new ParticleTickData(world, player, location, deg, isMoving, onlySelf, onlyOthers);
}
}

Datei anzeigen

@ -1,8 +0,0 @@
package de.steamwar.lobby.particle;
public enum ParticleTickType {
ALWAYS,
MOVE,
;
}

Datei anzeigen

@ -0,0 +1,82 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
public class SimpleParticle implements BaseParticle {
private final ParticleItem particleItem;
private final Particle particle;
private boolean customVelocity = false;
private float vx;
private float vy;
private float vz;
private double time = 1;
private int count = 5;
public SimpleParticle(ParticleItem particleItem, Particle particle) {
this.particleItem = particleItem;
this.particle = particle;
}
public SimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time) {
this.particleItem = particleItem;
this.particle = particle;
this.customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
}
public SimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time, int count) {
this.particleItem = particleItem;
this.particle = particle;
this.customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
this.count = count;
}
@Override
public ParticleItem getItem() {
return particleItem;
}
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation().add(0.0, 0.2, 0.0);
Bukkit.getOnlinePlayers().forEach(player -> {
int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
if (customVelocity) {
player.spawnParticle(particle, location, count, vx, vy, vz, time);
} else {
player.spawnParticle(particle, location, count);
}
}
});
}
}

Datei anzeigen

@ -1,56 +0,0 @@
package de.steamwar.lobby.particle;
import lombok.SneakyThrows;
import org.bukkit.util.Vector;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
public interface WingDesign {
@SneakyThrows
static Vector[] create(String resource) {
List<Vector> vectors = new ArrayList<>();
BufferedImage bufferedImage = ImageIO.read(WingDesign.class.getResourceAsStream(resource));
for (int x = 0; x < bufferedImage.getWidth(); x++) {
for (int y = 0; y < bufferedImage.getHeight(); y++) {
int rgb = bufferedImage.getRGB(x, y);
if (Color.WHITE.getRGB() != rgb) {
vectors.add(new Vector(x - bufferedImage.getWidth() / 2.0, bufferedImage.getHeight() - y - 1.0, 0));
}
}
}
return vectors.toArray(new Vector[0]);
}
class WingDesignImpl implements WingDesign {
private final Vector[] vectors;
public WingDesignImpl(Vector[] vectors) {
this.vectors = vectors;
}
@Override
public Vector[] getVectors() {
return vectors;
}
}
Vector[] getVectors();
WingDesign SIMPLE = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/WingSimple4.png"));
WingDesign COMPLEX = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/WingSimple2.png"));
WingDesign SWORD = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/WingSword.png"));
WingDesign SW = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/WingSW.png"));
WingDesign WGS = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/WingWGS.png"));
WingDesign SWORD_CROSSED = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/WingSwordCrossed.png"));
WingDesign MWGL = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/MWGL.png"));
WingDesign ECLIPSE = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/ECLIPSE-Logo.png"));
WingDesign PL = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/PL-Logo.png"));
WingDesign PlompaEasterWings = new WingDesignImpl(create("/de/steamwar/lobby/particle/decorator/ECAL-Logo.png"));
}

Datei anzeigen

@ -0,0 +1,75 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import org.bukkit.Location;
import org.bukkit.util.Vector;
public class CircleParticle implements BaseParticle {
private ParticleItem particleItem = null;
private BaseParticle particle;
private BaseParticle particle2;
public CircleParticle(BaseParticle particle) {
this.particle = particle;
}
public CircleParticle(ParticleItem particleItem, BaseParticle particle, BaseParticle particle2) {
this.particleItem = particleItem;
this.particle = particle;
this.particle2 = particle2;
}
@Override
public ParticleItem getItem() {
if (particleItem != null) {
return particleItem.addAttribute("PARTICLE_ATTRIBUTE_BI_CIRCLE");
}
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_CIRCLE");
}
@Override
public boolean needsTick() {
return particle.needsTick() || (particle2 != null && particle2.needsTick());
}
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation();
Vector vector = new Vector(1, 0, 0);
vector.rotateAroundY(particleData.getDeg());
ParticleData nData = particleData.withLocation(location.clone().add(vector));
particle.particle(nData);
if (particle2 == null) {
return;
}
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
nData = particleData.withLocation(location.clone().add(vector));
particle2.particle(nData);
}
}

Datei anzeigen

@ -0,0 +1,59 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import lombok.NonNull;
import org.bukkit.Material;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class CloudParticle implements BaseParticle {
private BaseParticle particle;
public CloudParticle(@NonNull BaseParticle particle) {
this.particle = particle;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_CLOUD");
}
@Override
public boolean needsTick() {
return particle.needsTick();
}
@Override
public void particle(ParticleData particleData) {
if (particleData.getWorld().getBlockAt(particleData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType() == Material.AIR) {
particleData.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false));
} else {
particleData.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
return;
}
ParticleData nData = particleData.withLocation(particleData.getLocation().subtract(0, -0.2, 0));
particle.particle(nData);
}
}

Binäre Datei nicht angezeigt.

Vorher

Breite:  |  Höhe:  |  Größe: 159 B

Binäre Datei nicht angezeigt.

Vorher

Breite:  |  Höhe:  |  Größe: 177 B

Binäre Datei nicht angezeigt.

Vorher

Breite:  |  Höhe:  |  Größe: 8.0 KiB

Datei anzeigen

@ -0,0 +1,46 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import org.bukkit.Material;
public class NonFloorParticle implements BaseParticle {
private BaseParticle particle;
public NonFloorParticle(BaseParticle particle) {
this.particle = particle;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_NON_FLOOR");
}
@Override
public void particle(ParticleData particleData) {
if (particleData.getWorld().getBlockAt(particleData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType() == Material.AIR) {
particle.particle(particleData);
}
}
}

Binäre Datei nicht angezeigt.

Vorher

Breite:  |  Höhe:  |  Größe: 129 B

Binäre Datei nicht angezeigt.

Vorher

Breite:  |  Höhe:  |  Größe: 140 B

Datei anzeigen

@ -0,0 +1,49 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import lombok.NonNull;
public class TickParticle implements BaseParticle {
private BaseParticle particle;
public TickParticle(@NonNull BaseParticle particle) {
this.particle = particle;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_TICK");
}
@Override
public boolean needsTick() {
return true;
}
@Override
public void particle(ParticleData particleData) {
particle.particle(particleData);
}
}

Datei anzeigen

@ -0,0 +1,110 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.decorator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import lombok.SneakyThrows;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WingParticle implements BaseParticle, Listener {
private Map<Player, Integer> playerMap = new HashMap<>();
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
playerMap.remove(event.getPlayer());
}
public enum WingDesign {
SIMPLE("WingSimple4.png"),
COMPLEX("WingSimple2.png"),
SWORD("WingSword.png"),
SW("WingSW.png"),
WGS("WingWGS.png"),
SWORD_CROSSED("WingSwordCrossed.png"),
;
private List<Vector> vectors = new ArrayList<>();
@SneakyThrows
WingDesign(String wingResource) {
BufferedImage bufferedImage = ImageIO.read(WingParticle.class.getResourceAsStream(wingResource));
for (int x = 0; x < bufferedImage.getWidth(); x++) {
for (int y = 0; y < bufferedImage.getHeight(); y++) {
int rgb = bufferedImage.getRGB(x, y);
if (Color.WHITE.getRGB() != rgb) {
vectors.add(new Vector(x - bufferedImage.getWidth() / 2.0, bufferedImage.getHeight() - y - 1.0, 0));
}
}
}
}
}
private BaseParticle particle;
private double size;
private WingDesign wingDesign;
public WingParticle(BaseParticle particle, double size, WingDesign wingDesign) {
this.particle = particle;
this.size = size;
this.wingDesign = wingDesign;
}
@Override
public ParticleItem getItem() {
return particle.getItem().addAttribute("PARTICLE_ATTRIBUTE_WING");
}
@Override
public void particle(ParticleData particleData) {
int currentNumber = playerMap.getOrDefault(particleData.getPlayer(), 0) % 20;
playerMap.put(particleData.getPlayer(), currentNumber + 1);
if (currentNumber != 0) {
return;
}
if (particleData.getPlayer().isGliding()) {
return;
}
wingDesign.vectors.forEach(dVector -> {
Vector vector = new Vector(dVector.getX() * size, 0.6 + dVector.getY() * size - (particleData.getPlayer().isSneaking() ? 0.5 : 0) , 0.5);
vector.rotateAroundY(Math.toRadians(particleData.getPlayer().getLocation().getYaw() * -1));
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
Location location = particleData.getPlayer().getLocation().clone().add(vector);
ParticleData current = particleData.withLocation(location);
particle.particle(current);
});
}
}

Datei anzeigen

@ -1,27 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.ParticleTickType;
public class Always extends DelegatingParticleElement {
public Always(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_TICK";
}
@Override
public ParticleTickType tickType() {
return ParticleTickType.ALWAYS;
}
@Override
public void tick(ParticleTickData particleTickData) {
particleElement.tick(particleTickData);
}
}

Datei anzeigen

@ -1,39 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Location;
import org.bukkit.util.Vector;
public class Circle extends DelegatingParticleElement {
private double distance;
private double speed;
public Circle(ParticleElement particleElement) {
super(particleElement);
this.distance = 1;
this.speed = 1;
}
public Circle(ParticleElement particleElement, double distance, double speed) {
super(particleElement);
this.distance = distance;
this.speed = speed;
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_CIRCLE";
}
@Override
public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation();
Vector vector = new Vector(distance, 0, 0);
vector.rotateAroundY((particleTickData.getDeg() * speed) % 360);
ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
particleElement.tick(nParticleTickData);
}
}

Datei anzeigen

@ -1,31 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Material;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Cloud extends DelegatingParticleElement {
public Cloud(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_CLOUD";
}
@Override
public void tick(ParticleTickData particleTickData) {
if (particleTickData.getWorld().getBlockAt(particleTickData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType() == Material.AIR) {
particleTickData.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false));
} else {
particleTickData.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
return;
}
ParticleTickData nParticleTickData = particleTickData.withLocation(particleTickData.getLocation().subtract(0, -0.2, 0));
particleElement.tick(nParticleTickData);
}
}

Datei anzeigen

@ -1,52 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.Map;
public class Delayed extends DelegatingParticleElement {
private DelayedData delayedData = new DelayedData();
private int interval;
private static class DelayedData implements Listener {
private Map<Player, Integer> data = new HashMap<>();
@EventHandler(ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
data.remove(event.getPlayer());
}
}
public Delayed(ParticleElement particleElement, int interval) {
super(particleElement);
Bukkit.getPluginManager().registerEvents(delayedData, LobbySystem.getPlugin());
this.interval = interval;
if (interval <= 0) {
throw new IllegalArgumentException("Interval must be greater than 0");
}
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
int currentNumber = delayedData.data.getOrDefault(particleTickData.getPlayer(), 0) % interval;
delayedData.data.put(particleTickData.getPlayer(), currentNumber + 1);
if (currentNumber != 0) {
return;
}
particleElement.tick(particleTickData);
}
}

Datei anzeigen

@ -1,30 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickType;
public abstract class DelegatingParticleElement implements ParticleElement {
protected final ParticleElement particleElement;
protected DelegatingParticleElement(ParticleElement particleElement) {
this.particleElement = particleElement;
}
public abstract String attribute();
@Override
public void aggregateAttributes(ParticleData particleData) {
String attribute = attribute();
if (attribute != null) {
particleData.add(attribute);
}
particleElement.aggregateAttributes(particleData);
}
@Override
public ParticleTickType tickType() {
return particleElement.tickType();
}
}

Datei anzeigen

@ -1,58 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.ParticleTickType;
import org.bukkit.Location;
import org.bukkit.util.Vector;
public class DoubleCircle extends Circle {
private ParticleElement second;
private double distance;
private double speed;
public DoubleCircle(ParticleElement first, ParticleElement second) {
super(first);
this.second = second;
this.distance = 1;
this.speed = 1;
}
public DoubleCircle(ParticleElement first, ParticleElement second, double distance, double speed) {
super(first);
this.second = second;
this.distance = distance;
this.speed = speed;
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_BI_CIRCLE";
}
@Override
public ParticleTickType tickType() {
if (particleElement.tickType() == second.tickType()) {
return particleElement.tickType();
}
return ParticleTickType.MOVE;
}
@Override
public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation();
Vector vector = new Vector(distance, 0, 0);
vector.rotateAroundY((particleTickData.getDeg() * speed) % 360);
ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
particleElement.tick(nParticleTickData);
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
second.tick(nParticleTickData);
}
}

Datei anzeigen

@ -1,44 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Location;
import org.bukkit.Particle;
public class DustParticle implements ParticleElement {
private Particle particle;
private float vx = 0.01f;
private float vy = 0.01f;
private float vz = 0.01f;
private double speed = 0.01;
private int count = 5;
public DustParticle(Particle particle) {
this.particle = particle;
}
public DustParticle(Particle particle, float vx, float vy, float vz) {
this.particle = particle;
this.vx = vx;
this.vy = vy;
this.vz = vz;
}
public DustParticle(Particle particle, float vx, float vy, float vz, double speed, int count) {
this.particle = particle;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.speed = speed;
this.count = count;
}
@Override
public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0);
display(location, particleTickData.getPlayer(), particleTickData.isOnlySelf(), particleTickData.isOnlyOthers(), player -> {
player.spawnParticle(particle, location, count, vx, vy, vz, speed, randomParticleDust());
});
}
}

Datei anzeigen

@ -1,23 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class Floor extends DelegatingParticleElement {
public Floor(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_FLOOR";
}
@Override
public void tick(ParticleTickData particleTickData) {
if (!particleTickData.getWorld().getBlockAt(particleTickData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType().isAir()) {
particleElement.tick(particleTickData);
}
}
}

Datei anzeigen

@ -1,24 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class Flying extends DelegatingParticleElement {
public Flying(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_FLYING";
}
@Override
public void tick(ParticleTickData particleTickData) {
if (!particleTickData.getPlayer().isGliding()) {
return;
}
particleElement.tick(particleTickData);
}
}

Datei anzeigen

@ -1,36 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class Group extends DelegatingParticleElement {
private final ParticleElement[] rest;
public Group(ParticleElement particleElement, ParticleElement... rest) {
super(particleElement);
this.rest = rest;
}
@Override
public String attribute() {
return null;
}
@Override
public void aggregateAttributes(ParticleData particleData) {
particleElement.aggregateAttributes(particleData);
for (ParticleElement particleElement : rest) {
particleElement.aggregateAttributes(particleData);
}
}
@Override
public void tick(ParticleTickData particleTickData) {
particleElement.tick(particleTickData);
for (ParticleElement particleElement : rest) {
particleElement.tick(particleTickData);
}
}
}

Datei anzeigen

@ -1,32 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Location;
import java.util.function.UnaryOperator;
public class LocationMutator extends DelegatingParticleElement {
private UnaryOperator<Location> mutator;
public LocationMutator(ParticleElement particleElement, UnaryOperator<Location> mutator) {
super(particleElement);
this.mutator = mutator;
}
public LocationMutator(ParticleElement particleElement, double vx, double vy, double vz) {
this(particleElement, location -> location.add(vx, vy, vz));
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
ParticleTickData nParticleTickData = particleTickData.withLocation(mutator.apply(particleTickData.getLocation()));
particleElement.tick(nParticleTickData);
}
}

Datei anzeigen

@ -1,23 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class NonFloor extends DelegatingParticleElement {
public NonFloor(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_NON_FLOOR";
}
@Override
public void tick(ParticleTickData particleTickData) {
if (particleTickData.getWorld().getBlockAt(particleTickData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType().isAir()) {
particleElement.tick(particleTickData);
}
}
}

Datei anzeigen

@ -1,24 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class NonFlying extends DelegatingParticleElement {
public NonFlying(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_NON_FLYING";
}
@Override
public void tick(ParticleTickData particleTickData) {
if (particleTickData.getPlayer().isGliding()) {
return;
}
particleElement.tick(particleTickData);
}
}

Datei anzeigen

@ -1,21 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class OnlyOthers extends DelegatingParticleElement {
public OnlyOthers(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
particleElement.tick(particleTickData.onlyOthers());
}
}

Datei anzeigen

@ -1,21 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class OnlySelf extends DelegatingParticleElement {
public OnlySelf(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
particleElement.tick(particleTickData.onlySelf());
}
}

Datei anzeigen

@ -1,57 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
public class RandomParticle implements ParticleElement {
private RandomData randomData;
private ParticleEnum[] particleEnums;
private static class RandomData implements Listener {
private Random random = new Random();
private int max;
private Map<Player, Integer> data = new HashMap<>();
public RandomData(int max) {
this.max = max;
}
@EventHandler(ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event) {
data.put(event.getPlayer(), random.nextInt(max));
}
@EventHandler(ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
data.remove(event.getPlayer());
}
}
public RandomParticle(ParticleEnum... particleEnums) {
if (particleEnums.length == 0) {
throw new IllegalArgumentException("ParticleEnums must not be empty");
}
this.randomData = new RandomData(particleEnums.length);
Bukkit.getPluginManager().registerEvents(randomData, LobbySystem.getPlugin());
this.particleEnums = particleEnums;
}
@Override
public void tick(ParticleTickData particleTickData) {
int currentNumber = randomData.data.getOrDefault(particleTickData.getPlayer(), 0);
particleEnums[currentNumber].getParticle().getParticleElement().tick(particleTickData);
}
}

Datei anzeigen

@ -1,18 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class Separator implements ParticleElement {
@Override
public void aggregateAttributes(ParticleData particleData) {
particleData.add("PARTICLE_ATTRIBUTE_SEPARATOR");
}
@Override
public void tick(ParticleTickData particleTickData) {
// do nothing
}
}

Datei anzeigen

@ -1,66 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Location;
import org.bukkit.Particle;
public class SimpleParticle implements ParticleElement {
private final Particle particle;
private boolean customVelocity = false;
private float vx;
private float vy;
private float vz;
private double time = 1;
private int count = 5;
public SimpleParticle(Particle particle) {
this.particle = particle;
}
public SimpleParticle(Particle particle, float vx, float vy, float vz) {
this.particle = particle;
this.customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
}
public SimpleParticle(Particle particle, float vx, float vy, float vz, double time) {
this.particle = particle;
this.customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
}
public SimpleParticle(Particle particle, float vx, float vy, float vz, double time, int count) {
this.particle = particle;
this.customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
this.count = count;
}
public SimpleParticle(Particle particle, double time, int count) {
this.particle = particle;
this.time = time;
this.count = count;
}
@Override
public void tick(ParticleTickData particleTickData) {
Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0);
display(location, particleTickData.getPlayer(), particleTickData.isOnlySelf(), particleTickData.isOnlyOthers(), player -> {
if (customVelocity) {
player.spawnParticle(particle, location, count, vx, vy, vz, time);
} else {
player.spawnParticle(particle, location, count);
}
});
}
}

Datei anzeigen

@ -1,24 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
public class Sneaking extends DelegatingParticleElement {
public Sneaking(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_SNEAKING";
}
@Override
public void tick(ParticleTickData particleTickData) {
if (!particleTickData.getPlayer().isSneaking()) {
return;
}
particleElement.tick(particleTickData);
}
}

Datei anzeigen

@ -1,37 +0,0 @@
package de.steamwar.lobby.particle.elements;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.WingDesign;
import org.bukkit.Location;
import org.bukkit.util.Vector;
public class Wing extends DelegatingParticleElement {
private double size;
private WingDesign wingDesign;
public Wing(ParticleElement particleElement, double size, WingDesign wingDesign) {
super(particleElement);
this.size = size;
this.wingDesign = wingDesign;
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_WING";
}
@Override
public void tick(ParticleTickData particleTickData) {
for (Vector dVector : wingDesign.getVectors()) {
Vector vector = new Vector(dVector.getX() * size, 0.6 + dVector.getY() * size - (particleTickData.getPlayer().isSneaking() ? 0.5 : 0), 0.5);
vector.rotateAroundY(Math.toRadians(particleTickData.getPlayer().getLocation().getYaw() * -1));
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
Location location = particleTickData.getPlayer().getLocation().clone().add(vector);
ParticleTickData current = particleTickData.withLocation(location);
particleElement.tick(current);
}
}
}

Datei anzeigen

@ -1,44 +0,0 @@
package de.steamwar.lobby.particle.elements.custom;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
import org.bukkit.Location;
import org.bukkit.util.Vector;
public class HearthBeat extends DelegatingParticleElement {
private double speed;
private double y(double time) {
double d1 = Math.pow(2, -Math.pow(time * 17 - 7.5, 2));
double d2 = Math.pow(2, -Math.pow(time * 20 - 11, 2)) * 0.5;
double d3 = Math.pow(2, -Math.pow(time * 25 - 17, 2)) * 0.1;
return (d1 - d2 + d3) * 0.5;
}
public HearthBeat(ParticleElement particleElement, double speed) {
super(particleElement);
this.speed = speed;
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
double time = ((particleTickData.getDeg() * speed) % 360) / 360.0;
double y = y(time) * 2;
double x = (time - 0.5) * 2;
Vector vector = new Vector(x, 1.1 + y - (particleTickData.getPlayer().isSneaking() ? 0.5 : 0), 0.7);
vector.rotateAroundY(Math.toRadians(particleTickData.getPlayer().getLocation().getYaw() * -1));
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
Location location = particleTickData.getPlayer().getLocation().clone().add(vector);
ParticleTickData current = particleTickData.withLocation(location);
particleElement.tick(current);
}
}

Datei anzeigen

@ -1,25 +0,0 @@
package de.steamwar.lobby.particle.elements.custom;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
public class NonMoving extends DelegatingParticleElement {
public NonMoving(ParticleElement particleElement) {
super(particleElement);
}
@Override
public String attribute() {
return "PARTICLE_ATTRIBUTE_NON_MOVING";
}
@Override
public void tick(ParticleTickData particleTickData) {
if (particleTickData.isMoving()) {
return;
}
particleElement.tick(particleTickData);
}
}

Datei anzeigen

@ -1,50 +0,0 @@
package de.steamwar.lobby.particle.elements.custom;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
import org.bukkit.util.Vector;
public class PulseShimmer extends DelegatingParticleElement {
private int speed;
private int rotationSpeed;
private double x(double time) {
if (time < 0.45) {
return Math.pow(2, -Math.pow((time - 0.45) * 6, 2)) * 0.8;
} else {
return Math.pow(2, -Math.pow((time - 0.45) * 4, 2)) * 0.8;
}
}
private double y(double time) {
return (8 * Math.pow(time, 2.2) - time) / (6.5 / 3.5) -0.1;
}
public PulseShimmer(ParticleElement particleElement, int speed, int rotationSpeed) {
super(particleElement);
this.speed = speed;
this.rotationSpeed = rotationSpeed;
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
double time = ((particleTickData.getDeg() * speed) % 360) / 360.0;
double x = x(time);
double y = y(time);
Vector vector = new Vector(x, y, 0);
vector.rotateAroundY((particleTickData.getDeg() * rotationSpeed) % 360);
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
vector.rotateAroundY(90);
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
vector.rotateAroundY(90);
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
}
}

Datei anzeigen

@ -1,47 +0,0 @@
package de.steamwar.lobby.particle.elements.custom;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
public class YOffset extends DelegatingParticleElement {
private double multiplication;
private double minY;
private double maxY;
private boolean inverted;
public YOffset(ParticleElement particleElement, double speed, double minY, double maxY, boolean inverted) {
super(particleElement);
this.multiplication = speed;
this.minY = minY;
this.maxY = maxY;
this.inverted = inverted;
}
@Override
public String attribute() {
return null;
}
@Override
public void tick(ParticleTickData particleTickData) {
double value = ((particleTickData.getDeg() * multiplication) % 360) / 180;
double y;
if (inverted) {
if (value <= 1) {
y = maxY - (maxY - minY) * value;
} else {
y = minY + (maxY - minY) * (value - 1);
}
} else {
if (value <= 1) {
y = minY + (maxY - minY) * value;
} else {
y = maxY - (maxY - minY) * (value - 1);
}
}
ParticleTickData current = particleTickData.withLocation(particleTickData.getLocation().clone().add(0, y, 0));
particleElement.tick(current);
}
}

Datei anzeigen

@ -0,0 +1,47 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.group;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
public class ParticleGroup implements BaseParticle {
private ParticleItem particleItem;
private BaseParticle[] particles;
public ParticleGroup(ParticleItem particleItem, BaseParticle... particles) {
this.particleItem = particleItem;
this.particles = particles;
}
@Override
public ParticleItem getItem() {
return particleItem;
}
@Override
public void particle(ParticleData particleData) {
for (BaseParticle particle : particles) {
particle.particle(particleData.copy());
}
}
}

Datei anzeigen

@ -0,0 +1,54 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.mutator;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import org.bukkit.Location;
import java.util.function.UnaryOperator;
public class LocationParticleMutator implements BaseParticle {
private BaseParticle particle;
private UnaryOperator<Location> mutator;
public LocationParticleMutator(BaseParticle particle, UnaryOperator<Location> mutator) {
this.particle = particle;
this.mutator = mutator;
}
@Override
public ParticleItem getItem() {
return particle.getItem();
}
@Override
public boolean needsTick() {
return particle.needsTick();
}
@Override
public void particle(ParticleData particleData) {
ParticleData nData = particleData.withLocation(mutator.apply(particleData.getLocation()));
particle.particle(nData);
}
}

Datei anzeigen

@ -1,51 +0,0 @@
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.elements.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@AllArgsConstructor
public enum EasterParticle implements ParticleEnum {
EGG_HUNT_EASY(new ParticleData(Material.LIME_CONCRETE_POWDER, "PARTICLE_EGG_HUNT_EASY", ParticleRequirement.EGG_HUNT_EASY,
new Always(new LocationMutator(new SimpleParticle(Particle.FALLING_SPORE_BLOSSOM, 0.5F, 0.1f, 0.5F, 1, 1), 0, 2.2, 0)))
),
EGG_HUNT_MEDIUM(new ParticleData(Material.YELLOW_CONCRETE_POWDER, "PARTICLE_EGG_HUNT_MEDIUM", ParticleRequirement.EGG_HUNT_MEDIUM,
new Always(new Floor(new Sneaking(new SimpleParticle(Particle.GLOW_SQUID_INK, 0.4F, 0.9F, 0.4F, 0.01)))))
),
EGG_HUNT_HARD(new ParticleData(Material.RED_CONCRETE_POWDER, "PARTICLE_EGG_HUNT_HARD", ParticleRequirement.EGG_HUNT_HARD,
new Always(new LocationMutator(new DoubleCircle(new DustParticle(Particle.REDSTONE, 0, 0, 0, 0.01, 1), new DustParticle(Particle.REDSTONE, 0, 0, 0, 0.01, 1)), 0, 0.5, 0)))
),
EGG_HUNT_EXTREME(new ParticleData(Material.PURPLE_CONCRETE_POWDER, "PARTICLE_EGG_HUNT_EXTREME", ParticleRequirement.EGG_HUNT_EXTREME,
new Always(new LocationMutator(new SimpleParticle(Particle.FALLING_OBSIDIAN_TEAR, 0.5F, 0.1F, 0.5F, 1, 1), 0, 2.2, 0)))
),
EGG_HUNT_ADVANCED(new ParticleData(Material.BLACK_CONCRETE_POWDER, "PARTICLE_EGG_HUNT_ADVANCED", ParticleRequirement.EGG_HUNT_ADVANCED,
new Always(new Sneaking(new LocationMutator(new Group(
new SimpleParticle(Particle.SMOKE_NORMAL, 0.02F, 0, 0.02F, 0.05, 1),
new SimpleParticle(Particle.SMOKE_LARGE, 0.02F, 0, 0.02F, 0.05, 1),
particleTickData -> {
Player player = particleTickData.getPlayer();
player.setVelocity(player.getVelocity().add(new Vector(0, 0.1, 0)));
}
), 0, -0.2, 0))))
),
EGG_HUNT_HALF(new ParticleData(Material.EGG, "PARTICLE_EGG_HUNT_HALF", ParticleRequirement.EGG_HUNT_FOUND_HALF,
new Group(
new Always(new Sneaking(new Floor(new LocationMutator(new SimpleParticle(Particle.HEART, 0, 0, 0, 0.01), 0, 1.7, 0)))),
new Separator(),
new Always(new NonFloor(new NonFlying(new LocationMutator(new Cloud(new Circle(new SimpleParticle(Particle.HEART, 0, 0, 0, 0.01))), 0, 0.5, 0))))
))
),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
}

Datei anzeigen

@ -1,29 +1,46 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.elements.Always;
import de.steamwar.lobby.particle.elements.Circle;
import de.steamwar.lobby.particle.elements.LocationMutator;
import de.steamwar.lobby.particle.elements.SimpleParticle;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.NonFloorParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
public enum EventParticle implements ParticleEnum {
WATER(new ParticleData(Material.WATER_BUCKET, "PARTICLE_WATER", ParticleRequirement.EVENT_PARTICIPATION,
new Always(new Circle(new LocationMutator(new SimpleParticle(Particle.DRIP_WATER), 0, 1.1, 0))))
),
LAVA(new ParticleData(Material.LAVA_BUCKET, "PARTICLE_FIRE", ParticleRequirement.EVENT_PARTICIPATION,
new Always(new Circle(new LocationMutator(new SimpleParticle(Particle.DRIP_LAVA), 0, 1.1, 0))))
),
WATER(new TickParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(WATER_BUCKET, "PARTICLE_WATER", "PARTICLE_UNLOCKED_BY_EVENT"), Particle.DRIP_WATER), location -> location.add(0, 1.1, 0))))),
LAVA(new TickParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(LAVA_BUCKET, "PARTICLE_FIRE", "PARTICLE_UNLOCKED_BY_EVENT"), Particle.DRIP_LAVA), location -> location.add(0, 1.1, 0))))),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
private BaseParticle particle;
}

Datei anzeigen

@ -1,45 +1,56 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.WingDesign;
import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.EventParticleItem;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
import de.steamwar.lobby.particle.decorator.WingParticle;
import de.steamwar.lobby.particle.group.ParticleGroup;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
@Getter
public enum EventParticleParticipation implements ParticleEnum {
WarGearSeason(new ParticleData(Material.BOOK, "PARTICLE_EVENT_ENCHANTING", ParticleRequirement.eventParticipation(22),
new SimpleParticle(Particle.ENCHANTMENT_TABLE))
),
AirshipEvent(new ParticleData(Material.SNOW_BLOCK, "PARTICLE_EVENT_CLOUD", ParticleRequirement.eventParticipation(26),
new SimpleParticle(Particle.CLOUD))
),
HellsBellsWs(new ParticleData(Material.TNT, "PARTICLE_EVENT_SMOKE", ParticleRequirement.eventParticipation(28),
new Circle(new SimpleParticle(Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01)))
),
Underwater(new ParticleData(Material.PRISMARINE_BRICKS, "PARTICLE_EVENT_WATER", ParticleRequirement.eventParticipation(31),
new SimpleParticle(Particle.DRIP_WATER))
),
AdventWarShip(new ParticleData(Material.PRISMARINE_WALL, "PARTICLE_EVENT_WATER", ParticleRequirement.eventParticipation(32),
new Group(new SimpleParticle(Particle.DRIP_WATER), new SimpleParticle(Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01)))
),
MiniWarGearLiga(new ParticleData(Material.PRISMARINE_SLAB, "PARTICLE_EVENT_WATER", ParticleRequirement.eventParticipation(33),
new Circle(new SimpleParticle(Particle.WATER_WAKE, 0, 0, 0, 0)))
),
UnderwaterMWG(new ParticleData(Material.BLUE_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", ParticleRequirement.eventParticipation(35),
new Always(new RandomParticle(RainCloudParticle.values())))
),
WarGearSeason2022(new ParticleData(Material.DIAMOND_SWORD, "PARTICLE_EVENT_WINGS", ParticleRequirement.eventParticipation(37),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingDesign.COMPLEX)), 20)))
),
WarGearSeason(22, new SimpleParticle(EventParticleItem.participation(BOOK, "PARTICLE_EVENT_ENCHANTING", 22), Particle.ENCHANTMENT_TABLE)),
AirshipEvent(26, new SimpleParticle(EventParticleItem.participation(SNOW_BLOCK, "PARTICLE_EVENT_CLOUD", 26), Particle.CLOUD)),
HellsBellsWs(28, new CircleParticle(new SimpleParticle(EventParticleItem.participation(TNT, "PARTICLE_EVENT_SMOKE", 28), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01))),
Underwater(31, new SimpleParticle(EventParticleItem.participation(PRISMARINE_BRICKS, "PARTICLE_EVENT_WATER", 31), Particle.DRIP_WATER)),
AdventWarShip(32, new ParticleGroup(EventParticleItem.participation(PRISMARINE_WALL, "PARTICLE_EVENT_WATER", 32), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))),
MiniWarGearLiga(33, new CircleParticle(new SimpleParticle(EventParticleItem.participation(PRISMARINE_SLAB, "PARTICLE_EVENT_WATER", 33), Particle.WATER_WAKE, 0, 0, 0, 0))),
// Absturz(34, null),
UnderwaterMWG(35, new TickParticle(new LocationParticleMutator(new ParticleGroup(EventParticleItem.participation(BLUE_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", 35), new SimpleParticle(null, Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new SimpleParticle(null, Particle.WATER_WAKE, 0.3F, 0.1F, 0.3F, 0.01), new LocationParticleMutator(new SimpleParticle(null, Particle.DRIP_WATER, 0.3F, 0.0F, 0.3F, 0.01), location -> location.subtract(0, 0.2, 0))), location -> location.add(0, 2.2, 0)))),
WarGearSeason2022(37, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.participation(DIAMOND_SWORD, "PARTICLE_EVENT_WINGS", 37), Particle.DRAGON_BREATH, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.COMPLEX))),
// WargearClash(38, null),
;
public static ParticleEnum[] particles = values();
public static EventParticleParticipation[] particles = values();
@Getter
private ParticleData particle;
private int event;
private BaseParticle particle;
}

Datei anzeigen

@ -1,51 +1,57 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.WingDesign;
import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.EventParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.CloudParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
import de.steamwar.lobby.particle.decorator.WingParticle;
import de.steamwar.lobby.particle.group.ParticleGroup;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
@Getter
public enum EventParticlePlacement implements ParticleEnum {
WarGearSeason(new ParticleData(Material.ENCHANTING_TABLE, "PARTICLE_EVENT_ENCHANTING", ParticleRequirement.eventPlacement(22, 12, 285, 54),
new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), 0, 1.1, 0)))
)),
AirshipEvent(new ParticleData(Material.SNOWBALL, "PARTICLE_EVENT_CLOUD", ParticleRequirement.eventPlacement(26, 205, 9, 54, 120, 292),
new Circle(new LocationMutator(new SimpleParticle(Particle.CLOUD, 0, 0, 0, 0.01), 0, 2.2, 0))
)),
HellsBellsWs(new ParticleData(Material.TNT_MINECART, "PARTICLE_EVENT_SMOKE", ParticleRequirement.eventPlacement(28, 205, 9, 11),
new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01), 0, 2.2, 0)))
)),
Underwater(new ParticleData(Material.PRISMARINE_SHARD, "PARTICLE_EVENT_WATER", ParticleRequirement.eventPlacement(31, 9, 210, 520),
new Cloud(new SimpleParticle(Particle.DRIP_WATER)))
),
AdventWarShip(new ParticleData(Material.PRISMARINE_CRYSTALS, "PARTICLE_EVENT_WATER", ParticleRequirement.eventPlacement(32, 9, 205, 210),
new Always(new LocationMutator(new Circle(new Group(new SimpleParticle(Particle.DRIP_WATER), new SimpleParticle(Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))), 0, 1.1, 0)))
),
MiniWarGearLiga(new ParticleData(Material.IRON_SWORD, "PARTICLE_EVENT_WINGS", ParticleRequirement.eventPlacement(33, 9, 34, 205),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.WATER_WAKE, 0, 0, 0, 0, 1), 0.15, WingDesign.MWGL)), 20)))
),
Absturz(new ParticleData(Material.FEATHER, "PARTICLE_EVENT_WINGS", ParticleRequirement.eventPlacement(34, 210, 205, 527, 286),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingDesign.SIMPLE)), 20)))
),
UnderwaterMWG(new ParticleData(Material.CYAN_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", ParticleRequirement.eventPlacement(35, 9, 210),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingDesign.SW)), 20)))
),
WarGearSeason2022(new ParticleData(Material.DIAMOND_HELMET, "PARTICLE_EVENT_WGS", ParticleRequirement.eventPlacement(37, 285, 210, 122),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.FIREWORKS_SPARK, 0, 0, 0, 0, 1), 0.15, WingDesign.WGS)), 20)))
),
WargearClash(new ParticleData(Material.GOLDEN_SWORD, "PARTICLE_EVENT_WARGEARCLASH", ParticleRequirement.eventPlacement(38, 210, 158, 167, 286),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.1, WingDesign.SWORD_CROSSED)), 20)))
),
WarGearSeason(22, new int[]{12, 285, 54}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(ENCHANTING_TABLE, "PARTICLE_EVENT_ENCHANTING", 22), Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), location -> location.add(0, 1.1, 0))))),
AirshipEvent(26, new int[]{205, 9, 54, 120, 292}, new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(SNOWBALL, "PARTICLE_EVENT_CLOUD", 26), Particle.CLOUD, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0)))),
HellsBellsWs(28, new int[]{205, 9, 11}, new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(EventParticleItem.placement(TNT_MINECART, "PARTICLE_EVENT_SMOKE", 28), Particle.CAMPFIRE_COSY_SMOKE, 0, 0, 0, 0.01), location -> location.add(0, 2.2, 0))))),
Underwater(31, new int[]{9, 210, 520}, new CloudParticle(new SimpleParticle(EventParticleItem.placement(PRISMARINE_SHARD, "PARTICLE_EVENT_WATER", 31), Particle.DRIP_WATER))),
AdventWarShip(32, new int[]{9, 205, 210}, new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleGroup(EventParticleItem.placement(PRISMARINE_CRYSTALS, "PARTICLE_EVENT_WATER", 32), new SimpleParticle(null, Particle.DRIP_WATER), new SimpleParticle(null, Particle.WATER_WAKE, 0.2F, 0.2F, 0.2F, 0.01))), location -> location.add(0, 1.1, 0)))),
MiniWarGearLiga(33, new int[]{9, 34, 205}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(IRON_SWORD, "PARTICLE_EVENT_WINGS", 33), Particle.WATER_WAKE, 0, 0, 0, 0, 1), 0.05, WingParticle.WingDesign.SWORD))),
Absturz(34, new int[]{210, 205, 527, 286}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(FEATHER, "PARTICLE_EVENT_WINGS", 34), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SIMPLE))),
UnderwaterMWG(35, new int[]{9, 210}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(CYAN_CARPET, "PARTICLE_EVENT_RAIN_CLOUD", 35), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SW))),
WarGearSeason2022(37, new int[]{}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(DIAMOND_HELMET, "PARTICLE_EVENT_WGS", 37), Particle.FIREWORKS_SPARK, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.WGS))),
WargearClash(38, new int[]{210, 158, 167, 286}, new TickParticle(new WingParticle(new SimpleParticle(EventParticleItem.placement(GOLDEN_SWORD, "PARTICLE_EVENT_WARGEARCLASH", 38), Particle.CRIT_MAGIC, 0, 0, 0, 0, 1), 0.1, WingParticle.WingDesign.SWORD_CROSSED))),
;
public static ParticleEnum[] particles = values();
public static EventParticlePlacement[] particles = values();
@Getter
private ParticleData particle;
private int event;
private int[] placementTeams;
private BaseParticle particle;
}

Datei anzeigen

@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@ -17,13 +17,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
pluginManagement {
repositories {
gradlePluginPortal()
maven {
url = uri("https://steamwar.de/maven/")
}
}
}
package de.steamwar.lobby.particle.particles;
rootProject.name = 'LobbySystem2.0'
import de.steamwar.lobby.particle.BaseParticle;
public interface ParticleEnum {
BaseParticle getParticle();
}

Datei anzeigen

@ -1,63 +1,56 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.elements.DustParticle;
import de.steamwar.lobby.particle.elements.LocationMutator;
import de.steamwar.lobby.particle.elements.SimpleParticle;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.DustSimpleParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
public enum PlayerParticle implements ParticleEnum {
SNEEZE(new ParticleData(Material.SLIME_BLOCK, "PARTICLE_SNEEZE",
new SimpleParticle(Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01))
),
SMOKE(new ParticleData(Material.COBWEB, "PARTICLE_SMOKE",
new SimpleParticle(Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01))
),
FIRE(new ParticleData(Material.LAVA_BUCKET, "PARTICLE_FIRE",
new SimpleParticle(Particle.DRIP_LAVA))
),
WATER(new ParticleData(Material.WATER_BUCKET, "PARTICLE_WATER",
new SimpleParticle(Particle.DRIP_WATER))
),
HEARTH(new ParticleData(Material.RED_DYE, "PARTICLE_HEART",
new LocationMutator(new SimpleParticle(Particle.HEART), 0, 2.2, 0))
),
NOTES(new ParticleData(Material.NOTE_BLOCK, "PARTICLE_NOTES",
new LocationMutator(new SimpleParticle(Particle.NOTE), 0, 2.2, 0))
),
NAUTILUS(new ParticleData(Material.NAUTILUS_SHELL, "PARTICLE_NAUTILUS",
new SimpleParticle(Particle.NAUTILUS, 0.2F, 0.2F ,0.2F, 0.01))
),
SNOWBALL(new ParticleData(Material.SNOWBALL, "PARTICLE_SNOWBALL",
new SimpleParticle(Particle.SNOWBALL, 0.2F, 0.2F ,0.2F, 0.01))
),
EFFECT(new ParticleData(Material.GLASS_BOTTLE, "PARTICLE_EFFECT",
new DustParticle(Particle.REDSTONE, 0, 0.2F, 0, 0.01, 5))
),
CAMPFIRE(new ParticleData(Material.CAMPFIRE, "PARTICLE_CAMPFIRE",
new SimpleParticle(Particle.CAMPFIRE_COSY_SMOKE, 0, 0.2F ,0, 0.01))
),
MAGIC(new ParticleData(Material.CAULDRON, "PARTICLE_MAGIC",
new SimpleParticle(Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01))
),
ANGRY(new ParticleData(Material.REDSTONE_BLOCK, "PARTICLE_ANGRY",
new SimpleParticle(Particle.VILLAGER_ANGRY, 0.2F, 0.2F, 0.2F, 0.01))
),
SLIME(new ParticleData(Material.SLIME_BALL, "PARTICLE_SLIME",
new SimpleParticle(Particle.SLIME))
),
MOB(new ParticleData(Material.ZOMBIE_HEAD, "PARTICLE_MOB",
new SimpleParticle(Particle.SPELL_MOB))
),
SNEEZE(new SimpleParticle(new ParticleItem(SLIME_BLOCK, "PARTICLE_SNEEZE"), Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01)),
SMOKE(new SimpleParticle(new ParticleItem(COBWEB, "PARTICLE_SMOKE"), Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01)),
FIRE(new SimpleParticle(new ParticleItem(LAVA_BUCKET, "PARTICLE_FIRE"), Particle.DRIP_LAVA)),
WATER(new SimpleParticle(new ParticleItem(WATER_BUCKET, "PARTICLE_WATER"), Particle.DRIP_WATER)),
HEART(new LocationParticleMutator(new SimpleParticle(new ParticleItem(RED_DYE, "PARTICLE_HEART"), Particle.HEART), location -> location.add(0, 2.2, 0))),
NOTES(new LocationParticleMutator(new SimpleParticle(new ParticleItem(NOTE_BLOCK, "PARTICLE_NOTES"), Particle.NOTE), location -> location.add(0, 2.2, 0))),
NAUTILUS(new SimpleParticle(new ParticleItem(NAUTILUS_SHELL, "PARTICLE_NAUTILUS"), Particle.NAUTILUS, 0.2F, 0.2F, 0.2F, 0.01)),
SNOWBALL(new SimpleParticle(new ParticleItem(Material.SNOWBALL, "PARTICLE_SNOWBALL"), Particle.SNOWBALL, 0.2F, 0.2F, 0.2F, 0.01)),
EFFECT(new DustSimpleParticle(new ParticleItem(GLASS_BOTTLE, "PARTICLE_EFFECT"), Particle.REDSTONE, 0F, 0.2F, 0F, 0.01)),
CAMPFIRE(new SimpleParticle(new ParticleItem(Material.CAMPFIRE, "PARTICLE_CAMPFIRE"), Particle.CAMPFIRE_COSY_SMOKE, 0F, 0.2F, 0F, 0.01)),
MAGIC(new SimpleParticle(new ParticleItem(CAULDRON, "PARTICLE_MAGIC"), Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01)),
ANGRY(new SimpleParticle(new ParticleItem(REDSTONE_BLOCK, "PARTICLE_ANGRY"), Particle.VILLAGER_ANGRY, 0.2F, 0.2F, 0.2F, 0.01)),
SLIME(new SimpleParticle(new ParticleItem(SLIME_BALL, "PARTICLE_SLIME"), Particle.SLIME)),
MOB(new SimpleParticle(new ParticleItem(ZOMBIE_HEAD, "PARTICLE_MOB"), Particle.SPELL_MOB)),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
private BaseParticle particle;
}

Datei anzeigen

@ -1,59 +0,0 @@
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.elements.Always;
import de.steamwar.lobby.particle.elements.Group;
import de.steamwar.lobby.particle.elements.LocationMutator;
import de.steamwar.lobby.particle.elements.SimpleParticle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
@AllArgsConstructor
public enum RainCloudParticle implements ParticleEnum {
Raincloud(new ParticleData(Material.BLUE_CARPET, "PARTICLE_RAINCLOUD_NORMAL", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new SimpleParticle(Particle.WATER_WAKE, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.DRIP_WATER, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Red_Raincloud(new ParticleData(Material.RED_CARPET, "PARTICLE_RAINCLOUD_RED", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.DRIP_LAVA, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Yellow_Raincloud(new ParticleData(Material.YELLOW_CARPET, "PARTICLE_RAINCLOUD_YELLOW", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_NECTAR, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Orange_Raincloud(new ParticleData(Material.ORANGE_CARPET, "PARTICLE_RAINCLOUD_ORANGE", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_HONEY, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Green_Raincloud(new ParticleData(Material.LIME_CARPET, "PARTICLE_RAINCLOUD_GREEN", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_SPORE_BLOSSOM, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Purple_Raincloud(new ParticleData(Material.PURPLE_CARPET, "PARTICLE_RAINCLOUD_PURPLE", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.FALLING_OBSIDIAN_TEAR, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Nautilus_Raincloud(new ParticleData(Material.NAUTILUS_SHELL, "PARTICLE_RAINCLOUD_NAUTILUS", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.NAUTILUS, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Enchantment_Raincloud(new ParticleData(Material.ENCHANTED_BOOK, "PARTICLE_RAINCLOUD_ENCHANTMENT", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Slime_Raincloud(new ParticleData(Material.GREEN_CARPET, "PARTICLE_RAINCLOUD_SLIME", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.SLIME, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Hail_Raincloud(new ParticleData(Material.LIGHT_GRAY_CARPET, "PARTICLE_RAINCLOUD_HAIL", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.SNOWBALL, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Snow_Raincloud(new ParticleData(Material.WHITE_CARPET, "PARTICLE_RAINCLOUD_SNOW", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.SNOWFLAKE, 0.3F, 0.0F, 0.3F, 0.01), 0, -0.3, 0)), 0, 2.4, 0)))
),
Totem_Raincloud(new ParticleData(Material.TOTEM_OF_UNDYING, "PARTICLE_RAINCLOUD_TOTEM", ParticleRequirement.HAS_TEAM,
new Always(new LocationMutator(new Group(new SimpleParticle(Particle.CLOUD, 0.3F, 0.1F, 0.3F, 0.01), new LocationMutator(new SimpleParticle(Particle.TOTEM, 0.3F, 0.0F, 0.3F, 0.01, 2), 0, -0.3, 0)), 0, 2.4, 0)))
),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
}

Datei anzeigen

@ -1,99 +1,71 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.WingDesign;
import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.CloudParticle;
import de.steamwar.lobby.particle.decorator.TickParticle;
import de.steamwar.lobby.particle.decorator.WingParticle;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
public enum ServerTeamParticle implements ParticleEnum {
WITCH(new ParticleData(Material.EXPERIENCE_BOTTLE, "PARTICLE_WITCH", ParticleRequirement.SERVER_TEAM,
new SimpleParticle(Particle.SPELL_WITCH))
),
ENCHANTING(new ParticleData(Material.ENCHANTING_TABLE, "PARTICLE_ENCHANTING", ParticleRequirement.SERVER_TEAM,
new SimpleParticle(Particle.ENCHANTMENT_TABLE))
),
HAPPY(new ParticleData(Material.EMERALD_BLOCK, "PARTICLE_HAPPY", ParticleRequirement.SERVER_TEAM,
new SimpleParticle(Particle.HEART, 0.2F, 0.2F, 0.2F, 0.01))
),
FLAME(new ParticleData(Material.FLINT_AND_STEEL, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM,
new SimpleParticle(Particle.FLAME, 0, 0.2F, 0, 0.01))
),
END_ROD(new ParticleData(Material.END_ROD, "PARTICLE_END_ROD", ParticleRequirement.SERVER_TEAM,
new SimpleParticle(Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01))
),
CLOUD(new ParticleData(Material.WHITE_WOOL, "PARTICLE_CLOUD", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.CLOUD)))
),
TOTEM(new ParticleData(Material.TOTEM_OF_UNDYING, "PARTICLE_TOTEM", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.TOTEM, 0.2F, 0.2F, 0.2F, 0.01)))
),
ENCHANTING_CLOUD(new ParticleData(Material.WHITE_DYE, "PARTICLE_ENCHANTING", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.ENCHANTMENT_TABLE)))
),
FLAME_CLOUD(new ParticleData(Material.FIRE_CORAL_BLOCK, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.FLAME)))
),
SNEEZE_CLOUD(new ParticleData(Material.LIME_SHULKER_BOX, "PARTICLE_SNEEZE", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.SNEEZE)))
),
SLIME_CLOUD(new ParticleData(Material.GREEN_SHULKER_BOX, "PARTICLE_SLIME", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.SLIME)))
),
SMOKE_CLOUD(new ParticleData(Material.DEAD_BRAIN_CORAL_BLOCK, "PARTICLE_SMOKE", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.CAMPFIRE_COSY_SMOKE, 0.2F, 0.2F, 0.2F, 0.01)))
),
TOWN_CLOUD(new ParticleData(Material.FIREWORK_STAR, "PARTICLE_TOWN", ParticleRequirement.SERVER_TEAM,
new Cloud(new SimpleParticle(Particle.TOWN_AURA)))
),
FLAME_CIRCLE(new ParticleData(Material.MAGMA_BLOCK, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM,
new Circle(new LocationMutator(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0.01), 0, 1.1, 0)))
),
ENCHANTING_CIRCLE(new ParticleData(Material.WHITE_DYE, "PARTICLE_ENCHANTING_CIRCLE", ParticleRequirement.SERVER_TEAM,
new Circle(new LocationMutator(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0.2F, 0.2F, 0.2F, 0.01), 0, 1.1, 0)))
),
NOTES_CIRCLE(new ParticleData(Material.NOTE_BLOCK, "PARTICLE_NOTES", ParticleRequirement.SERVER_TEAM,
new Circle(new LocationMutator(new SimpleParticle(Particle.NOTE, 0, 0, 0, 0.01), 0, 2.2, 0)))
),
WATER_FIRE(new ParticleData(Material.GUARDIAN_SPAWN_EGG, "PARTICLE_WATER_FIRE", ParticleRequirement.SERVER_TEAM,
new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.DRIP_WATER, 0, 0, 0, 0.01), new SimpleParticle(Particle.DRIP_LAVA, 0, 0, 0, 0.01)), 0, 1.1, 0))
),
WATER_FIRE_ALWAYS(new ParticleData(Material.GUARDIAN_SPAWN_EGG, "PARTICLE_WATER_FIRE", ParticleRequirement.SERVER_TEAM,
new Always(new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.DRIP_WATER, 0, 0, 0, 0.01), new SimpleParticle(Particle.DRIP_LAVA, 0, 0, 0, 0.01)), 0, 1.1, 0)))
),
MAGIC_ENCHANTING(new ParticleData(Material.DIAMOND_SWORD, "PARTICLE_MAGIC_ENCHANTING", ParticleRequirement.SERVER_TEAM,
new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01), new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01)), 0, 1.1, 0))
),
MAGIC_ENCHANTING_ALWAYS(new ParticleData(Material.WOODEN_SWORD, "PARTICLE_MAGIC_ENCHANTING", ParticleRequirement.SERVER_TEAM,
new Always(new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01), new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01)), 0, 1.1, 0)))
),
MAGIC_CLOUD_CIRCLE(new ParticleData(Material.GLOWSTONE_DUST, "PARTICLE_MAGIC", ParticleRequirement.SERVER_TEAM,
new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01), 0, 1.1, 0))))
),
FLAME_CLOUD_CIRCLE(new ParticleData(Material.FIRE_CORAL, "PARTICLE_FLAME", ParticleRequirement.SERVER_TEAM,
new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0.01), 0, 1.1, 0))))
),
FIREWORK_CLOUD_CIRCLE(new ParticleData(Material.FIREWORK_ROCKET, "PARTICLE_FIREWORK", ParticleRequirement.SERVER_TEAM,
new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.FIREWORKS_SPARK, 0, 0, 0, 0.01), 0, 1.1, 0))))
),
WATER_CLOUD_CIRCLE(new ParticleData(Material.CYAN_DYE, "PARTICLE_WATER_FIRE", ParticleRequirement.SERVER_TEAM,
new Cloud(new Circle(new LocationMutator(new SimpleParticle(Particle.WATER_WAKE, 0, 0, 0, 0.01), 0, 1.1, 0))))
),
ENCHANTING_DOUBLE_CIRCLE(new ParticleData(Material.BUBBLE_CORAL_BLOCK, "PARTICLE_ENCHANTING", ParticleRequirement.SERVER_TEAM,
new Always(new LocationMutator(new DoubleCircle(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01)), 0, 2.2, 0)))
),
EVIL_WINGS(new ParticleData(Material.PURPUR_SLAB, "PARTICLE_WINGS_EVIL", ParticleRequirement.SERVER_TEAM,
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.SPELL_WITCH, 0, 0, 0, 0, 1), 0.15, WingDesign.SIMPLE)), 20)))
),
WITCH(new SimpleParticle(new ParticleItem(EXPERIENCE_BOTTLE, "PARTICLE_WITCH", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.SPELL_WITCH)),
ENCHANTING(new SimpleParticle(new ParticleItem(ENCHANTING_TABLE, "PARTICLE_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.ENCHANTMENT_TABLE)),
HAPPY(new SimpleParticle(new ParticleItem(EMERALD_BLOCK, "PARTICLE_HAPPY", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01)),
FLAME(new SimpleParticle(new ParticleItem(FLINT_AND_STEEL, "PARTICLE_FLAME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.FLAME, 0F, 0.2F, 0F, 0.01)),
END_ROD(new SimpleParticle(new ParticleItem(Material.END_ROD, "PARTICLE_END_ROD", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01)),
CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(WHITE_WOOL, "PARTICLE_CLOUD", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.CLOUD))),
TOTEM(new CloudParticle(new SimpleParticle(new ParticleItem(TOTEM_OF_UNDYING, "PARTICLE_TOTEM", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.TOTEM, 0.2F, 0.2F, 0.2F, 0.01))),
ENCHANTING_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(WHITE_DYE, "PARTICLE_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.ENCHANTMENT_TABLE))),
FLAME_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(FIRE_CORAL_BLOCK, "PARTICLE_FLAME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.FLAME))),
SNEEZE_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(LIME_SHULKER_BOX, "PARTICLE_SNEEZE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.SNEEZE))),
SLIME_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(GREEN_SHULKER_BOX, "PARTICLE_SLIME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.SLIME))),
SMOKE_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(DEAD_BRAIN_CORAL_BLOCK, "PARTICLE_SMOKE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.CAMPFIRE_COSY_SMOKE, 0.2F, 0.2F, 0.2F, 0.01))),
TOWN_CLOUD(new CloudParticle(new SimpleParticle(new ParticleItem(FIREWORK_STAR, "PARTICLE_TOWN", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.TOWN_AURA))),
FLAME_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(MAGMA_BLOCK, "PARTICLE_FLAME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.FLAME, 0F, 0F, 0F, 0.01), location -> location.add(0, 1.1, 0)))),
ENCHANTING_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(WHITE_DYE, "PARTICLE_ENCHANTING_CIRCLE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.ENCHANTMENT_TABLE, 0.2F, 0.2F, 0.2F, 0.01), location -> location.add(0, 1.1, 0)))),
NOTES_CIRCLE(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(NOTE_BLOCK, "PARTICLE_NOTES", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.NOTE, 0F, 0F, 0F, 0.01), location -> location.add(0, 2.2, 0)))),
WATER_FIRE(new LocationParticleMutator(new CircleParticle(new ParticleItem(GUARDIAN_SPAWN_EGG, "PARTICLE_WATER_FIRE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), new SimpleParticle(null, Particle.DRIP_WATER, 0.0F, 0.0F, 0.0F, 0.01), new SimpleParticle(null, Particle.DRIP_LAVA, 0.0F, 0.0F, 0.0F, 0.01)), location -> location.add(0, 1.1, 0))),
WATER_FIRE_ALWAYS(new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleItem(MAGMA_CUBE_SPAWN_EGG, "PARTICLE_WATER_FIRE", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), new SimpleParticle(null,Particle.DRIP_WATER, 0.0F, 0.0F, 0.0F, 0.01), new SimpleParticle(null,Particle.DRIP_LAVA, 0.0F, 0.0F, 0.0F, 0.01)), location -> location.add(0, 1.1, 0)))),
MAGIC_ENCHANTING(new LocationParticleMutator(new CircleParticle(new ParticleItem(DIAMOND_SWORD, "PARTICLE_MAGIC_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), new SimpleParticle(null, Particle.CRIT_MAGIC, 0.0F, 0.0F, 0.0F, 0.01), new SimpleParticle(null, Particle.ENCHANTMENT_TABLE, 0.0F, 0.0F, 0.0F, 0.01)), location -> location.add(0, 1.1, 0))),
MAGIC_ENCHANTING_ALWAYS(new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleItem(WOODEN_SWORD, "PARTICLE_MAGIC_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), new SimpleParticle(null, Particle.CRIT_MAGIC, 0.0F, 0.0F, 0.0F, 0.01), new SimpleParticle(null, Particle.ENCHANTMENT_TABLE, 0.0F, 0.0F, 0.0F, 0.01)), location -> location.add(0, 1.1, 0)))),
MAGIC_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(GLOWSTONE_DUST, "PARTICLE_MAGIC", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.CRIT_MAGIC, 0.0F, 0.0F, 0.0F, 0.01), location -> location.add(0, 1.1, 0))))),
FLAME_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(FIRE_CORAL, "PARTICLE_FLAME", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.FLAME, 0.0F, 0.0F, 0.0F, 0.01), location -> location.add(0, 1.1, 0))))),
FIREWORK_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(FIREWORK_ROCKET, "PARTICLE_FIREWORK", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.FIREWORKS_SPARK, 0.0F, 0.0F, 0.0F, 0.01), location -> location.add(0, 1.1, 0))))),
WATER_CLOUD_CIRCLE(new CloudParticle(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(CYAN_DYE, "PARTICLE_WATER", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.WATER_WAKE, 0.0F, 0.0F, 0.0F, 0.01), location -> location.add(0, 1.1, 0))))),
ENCHANTING_DOUBLE_CIRCLE(new TickParticle(new LocationParticleMutator(new CircleParticle(new ParticleItem(BUBBLE_CORAL_BLOCK, "PARTICLE_ENCHANTING", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), new SimpleParticle(null, Particle.ENCHANTMENT_TABLE, 0.0F, 0.0F, 0.0F, 0.01), new SimpleParticle(null, Particle.ENCHANTMENT_TABLE, 0.0F, 0.0F, 0.0F, 0.01)), location -> location.add(0, 2.2, 0)))),
EVIL_WINGS(new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(PURPUR_SLAB, "PARTICLE_WINGS_EVIL", "PARTICLE_UNLOCKED_BY_SERVER_TEAM"), Particle.SPELL_WITCH, 0, 0, 0, 0, 1), 0.15, WingParticle.WingDesign.SIMPLE))),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
private BaseParticle particle;
}

Datei anzeigen

@ -1,50 +1,52 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.particles;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.elements.Circle;
import de.steamwar.lobby.particle.elements.LocationMutator;
import de.steamwar.lobby.particle.elements.NonFloor;
import de.steamwar.lobby.particle.elements.SimpleParticle;
import de.steamwar.lobby.particle.BaseParticle;
import de.steamwar.lobby.particle.ParticleItem;
import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.NonFloorParticle;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
public enum TeamParticle implements ParticleEnum {
SQUID(new ParticleData(Material.INK_SAC, "PARTICLE_SQUID", ParticleRequirement.HAS_TEAM,
new SimpleParticle(Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01))
),
BUBBLE(new ParticleData(Material.TUBE_CORAL, "PARTICLE_BUBBLE", ParticleRequirement.HAS_TEAM,
new SimpleParticle(Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01))
),
HONEY(new ParticleData(Material.HONEY_BOTTLE, "PARTICLE_HONEY", ParticleRequirement.HAS_TEAM,
new SimpleParticle(Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1))
),
NECTAR(new ParticleData(Material.HONEYCOMB, "PARTICLE_NECTAR", ParticleRequirement.HAS_TEAM,
new SimpleParticle(Particle.FALLING_NECTAR, 0.2F, 0.2F, 0.2F, 1))
),
FIREWORK(new ParticleData(Material.FIRE_CHARGE, "PARTICLE_FIREWORK", ParticleRequirement.HAS_TEAM,
new LocationMutator(new NonFloor(new SimpleParticle(Particle.FIREWORKS_SPARK, 0.1F, 0.1F, 0.1F, 0.2, 2)), 0, -0.2, 0))
),
DRAGON_BREATH(new ParticleData(Material.DRAGON_BREATH, "PARTICLE_DRAGON_BREATH", ParticleRequirement.HAS_TEAM,
new SimpleParticle(Particle.DRAGON_BREATH, 1F, 0.2F, 1F, 0.01))
),
DAMAGE(new ParticleData(Material.SPIDER_EYE, "PARTICLE_DAMAGE", ParticleRequirement.HAS_TEAM,
new SimpleParticle(Particle.DAMAGE_INDICATOR, 0.2F, 0, 0.2F, 0.01))
),
DOLPHIN(new ParticleData(Material.BLUE_DYE, "PARTICLE_DOLPHIN", ParticleRequirement.HAS_TEAM,
new SimpleParticle(Particle.DOLPHIN, 0.2F, 0, 0.2F, 0.01))
),
HEART(new ParticleData(Material.RED_CONCRETE, "PARTICLE_HEART", ParticleRequirement.HAS_TEAM,
new Circle(new LocationMutator(new SimpleParticle(Particle.HEART), 0, 2.2, 0)))
),
SQUID(new SimpleParticle(new ParticleItem(INK_SAC, "PARTICLE_SQUID", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01)),
BUBBLE(new SimpleParticle(new ParticleItem(TUBE_CORAL, "PARTICLE_BUBBLE", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01)),
HONEY(new SimpleParticle(new ParticleItem(HONEY_BOTTLE, "PARTICLE_HONEY", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1)),
NECTAR(new SimpleParticle(new ParticleItem(HONEYCOMB, "PARTICLE_NECTAR", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.FALLING_NECTAR, 0.2F, 0.2F, 0.2F, 1)),
FIREWORK(new LocationParticleMutator(new NonFloorParticle(new SimpleParticle(new ParticleItem(FIRE_CHARGE, "PARTICLE_FIREWORK", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.FIREWORKS_SPARK, 0.1F, 0.1F, 0.1F, 0.2, 2)), location -> location.subtract(0, -0.2, 0))),
DRAGON_BREATH(new SimpleParticle(new ParticleItem(Material.DRAGON_BREATH, "PARTICLE_DRAGON_BREATH", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.DRAGON_BREATH, 1F, 0.2F, 1F, 0.01)),
DAMAGE(new SimpleParticle(new ParticleItem(SPIDER_EYE, "PARTICLE_DAMAGE", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)),
DOLPHIN(new SimpleParticle(new ParticleItem(BLUE_DYE, "PARTICLE_DOLPHIN", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.DOLPHIN, 0.2F, 0F, 0.2F, 0.01)),
HEART(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(RED_CONCRETE, "PARTICLE_HEART", "PARTICLE_UNLOCKED_BY_TEAM"), Particle.HEART), location -> location.add(0, 2.2, 0)))),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
private BaseParticle particle;
}

Datei anzeigen

@ -1,47 +0,0 @@
package de.steamwar.lobby.particle.particles.custom;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.WingDesign;
import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.elements.custom.HearthBeat;
import de.steamwar.lobby.particle.elements.custom.NonMoving;
import de.steamwar.lobby.particle.elements.custom.PulseShimmer;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
@AllArgsConstructor
public enum CustomEasterParticle implements ParticleEnum {
/*
Lord_Loading(new ParticleData(Material.ENDER_PEARL, "Loading Test", ParticleRequirement.easterEventSpecificPlayer(1063),
new Always(new DoubleCircle(new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1),
new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1), 0.5, 4),
new DoubleCircle(new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1),
new SimpleParticle(Particle.CRIT_MAGIC, 0, 0, 0, 0.01, 1), 0.5, 4), 1.5, 1)))
),
*/
Rongamer99091(new ParticleData(Material.GUNPOWDER, "PARTICLE_PLAYER_RONGAMER99091_AURA", ParticleRequirement.easterEventSpecificPlayer(10697),
new Always(new Sneaking(new Group(
new OnlySelf(new Delayed(new SimpleParticle(Particle.EXPLOSION_HUGE, 0, 0, 0, 0.01, 1), 20)),
new OnlyOthers(new Delayed(new SimpleParticle(Particle.EXPLOSION_HUGE, 0, 0, 0, 0.01, 1), 2))
))))
),
Plompa(new ParticleData(Material.PUFFERFISH_BUCKET, "PARTICLE_PLAYER_PLOMPA", ParticleRequirement.specificPlayer(64),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 0.15, WingDesign.PlompaEasterWings)), 80)))
),
Pulse_EASTER_1(new ParticleData(Material.RED_CANDLE, "PARTICLE_TEAM_PULSE_AURA_1", ParticleRequirement.easterEventSpecificTeam(210),
new Always(new NonMoving(new PulseShimmer(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0, 1), 80, 2))))
),
Pulse_EASTER_3(new ParticleData(Material.APPLE, "PARTICLE_TEAM_PULSE_HEART_BEAT", ParticleRequirement.easterEventSpecificTeam(210),
new Always(new NonFlying(new HearthBeat(new SimpleParticle(Particle.FLAME, 0, 0, 0, 0, 1), 80))))
),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
}

Datei anzeigen

@ -1,28 +0,0 @@
package de.steamwar.lobby.particle.particles.custom;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.elements.custom.NonMoving;
import de.steamwar.lobby.particle.elements.custom.YOffset;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
@AllArgsConstructor
public enum CustomPlayerParticle implements ParticleEnum {
Haylim_(new ParticleData(Material.WHITE_CANDLE, "PARTICLE_PLAYER_HAYLIM_AURA", ParticleRequirement.specificPlayer(9426),
new Always(new NonMoving(new NonFlying(new Group(
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01, 5), 40, 0, 2, false), new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.0,5), 40, 0, 2, true)),
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01, 5), 40, 0, 2, true), new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.0,5), 40, 0, 2, false))
)))))
),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
}

Datei anzeigen

@ -1,35 +0,0 @@
package de.steamwar.lobby.particle.particles.custom;
import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleEnum;
import de.steamwar.lobby.particle.ParticleRequirement;
import de.steamwar.lobby.particle.WingDesign;
import de.steamwar.lobby.particle.elements.*;
import de.steamwar.lobby.particle.elements.custom.NonMoving;
import de.steamwar.lobby.particle.elements.custom.PulseShimmer;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
@AllArgsConstructor
public enum CustomTeamParticle implements ParticleEnum {
Eclipse(new ParticleData(Material.ENDER_CHEST, "PARTICLE_EVENT_ENCHANTING", ParticleRequirement.specificTeam(34),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 0.15, WingDesign.ECLIPSE)), 80)))
),
Pulse_1(new ParticleData(Material.GRAY_CANDLE, "PARTICLE_TEAM_PULSE_AURA_2", ParticleRequirement.specificTeam(210),
new Always(new NonMoving(new PulseShimmer(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 80, 2))))
),
Pulse_2(new ParticleData(Material.WHITE_CANDLE, "PARTICLE_TEAM_PULSE_AURA_3", ParticleRequirement.specificTeam(210),
new Always(new NonMoving(new PulseShimmer(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0, 5), 80, 2))))
),
Pulse_Logo(new ParticleData(Material.ENDER_CHEST, "PARTICLE_TEAM_PULSE_LOGO", ParticleRequirement.specificTeam(210),
new Always(new Delayed(new NonFlying(new Wing(new SimpleParticle(Particle.END_ROD, 0, 0, 0, 0, 1), 0.15, WingDesign.PL)), 80)))
),
;
public static ParticleEnum[] particles = values();
@Getter
private ParticleData particle;
}

Datei anzeigen

@ -19,16 +19,14 @@
package de.steamwar.lobby.portal;
import de.steamwar.comms.packets.ExecuteCommandPacket;
import de.steamwar.lobby.LobbySystem;
import de.steamwar.lobby.command.ModifyCommand;
import de.steamwar.lobby.listener.Portals;
import de.steamwar.network.NetworkSender;
import de.steamwar.network.packets.client.ExecuteCommandPacket;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.Iterator;
import java.util.Deque;
import java.util.Map;
import java.util.logging.Level;
@ -56,16 +54,16 @@ public class CommandPortal implements PortalHandler {
maxId = stackIds[i-1];
}
Iterator<Portal> stack = Portals.getStack(player).iterator();
Deque<Portal> stack = Portals.getStack(player);
String[] pieces = new String[stackIds.length];
while (maxId > 0) {
if(!stack.hasNext()) {
if(stack.isEmpty()) {
LobbySystem.getPlugin().getLogger().log(Level.WARNING, "Stackportal with missing elements: " + player.getName() + " /" + command);
player.sendMessage("§cEigentlich solltest du gerade gar nicht durch dieses Portal durchgehen können...");
return;
}
Portal portal = stack.next();
Portal portal = stack.pop();
if(portal.type() == PortalType.STACK) {
for(int i = 0; i < stackIds.length; i++) {
if(stackIds[i] == maxId) {
@ -84,7 +82,7 @@ public class CommandPortal implements PortalHandler {
if(ModifyCommand.modifying(player))
player.sendMessage("/" + cmd);
NetworkSender.send(new ExecuteCommandPacket(SteamwarUser.get(player.getUniqueId()).getId(), cmd.toString()));
new ExecuteCommandPacket(player, cmd.toString()).send(player);
}
@Override
@ -101,9 +99,4 @@ public class CommandPortal implements PortalHandler {
public void delete() {
// Nothing to remove
}
@Override
public String toString() {
return "Command: /" + command;
}
}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen