EasterEggHunt #27
@ -27,6 +27,8 @@ import de.steamwar.lobby.command.PortalCommand;
|
||||
import de.steamwar.lobby.jumpandrun.JumpAndRun;
|
||||
import de.steamwar.lobby.listener.*;
|
||||
import de.steamwar.lobby.map.CustomMapCommand;
|
||||
import de.steamwar.lobby.particle.ParticleListener;
|
||||
import de.steamwar.lobby.special.easter.EggHunt;
|
||||
import de.steamwar.lobby.team.TeamPlayer;
|
||||
import de.steamwar.message.Message;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -71,6 +73,8 @@ public class LobbySystem extends JavaPlugin {
|
||||
new TeleporterListener();
|
||||
new TeamPlayer();
|
||||
|
||||
EggHunt.init();
|
||||
|
||||
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);
|
||||
@ -80,7 +84,6 @@ public class LobbySystem extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
TeamPlayer.cleanup();
|
||||
}
|
||||
|
||||
public static LobbySystem getPlugin() {
|
||||
|
@ -18,23 +18,34 @@ PORTAL_NO_WORLDEDIT_SELECTION = §cNo WorldEdit selection
|
||||
# Particle
|
||||
PARTICLE_INVENTORY = §6Particle
|
||||
PARTICLE_DESELECT = §8No particle
|
||||
PARTICLE_LOCKED = {0} §8- §c§lLocked
|
||||
|
||||
PARTICLE_UNLOCKED_BY_TEAM = §fJoin the team
|
||||
PARTICLE_UNLOCKED_BY = §eUnlocked by
|
||||
PARTICLE_UNLOCKED_BY_TEAM = §fJoin a team
|
||||
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0}
|
||||
PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0}
|
||||
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_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 = §eAttributes§7:
|
||||
|
||||
PARTICLE_UNLOCKED_BY = §eUnlocked by
|
||||
PARTICLE_ATTRIBUTE_SNEAKING = §8-§f Sneaking
|
||||
PARTICLE_ATTRIBUTE_NON_MOVING = §8-§f Not moving
|
||||
PARTICLE_ATTRIBUTE_SEPARATOR = §f
|
||||
|
||||
PARTICLE_SELECT = §eClick to select
|
||||
PARTICLE_LOCKED = §c§lLocked
|
||||
|
||||
PARTICLE_SNEEZE = §aSneeze
|
||||
PARTICLE_SMOKE = §7Smoke
|
||||
@ -71,8 +82,7 @@ PARTICLE_WATER_FIRE = §bWater§7/§cFire
|
||||
PARTICLE_MAGIC_ENCHANTING = §5Magic/Enchantment
|
||||
PARTICLE_WINGS_EVIL = §5Purple wings
|
||||
|
||||
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. or 3. Place
|
||||
PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION = §f{0}
|
||||
PARTICLE_PLAYER_HAYLIM_AURA = §fHaylim\'s Aura
|
||||
|
||||
PARTICLE_EVENT_ENCHANTING = §cEnchantment
|
||||
PARTICLE_EVENT_CLOUD = §fClouds
|
||||
@ -83,7 +93,127 @@ PARTICLE_EVENT_RAIN_CLOUD = §fRaincloud
|
||||
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
|
||||
|
||||
# Easter Egg Hunt
|
||||
DIFFICULTY_EASY = §aEasy
|
||||
DIFFICULTY_MEDIUM = §eMedium
|
||||
DIFFICULTY_HARD = §cHard
|
||||
DIFFICULTY_EXTREME = §5Extreme
|
||||
DIFFICULTY_ADVANCED = §5Advanced
|
||||
|
||||
EASTER_EGG_MENU = §0Easter Egg Hunt
|
||||
|
||||
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
|
@ -18,23 +18,33 @@ PORTAL_NO_WORLDEDIT_SELECTION = §cKeine WorldEdit Selection
|
||||
# Particle
|
||||
PARTICLE_INVENTORY = §6Partikel
|
||||
PARTICLE_DESELECT = §8Keine Partikel
|
||||
PARTICLE_LOCKED = {0} §8- §c§lGesperrt
|
||||
|
||||
PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch
|
||||
PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt
|
||||
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0}
|
||||
PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0}
|
||||
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 Luft
|
||||
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_UNLOCKED_BY = §eFreigeschaltet durch
|
||||
|
||||
PARTICLE_SELECT = §eZum Auswählen klicken
|
||||
PARTICLE_LOCKED = §c§lGesperrt
|
||||
|
||||
PARTICLE_SNEEZE = §aSneeze
|
||||
PARTICLE_SMOKE = §7Rauch
|
||||
@ -71,11 +81,6 @@ PARTICLE_WATER_FIRE = §bWasser§7/§cFeuer
|
||||
PARTICLE_MAGIC_ENCHANTING = §5Magie§7/§eZauber
|
||||
PARTICLE_WINGS_EVIL = §5Lila Flügel
|
||||
|
||||
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz
|
||||
PARTICLE_UNLOCKED_BY_EVENT_PARTICIPATION = §f{0}
|
||||
|
||||
JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails
|
||||
|
||||
PARTICLE_EVENT_ENCHANTING = §cVerzaubert
|
||||
PARTICLE_EVENT_CLOUD = §fWolken
|
||||
PARTICLE_EVENT_SMOKE = §7Rauch
|
||||
@ -84,3 +89,125 @@ 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
|
||||
|
||||
# Easter Egg Hunt
|
||||
DIFFICULTY_EASY = §aLeicht
|
||||
DIFFICULTY_MEDIUM = §eMedium
|
||||
DIFFICULTY_HARD = §cHart
|
||||
DIFFICULTY_EXTREME = §5Extrem
|
||||
DIFFICULTY_ADVANCED = §5Advanced
|
||||
|
||||
EASTER_EGG_MENU = §0Oster Eierer Suche
|
||||
|
||||
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
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* 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 -> {});
|
||||
}
|
||||
}
|
@ -1,54 +1,76 @@
|
||||
/*
|
||||
* 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 lombok.AllArgsConstructor;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ParticleData {
|
||||
private final World world;
|
||||
private final Player player;
|
||||
private Location location;
|
||||
private final double deg;
|
||||
|
||||
public ParticleData withLocation(Location location) {
|
||||
ParticleData particleData = copy();
|
||||
particleData.location = location;
|
||||
return particleData;
|
||||
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 Location getLocation() {
|
||||
if (location == null) {
|
||||
return player.getLocation();
|
||||
}
|
||||
return location;
|
||||
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 ParticleData copy() {
|
||||
return new ParticleData(world, player, location, deg);
|
||||
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 -> {});
|
||||
}
|
||||
}
|
||||
|
44
src/de/steamwar/lobby/particle/ParticleElement.java
Normale Datei
44
src/de/steamwar/lobby/particle/ParticleElement.java
Normale Datei
@ -0,0 +1,44 @@
|
||||
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, Consumer<Player> consumer) {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
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);
|
||||
}
|
5
src/de/steamwar/lobby/particle/ParticleEnum.java
Normale Datei
5
src/de/steamwar/lobby/particle/ParticleEnum.java
Normale Datei
@ -0,0 +1,5 @@
|
||||
package de.steamwar.lobby.particle;
|
||||
|
||||
public interface ParticleEnum {
|
||||
ParticleData getParticle();
|
||||
}
|
@ -1,34 +1,19 @@
|
||||
/*
|
||||
* 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.Event;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -38,49 +23,56 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@UtilityClass
|
||||
public class ParticleInventory {
|
||||
|
||||
private ParticleInventory() {
|
||||
private final Class<?>[] PARTICLES = {
|
||||
PlayerParticle.class,
|
||||
CustomPlayerParticle.class,
|
||||
TeamParticle.class,
|
||||
CustomTeamParticle.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 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));
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (clazz != null) {
|
||||
try {
|
||||
return (ParticleEnum) Enum.valueOf((Class<? extends Enum>) clazz, split[1]);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// TODO: Add conversion from last version
|
||||
return null;
|
||||
}
|
||||
|
||||
private static SWInventory createInventory(Player player) {
|
||||
public void openInventory(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);
|
||||
|
||||
List<SWListInv.SWListEntry<ParticleEnum>> particleList = new ArrayList<>();
|
||||
calculateParticles(PlayerParticle.particles, player, particleList);
|
||||
if (steamwarUser.getTeam() != 0 || userGroup != UserGroup.Member) {
|
||||
calculateParticles(TeamParticle.particles, player, particleList);
|
||||
}
|
||||
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);
|
||||
}
|
||||
for (SpecialTeamParticle particle : SpecialTeamParticle.particles) {
|
||||
if (particle.getTeamId() == 0 || steamwarUser.getTeam() == particle.getTeamId() || steamwarUser.getUserGroup() != UserGroup.Member) {
|
||||
addParticle(particleList, particle, true, player);
|
||||
}
|
||||
for (Class<?> clazz : PARTICLES) {
|
||||
addParticles(particleList, (ParticleEnum[]) clazz.getEnumConstants(), player, user, events, eggHuntConfig);
|
||||
}
|
||||
|
||||
SWListInv<ParticleEnum> particleSWListInv = new SWListInv<>(player, LobbySystem.getMessage().parse("PARTICLE_INVENTORY", player), false, particleList, (clickType, particle) -> {
|
||||
@ -91,29 +83,18 @@ public class ParticleInventory {
|
||||
particleSWListInv.setItem(49, Material.BARRIER, LobbySystem.getMessage().parse("PARTICLE_DESELECT", player), new ArrayList<>(), false, clickType -> {
|
||||
lobbyPlayer.setParticle(null);
|
||||
});
|
||||
|
||||
return particleSWListInv;
|
||||
particleSWListInv.open();
|
||||
}
|
||||
|
||||
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));
|
||||
private void addParticles(List<SWListInv.SWListEntry<ParticleEnum>> particleList, ParticleEnum[] particleEnums, Player player, 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 {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* 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 -> {});
|
||||
}
|
||||
}
|
@ -17,14 +17,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.lobby.listener;
|
||||
package de.steamwar.lobby.particle;
|
||||
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.jumpandrun.JumpAndRun;
|
||||
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.listener.BasicListener;
|
||||
import de.steamwar.lobby.listener.PlayerSpawn;
|
||||
import de.steamwar.lobby.util.LobbyPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -33,6 +31,10 @@ 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.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ParticleListener extends BasicListener {
|
||||
|
||||
@ -40,9 +42,14 @@ public class ParticleListener extends BasicListener {
|
||||
|
||||
private static double deg = 0;
|
||||
|
||||
private static Set<Player> movingPlayers = new HashSet<>();
|
||||
|
||||
public ParticleListener() {
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
|
||||
if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) return;
|
||||
if (Bukkit.getOnlinePlayers().size() > PLAYER_MAX_SIZE) {
|
||||
movingPlayers.clear();
|
||||
return;
|
||||
}
|
||||
deg += 0.1;
|
||||
if (deg > 360) deg = 0;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
@ -50,11 +57,13 @@ public class ParticleListener extends BasicListener {
|
||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||
ParticleEnum particle = lobbyPlayer.getParticle();
|
||||
if (particle == null) return;
|
||||
BaseParticle baseParticle = particle.getParticle();
|
||||
if (baseParticle.needsTick()) {
|
||||
baseParticle.particle(new ParticleData(player.getWorld(), player, deg));
|
||||
ParticleData particleData = particle.getParticle();
|
||||
ParticleElement particleElement = particleData.getParticleElement();
|
||||
if (particleElement.tickType() == ParticleTickType.ALWAYS) {
|
||||
particleElement.tick(new ParticleTickData(player.getWorld(), player, deg, movingPlayers.contains(player)));
|
||||
}
|
||||
});
|
||||
movingPlayers.clear();
|
||||
}, 0, 1);
|
||||
}
|
||||
|
||||
@ -66,7 +75,7 @@ public class ParticleListener extends BasicListener {
|
||||
if (!PlayerSpawn.PARTICLE.equals(event.getItem())) return;
|
||||
event.setCancelled(true);
|
||||
|
||||
ParticleInventory.openParticleInventory(player);
|
||||
ParticleInventory.openInventory(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -78,9 +87,19 @@ public class ParticleListener extends BasicListener {
|
||||
ParticleEnum particle = lobbyPlayer.getParticle();
|
||||
if (particle == null) return;
|
||||
|
||||
BaseParticle baseParticle = particle.getParticle();
|
||||
if (baseParticle.needsTick()) return;
|
||||
baseParticle.particle(new ParticleData(player.getWorld(), player, deg));
|
||||
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.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
movingPlayers.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
199
src/de/steamwar/lobby/particle/ParticleRequirement.java
Normale Datei
199
src/de/steamwar/lobby/particle/ParticleRequirement.java
Normale Datei
@ -0,0 +1,199 @@
|
||||
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.Event;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.Team;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
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.getUserGroup() != UserGroup.Member;
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
37
src/de/steamwar/lobby/particle/ParticleTickData.java
Normale Datei
37
src/de/steamwar/lobby/particle/ParticleTickData.java
Normale Datei
@ -0,0 +1,37 @@
|
||||
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;
|
||||
|
||||
public ParticleTickData withLocation(Location location) {
|
||||
ParticleTickData particleTickData = copy();
|
||||
particleTickData.location = location;
|
||||
return particleTickData;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
if (location == null) {
|
||||
return player.getLocation();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
public ParticleTickData copy() {
|
||||
return new ParticleTickData(world, player, location, deg, isMoving);
|
||||
}
|
||||
}
|
8
src/de/steamwar/lobby/particle/ParticleTickType.java
Normale Datei
8
src/de/steamwar/lobby/particle/ParticleTickType.java
Normale Datei
@ -0,0 +1,8 @@
|
||||
package de.steamwar.lobby.particle;
|
||||
|
||||
public enum ParticleTickType {
|
||||
|
||||
ALWAYS,
|
||||
MOVE,
|
||||
;
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
53
src/de/steamwar/lobby/particle/WingDesign.java
Normale Datei
53
src/de/steamwar/lobby/particle/WingDesign.java
Normale Datei
@ -0,0 +1,53 @@
|
||||
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"));
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* 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.LobbySystem;
|
||||
import de.steamwar.lobby.particle.BaseParticle;
|
||||
import de.steamwar.lobby.particle.ParticleData;
|
||||
import de.steamwar.lobby.particle.ParticleItem;
|
||||
import lombok.SneakyThrows;
|
||||
import org.bukkit.Bukkit;
|
||||
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"),
|
||||
MWGL("MWGL.png"),
|
||||
ECLIPSE("ECLIPSE-Logo.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;
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, LobbySystem.getPlugin());
|
||||
}
|
||||
|
||||
@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);
|
||||
});
|
||||
}
|
||||
}
|
27
src/de/steamwar/lobby/particle/elements/Always.java
Normale Datei
27
src/de/steamwar/lobby/particle/elements/Always.java
Normale Datei
@ -0,0 +1,27 @@
|
||||
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);
|
||||
}
|
||||
}
|
28
src/de/steamwar/lobby/particle/elements/Circle.java
Normale Datei
28
src/de/steamwar/lobby/particle/elements/Circle.java
Normale Datei
@ -0,0 +1,28 @@
|
||||
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 {
|
||||
|
||||
public Circle(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_CIRCLE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
Location location = particleTickData.getLocation();
|
||||
|
||||
Vector vector = new Vector(1, 0, 0);
|
||||
vector.rotateAroundY(particleTickData.getDeg());
|
||||
ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
|
||||
particleElement.tick(nParticleTickData);
|
||||
}
|
||||
}
|
31
src/de/steamwar/lobby/particle/elements/Cloud.java
Normale Datei
31
src/de/steamwar/lobby/particle/elements/Cloud.java
Normale Datei
@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
}
|
52
src/de/steamwar/lobby/particle/elements/Delayed.java
Normale Datei
52
src/de/steamwar/lobby/particle/elements/Delayed.java
Normale Datei
@ -0,0 +1,52 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
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();
|
||||
}
|
||||
}
|
47
src/de/steamwar/lobby/particle/elements/DoubleCircle.java
Normale Datei
47
src/de/steamwar/lobby/particle/elements/DoubleCircle.java
Normale Datei
@ -0,0 +1,47 @@
|
||||
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;
|
||||
|
||||
public DoubleCircle(ParticleElement first, ParticleElement second) {
|
||||
super(first);
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_BI_CIRCLE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleTickType tickType() {
|
||||
if (particleElement.tickType() == second.tickType()) {
|
||||
return particleElement.tickType();
|
||||
}
|
||||
// TODO: This could be improved but I will not do it
|
||||
return ParticleTickType.MOVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
Location location = particleTickData.getLocation();
|
||||
|
||||
Vector vector = new Vector(1, 0, 0);
|
||||
vector.rotateAroundY(particleTickData.getDeg());
|
||||
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);
|
||||
}
|
||||
}
|
44
src/de/steamwar/lobby/particle/elements/DustParticle.java
Normale Datei
44
src/de/steamwar/lobby/particle/elements/DustParticle.java
Normale Datei
@ -0,0 +1,44 @@
|
||||
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, player -> {
|
||||
player.spawnParticle(particle, location, count, vx, vy, vz, speed, randomParticleDust());
|
||||
});
|
||||
}
|
||||
}
|
23
src/de/steamwar/lobby/particle/elements/Floor.java
Normale Datei
23
src/de/steamwar/lobby/particle/elements/Floor.java
Normale Datei
@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
24
src/de/steamwar/lobby/particle/elements/Flying.java
Normale Datei
24
src/de/steamwar/lobby/particle/elements/Flying.java
Normale Datei
@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
36
src/de/steamwar/lobby/particle/elements/Group.java
Normale Datei
36
src/de/steamwar/lobby/particle/elements/Group.java
Normale Datei
@ -0,0 +1,36 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
32
src/de/steamwar/lobby/particle/elements/LocationMutator.java
Normale Datei
32
src/de/steamwar/lobby/particle/elements/LocationMutator.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
23
src/de/steamwar/lobby/particle/elements/NonFloor.java
Normale Datei
23
src/de/steamwar/lobby/particle/elements/NonFloor.java
Normale Datei
@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
24
src/de/steamwar/lobby/particle/elements/NonFlying.java
Normale Datei
24
src/de/steamwar/lobby/particle/elements/NonFlying.java
Normale Datei
@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
18
src/de/steamwar/lobby/particle/elements/Separator.java
Normale Datei
18
src/de/steamwar/lobby/particle/elements/Separator.java
Normale Datei
@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
}
|
66
src/de/steamwar/lobby/particle/elements/SimpleParticle.java
Normale Datei
66
src/de/steamwar/lobby/particle/elements/SimpleParticle.java
Normale Datei
@ -0,0 +1,66 @@
|
||||
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, player -> {
|
||||
if (customVelocity) {
|
||||
player.spawnParticle(particle, location, count, vx, vy, vz, time);
|
||||
} else {
|
||||
player.spawnParticle(particle, location, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
24
src/de/steamwar/lobby/particle/elements/Sneaking.java
Normale Datei
24
src/de/steamwar/lobby/particle/elements/Sneaking.java
Normale Datei
@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
37
src/de/steamwar/lobby/particle/elements/Wing.java
Normale Datei
37
src/de/steamwar/lobby/particle/elements/Wing.java
Normale Datei
@ -0,0 +1,37 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
25
src/de/steamwar/lobby/particle/elements/custom/NonMoving.java
Normale Datei
25
src/de/steamwar/lobby/particle/elements/custom/NonMoving.java
Normale Datei
@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
47
src/de/steamwar/lobby/particle/elements/custom/YOffset.java
Normale Datei
47
src/de/steamwar/lobby/particle/elements/custom/YOffset.java
Normale Datei
@ -0,0 +1,47 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
51
src/de/steamwar/lobby/particle/particles/EasterParticle.java
Normale Datei
51
src/de/steamwar/lobby/particle/particles/EasterParticle.java
Normale Datei
@ -0,0 +1,51 @@
|
||||
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;
|
||||
}
|
@ -1,46 +1,29 @@
|
||||
/*
|
||||
* 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.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 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 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 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))))),
|
||||
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))))
|
||||
),
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
@Getter
|
||||
private BaseParticle particle;
|
||||
private ParticleData particle;
|
||||
}
|
||||
|
@ -1,56 +1,45 @@
|
||||
/*
|
||||
* 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.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 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 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(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),
|
||||
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 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.2, 0)), 0, 2.2, 0)))
|
||||
),
|
||||
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)))
|
||||
),
|
||||
;
|
||||
public static EventParticleParticipation[] particles = values();
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
private int event;
|
||||
private BaseParticle particle;
|
||||
@Getter
|
||||
private ParticleData particle;
|
||||
}
|
||||
|
@ -1,57 +1,51 @@
|
||||
/*
|
||||
* 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.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 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 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(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.15, WingParticle.WingDesign.MWGL))),
|
||||
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[]{285, 210, 122}, 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))),
|
||||
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(31, 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)))
|
||||
),
|
||||
;
|
||||
public static EventParticlePlacement[] particles = values();
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
private int event;
|
||||
private int[] placementTeams;
|
||||
private BaseParticle particle;
|
||||
@Getter
|
||||
private ParticleData particle;
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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.BaseParticle;
|
||||
|
||||
public interface ParticleEnum {
|
||||
BaseParticle getParticle();
|
||||
}
|
@ -1,56 +1,63 @@
|
||||
/*
|
||||
* 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.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 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 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 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)),
|
||||
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))
|
||||
),
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
@Getter
|
||||
private BaseParticle particle;
|
||||
private ParticleData particle;
|
||||
}
|
||||
|
@ -1,71 +1,99 @@
|
||||
/*
|
||||
* 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.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 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 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 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))),
|
||||
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)))
|
||||
),
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
@Getter
|
||||
private BaseParticle particle;
|
||||
private ParticleData particle;
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.BaseParticle;
|
||||
import de.steamwar.lobby.particle.ParticleItem;
|
||||
import de.steamwar.lobby.particle.SimpleParticle;
|
||||
import de.steamwar.lobby.particle.decorator.TickParticle;
|
||||
import de.steamwar.lobby.particle.decorator.WingParticle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Particle;
|
||||
|
||||
import static org.bukkit.Material.ENDER_CHEST;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SpecialTeamParticle implements ParticleEnum {
|
||||
|
||||
Eclipse(34, new TickParticle(new WingParticle(new SimpleParticle(new ParticleItem(ENDER_CHEST, "PARTICLE_EVENT_ENCHANTING"), Particle.PORTAL, 0.0F, 0.0F, 0.0F, 0.01), 0.15, WingParticle.WingDesign.ECLIPSE))),
|
||||
;
|
||||
public static SpecialTeamParticle[] particles = values();
|
||||
|
||||
private int teamId;
|
||||
private BaseParticle particle;
|
||||
}
|
@ -1,52 +1,50 @@
|
||||
/*
|
||||
* 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.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 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 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 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)))),
|
||||
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)))
|
||||
),
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
@Getter
|
||||
private BaseParticle particle;
|
||||
private ParticleData particle;
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package de.steamwar.lobby.particle.particles.custom;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleData;
|
||||
import de.steamwar.lobby.particle.ParticleEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum CustomEasterParticle implements ParticleEnum {
|
||||
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
@Getter
|
||||
private ParticleData particle;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
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), 40, 0, 2, false), new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.0,1), 40, 0, 2, true)),
|
||||
new DoubleCircle(new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.01), 40, 0, 2, true), new YOffset(new SimpleParticle(Particle.ENCHANTMENT_TABLE, 0, 0, 0, 0.0,1), 40, 0, 2, false))
|
||||
)))))
|
||||
),
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
@Getter
|
||||
private ParticleData particle;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
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 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.PORTAL, 0, 0, 0, 0.01), 0.15, WingDesign.ECLIPSE)), 20)))
|
||||
),
|
||||
;
|
||||
public static ParticleEnum[] particles = values();
|
||||
|
||||
@Getter
|
||||
private ParticleData particle;
|
||||
}
|
102
src/de/steamwar/lobby/special/easter/Egg.java
Normale Datei
102
src/de/steamwar/lobby/special/easter/Egg.java
Normale Datei
@ -0,0 +1,102 @@
|
||||
package de.steamwar.lobby.special.easter;
|
||||
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.profile.PlayerProfile;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Egg {
|
||||
|
||||
private static final World world = Bukkit.getWorlds().get(0);
|
||||
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
private final String message;
|
||||
private final EggDifficulty difficulty;
|
||||
|
||||
private Optional<PlayerProfile> playerProfile = null;
|
||||
|
||||
public Egg(Map<String, ?> config) {
|
||||
this.x = (int) config.get("x");
|
||||
this.y = (int) config.get("y");
|
||||
this.z = (int) config.get("z");
|
||||
this.message = (String) config.get("name");
|
||||
this.difficulty = EggDifficulty.valueOf(((String) config.get("difficulty")).toUpperCase());
|
||||
}
|
||||
|
||||
public Vector getVector() {
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public EggDifficulty getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
if (block.getType() != Material.PLAYER_HEAD && block.getType() != Material.PLAYER_WALL_HEAD) {
|
||||
System.out.println("Block is not a skull: " + block.getType() + " " + x + "," + y + "," + z);
|
||||
return null;
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
public SWItem getItem(Player player, boolean found) {
|
||||
if (playerProfile == null) {
|
||||
Block block = getBlock();
|
||||
if (block == null) {
|
||||
playerProfile = Optional.empty();
|
||||
return null;
|
||||
}
|
||||
|
||||
Skull skull = (Skull) block.getState();
|
||||
PlayerProfile playerProfile = skull.getOwnerProfile();
|
||||
if (playerProfile == null) {
|
||||
this.playerProfile = Optional.empty();
|
||||
return null;
|
||||
}
|
||||
this.playerProfile = Optional.of(playerProfile);
|
||||
}
|
||||
|
||||
if (!playerProfile.isPresent()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SWItem swItem;
|
||||
if (found) {
|
||||
swItem = new SWItem();
|
||||
ItemStack itemStack = new ItemStack(Material.PLAYER_HEAD);
|
||||
SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
skullMeta.setOwnerProfile(playerProfile.get());
|
||||
itemStack.setItemMeta(skullMeta);
|
||||
swItem.setItemStack(itemStack);
|
||||
} else {
|
||||
swItem = SWItem.getPlayerSkull("MHF_Question");
|
||||
}
|
||||
|
||||
swItem.setLore(Arrays.asList(LobbySystem.getMessage().parse(difficulty.getMessage(), player)));
|
||||
try {
|
||||
swItem.setName("§f" + LobbySystem.getMessage().parse(message, player));
|
||||
} catch (Exception e) {
|
||||
swItem.setName("§f" + message);
|
||||
}
|
||||
return swItem;
|
||||
}
|
||||
}
|
64
src/de/steamwar/lobby/special/easter/EggClickListener.java
Normale Datei
64
src/de/steamwar/lobby/special/easter/EggClickListener.java
Normale Datei
@ -0,0 +1,64 @@
|
||||
package de.steamwar.lobby.special.easter;
|
||||
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.listener.BasicListener;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
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.util.Vector;
|
||||
|
||||
public class EggClickListener extends BasicListener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
Block block = event.getClickedBlock();
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
Vector vector = block.getLocation().toVector();
|
||||
Egg egg = null;
|
||||
int index = -1;
|
||||
for (Egg egg1 : EggHunt.getEggList()) {
|
||||
index++;
|
||||
if (egg1.getVector().equals(vector)) {
|
||||
egg = egg1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (egg == null) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
String found = UserConfig.getConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY);
|
||||
if (found == null) {
|
||||
found = "";
|
||||
}
|
||||
StringBuilder builder = new StringBuilder(found);
|
||||
while (builder.length() <= index) {
|
||||
builder.append("0");
|
||||
}
|
||||
if (builder.charAt(index) == '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
player.sendTitle(LobbySystem.getMessage().parse(egg.getDifficulty().getMessage(), player), LobbySystem.getMessage().parse(egg.getMessage(), player), 0, 40, 5);
|
||||
} catch (Exception e) {
|
||||
player.sendTitle(LobbySystem.getMessage().parse(egg.getDifficulty().getMessage(), player), egg.getMessage(), 0, 40, 5);
|
||||
}
|
||||
|
||||
player.spawnParticle(Particle.END_ROD, block.getLocation().add(0.5, 0.5, 0.5), 10, 0.5, 0.5, 0.5, 0.1);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.25f, 1.0f);
|
||||
|
||||
builder.setCharAt(index, '1');
|
||||
UserConfig.updatePlayerConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY, builder.toString());
|
||||
}
|
||||
}
|
19
src/de/steamwar/lobby/special/easter/EggDifficulty.java
Normale Datei
19
src/de/steamwar/lobby/special/easter/EggDifficulty.java
Normale Datei
@ -0,0 +1,19 @@
|
||||
package de.steamwar.lobby.special.easter;
|
||||
|
||||
public enum EggDifficulty {
|
||||
EASY("DIFFICULTY_EASY"),
|
||||
MEDIUM("DIFFICULTY_MEDIUM"),
|
||||
HARD("DIFFICULTY_HARD"),
|
||||
EXTREME("DIFFICULTY_EXTREME"),
|
||||
ADVANCED("DIFFICULTY_ADVANCED");
|
||||
|
||||
private final String message;
|
||||
|
||||
EggDifficulty(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
38
src/de/steamwar/lobby/special/easter/EggHunt.java
Normale Datei
38
src/de/steamwar/lobby/special/easter/EggHunt.java
Normale Datei
@ -0,0 +1,38 @@
|
||||
package de.steamwar.lobby.special.easter;
|
||||
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class EggHunt {
|
||||
|
||||
private static List<Egg> eggList = new ArrayList<>();
|
||||
|
||||
public static final String EGG_HUNT_CONFIG_KEY = "egghunt2022";
|
||||
|
||||
public static void init() {
|
||||
}
|
||||
|
||||
static {
|
||||
new EggHuntCommand();
|
||||
new EggClickListener();
|
||||
new EggHuntListener();
|
||||
|
||||
File file = new File(LobbySystem.getPlugin().getDataFolder(), "eggs.yml");
|
||||
FileConfiguration fileConfiguration = YamlConfiguration.loadConfiguration(file);
|
||||
fileConfiguration.getList("eggs")
|
||||
.forEach(o -> {
|
||||
if (!(o instanceof Map)) return;
|
||||
eggList.add(new Egg((Map) o));
|
||||
});
|
||||
}
|
||||
|
||||
public static List<Egg> getEggList() {
|
||||
return eggList;
|
||||
}
|
||||
}
|
65
src/de/steamwar/lobby/special/easter/EggHuntCommand.java
Normale Datei
65
src/de/steamwar/lobby/special/easter/EggHuntCommand.java
Normale Datei
@ -0,0 +1,65 @@
|
||||
package de.steamwar.lobby.special.easter;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EggHuntCommand extends SWCommand {
|
||||
|
||||
public EggHuntCommand() {
|
||||
super("egghunt", "easteregg", "easter", "egg", "eh");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Player player, @OptionalValue("ALL") Selection selection) {
|
||||
AtomicInteger atomicInteger = new AtomicInteger();
|
||||
String found = UserConfig.getConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY);
|
||||
List<SWListInv.SWListEntry<Egg>> entries = EggHunt.getEggList().stream()
|
||||
.map(egg -> {
|
||||
int index = atomicInteger.getAndIncrement();
|
||||
boolean isFound = found != null && found.length() > index && found.charAt(index) == '1';
|
||||
if (selection == Selection.FOUND && !isFound) return null;
|
||||
if (selection == Selection.NOT_FOUND && isFound) return null;
|
||||
SWItem swItem = egg.getItem(player, isFound);
|
||||
if (swItem == null) return null;
|
||||
return new SWListInv.SWListEntry<>(swItem, egg);
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.sorted(Comparator.comparing(eggSWListEntry -> eggSWListEntry.getObject().getDifficulty()))
|
||||
.collect(Collectors.toList());
|
||||
SWListInv<Egg> inv = new SWListInv<>(player, LobbySystem.getMessage().parse("EASTER_EGG_MENU", player), false, entries, (clickType, egg) -> {
|
||||
});
|
||||
inv.setItem(49, new SWItem(SWItem.getDye(15), (byte) 15, LobbySystem.getMessage().parse(Selection.ALL.key, player), Collections.emptyList(), selection == Selection.ALL, clickType -> {
|
||||
genericCommand(player, Selection.ALL);
|
||||
}));
|
||||
inv.setItem(48, new SWItem(SWItem.getDye(1), (byte) 1, LobbySystem.getMessage().parse(Selection.NOT_FOUND.key, player), Collections.emptyList(), selection == Selection.NOT_FOUND, clickType -> {
|
||||
genericCommand(player, Selection.NOT_FOUND);
|
||||
}));
|
||||
inv.setItem(50, new SWItem(SWItem.getDye(2), (byte) 2, LobbySystem.getMessage().parse(Selection.FOUND.key, player), Collections.emptyList(), selection == Selection.FOUND, clickType -> {
|
||||
genericCommand(player, Selection.FOUND);
|
||||
}));
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public enum Selection {
|
||||
ALL("EASTER_EGG_SELECTION_ALL"),
|
||||
FOUND("EASTER_EGG_SELECTION_FOUND"),
|
||||
NOT_FOUND("EASTER_EGG_SELECTION_NOT_FOUND");
|
||||
|
||||
private final String key;
|
||||
|
||||
Selection(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
}
|
32
src/de/steamwar/lobby/special/easter/EggHuntListener.java
Normale Datei
32
src/de/steamwar/lobby/special/easter/EggHuntListener.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
package de.steamwar.lobby.special.easter;
|
||||
|
||||
import de.steamwar.lobby.listener.BasicListener;
|
||||
import de.steamwar.lobby.util.ItemBuilder;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class EggHuntListener extends BasicListener {
|
||||
|
||||
public static final int EASTER_EGG_SLOT = 7;
|
||||
public static final ItemStack EASTER_HUNT = new ItemBuilder(Material.DRAGON_EGG, 1).setDisplayName("§fEaster Hunt").build();
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||
ItemStack item = event.getItem();
|
||||
if(item == null)
|
||||
return;
|
||||
|
||||
if (item.getType() == Material.DRAGON_EGG && item.getItemMeta() != null && item.getItemMeta().getDisplayName().equals("§fEaster Hunt")) {
|
||||
event.getPlayer().performCommand("egg");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
e.getPlayer().getInventory().setItem(EASTER_EGG_SLOT, EASTER_HUNT);
|
||||
}
|
||||
}
|
@ -79,11 +79,6 @@ public class TeamPlayer extends BasicListener {
|
||||
entities.put(name, npc);
|
||||
}
|
||||
|
||||
public static void cleanup() {
|
||||
villagers.values().forEach(Entity::remove);
|
||||
entities.values().forEach(NPC::delete);
|
||||
}
|
||||
|
||||
{
|
||||
SteamwarUser.getServerTeam().forEach(user -> {
|
||||
spawnTeamPlayer(world, user);
|
||||
@ -92,6 +87,14 @@ public class TeamPlayer extends BasicListener {
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
LobbySystem.getPlugin().getLogger().log(Level.INFO, "Loaded " + entities.size() + " team players");
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), () -> {
|
||||
Collection<Villager> active = world.getEntitiesByClass(Villager.class);
|
||||
if (active.size() > entities.size()) {
|
||||
Set<String> duplicates = new HashSet<>();
|
||||
active.stream()
|
||||
.filter(villager -> !duplicates.add(villager.getCustomName()))
|
||||
.forEach(Entity::remove);
|
||||
}
|
||||
|
||||
count.incrementAndGet();
|
||||
if (count.get() % (20 * 60 * 60) == 0) {
|
||||
count.set(0);
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
package de.steamwar.lobby.util;
|
||||
|
||||
import de.steamwar.lobby.particle.particles.*;
|
||||
import de.steamwar.lobby.particle.ParticleEnum;
|
||||
import de.steamwar.lobby.particle.ParticleInventory;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -43,36 +44,7 @@ public class LobbyPlayer {
|
||||
particle = null;
|
||||
String saved = UserConfig.getConfig(userId, "lobby-particle");
|
||||
if (saved != null) {
|
||||
try {
|
||||
String[] strings = saved.split("@");
|
||||
switch (strings[0]) {
|
||||
case "PlayerParticle":
|
||||
particle = PlayerParticle.valueOf(strings[1]);
|
||||
break;
|
||||
case "TeamParticle":
|
||||
particle = TeamParticle.valueOf(strings[1]);
|
||||
break;
|
||||
case "ServerTeamParticle":
|
||||
particle = ServerTeamParticle.valueOf(strings[1]);
|
||||
break;
|
||||
case "EventParticle":
|
||||
particle = EventParticle.valueOf(strings[1]);
|
||||
break;
|
||||
case "EventParticleParticipation":
|
||||
particle = EventParticleParticipation.valueOf(strings[1]);
|
||||
break;
|
||||
case "EventParticlePlacement":
|
||||
particle = EventParticlePlacement.valueOf(strings[1]);
|
||||
break;
|
||||
case "SpecialParticle":
|
||||
particle = SpecialTeamParticle.valueOf(strings[1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
setParticle(null);
|
||||
}
|
||||
particle = ParticleInventory.convertFromString(saved);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +64,7 @@ public class LobbyPlayer {
|
||||
if (particle == null) {
|
||||
UserConfig.removePlayerConfig(userId, "lobby-particle");
|
||||
} else {
|
||||
String saved = particle.getClass().getSimpleName() + "@" + ((Enum<?>) particle).name();
|
||||
String saved = ParticleInventory.convertToString(particle);
|
||||
UserConfig.updatePlayerConfig(userId, "lobby-particle", saved);
|
||||
}
|
||||
this.particle = particle;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren