13
0

Update some stuff

Dieser Commit ist enthalten in:
yoyosource 2022-03-24 15:09:05 +01:00
Ursprung fa9a359270
Commit 52d61ccd79
17 geänderte Dateien mit 500 neuen und 371 gelöschten Zeilen

Datei anzeigen

@ -10,3 +10,15 @@ PORTAL_COMMAND_REMOVE_HELP = §8/§7portal §eremove §8[§7PortalName§8] §8-
PORTAL_COMMAND_LIST_SHORT_INFO = §e{0} §8- §7{1} §7Pos1§8(§7{2}§8) §7Pos2§8(§7{3}§8) PORTAL_COMMAND_LIST_SHORT_INFO = §e{0} §8- §7{1} §7Pos1§8(§7{2}§8) §7Pos2§8(§7{3}§8)
PORTAL_NO_WORLDEDIT_SELECTION = §cKeine WorldEdit Selection PORTAL_NO_WORLDEDIT_SELECTION = §cKeine WorldEdit Selection
# Particle
PARTICLE_ATTRIBUTE_CIRCLE = §8-§f Ring
PARTICLE_ATTRIBUTE_BI_CIRCLE = §8-§f Doppel Ring
PARTICLE_ATTRIBUTE_CLOUD = §8-§f Wolke
PARTICLE_ATTRIBUTE_TICK = §8-§f Immer aktiv
PARTICLE_ATTRIBUTE_NON_FLOOR = §8-§f in Luft
PARTICLE_ATTRIBUTE = §eAttribute§7:
PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch
PARTICLE_SELECT = §eKlicken zum auswählen

Datei anzeigen

@ -1,17 +1,11 @@
package de.steamwar.lobby.particle; package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; import java.util.Random;
public interface BaseParticle { public interface BaseParticle {
List<String> EMPTY_LORE = new ArrayList<>();
Random RANDOM = new Random(); Random RANDOM = new Random();
default Color randomColor() { default Color randomColor() {
@ -26,11 +20,11 @@ public interface BaseParticle {
return new Particle.DustOptions(randomColor(), randomSize()); return new Particle.DustOptions(randomColor(), randomSize());
} }
SWItem getItem(); ParticleItem getItem();
default boolean tickable() { default boolean needsTick() {
return false; return false;
} }
void particle(World world, Player player, double deg); void particle(ParticleData particleData);
} }

Datei anzeigen

@ -1,87 +0,0 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.List;
import java.util.function.Function;
import java.util.function.UnaryOperator;
public class CircleParticle extends SpecialParticle {
private Particle particle;
private Particle particle2;
private Function<Location, Location> locationShift;
private boolean customVelocity = false;
private float vx;
private float vy;
private float vz;
private double time = 1;
public CircleParticle(Material material, String name, List<String> lore, Particle particle, Particle particle2, UnaryOperator<Location> locationShift) {
super(material, name, lore);
this.particle = particle;
this.particle2 = particle2;
this.locationShift = locationShift;
}
public CircleParticle(Material material, String name, List<String> lore, Particle particle, Particle particle2, UnaryOperator<Location> locationShift, float vx, float vy, float vz, double time) {
super(material, name, lore);
this.particle = particle;
this.particle2 = particle2;
this.locationShift = locationShift;
customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
}
@Override
public void particle(World world, Player player, double deg) {
Vector vector = new Vector(1, 0, 0);
vector.rotateAroundY(deg);
if (customVelocity) {
world.spawnParticle(particle, locationShift.apply(player.getLocation().add(vector)), 1, vx, vy, vz, time);
} else {
world.spawnParticle(particle, locationShift.apply(player.getLocation().add(vector)), 1);
}
if (particle2 == null) {
return;
}
vector.setX(-vector.getX());
vector.setZ(-vector.getZ());
if (customVelocity) {
world.spawnParticle(particle2, locationShift.apply(player.getLocation().add(vector)), 1, vx, vy, vz, time);
} else {
world.spawnParticle(particle2, locationShift.apply(player.getLocation().add(vector)), 1);
}
}
}

Datei anzeigen

@ -1,44 +0,0 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.function.UnaryOperator;
public class CloudCircleParticle extends CircleParticle {
public CloudCircleParticle(Material material, String name, List<String> lore, Particle particle, UnaryOperator<Location> locationShift) {
super(material, name, lore, particle, null, locationShift, 0.0F, 0.0F, 0.0F, 0.01);
asCloud = true;
}
@Override
public void particle(World world, Player player, double deg) {
super.particle(world, player, deg);
}
}

Datei anzeigen

@ -1,44 +0,0 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.List;
public class CloudParticle extends SpecialParticle {
private Particle particle;
public CloudParticle(Material material, String name, List<String> lore, Particle particle) {
super(material, name, lore);
asCloud = true;
this.particle = particle;
}
@Override
public void particle(World world, Player player, double deg) {
world.spawnParticle(particle, player.getLocation().subtract(0, -0.2, 0), 5, 0.5F, 0.02F, 0.5F, 0.01);
}
}

Datei anzeigen

@ -1,43 +0,0 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.List;
public class FunctionalParticle extends SpecialParticle {
private ParticleFunction particleFunction;
public FunctionalParticle(Material material, String name, List<String> lore, ParticleFunction particleFunction) {
super(material, name, lore);
this.particleFunction = particleFunction;
}
@Override
public void particle(World world, Player player, double deg) {
particleFunction.accept(world, player, deg);
}
}

Datei anzeigen

@ -0,0 +1,53 @@
/*
* 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 lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@RequiredArgsConstructor
@AllArgsConstructor
@Getter
public class ParticleData {
private final World world;
private final Player player;
private Location location;
private final double deg;
public ParticleData withLocation(Location location) {
this.location = location;
return this;
}
public Location getLocation() {
if (location == null) {
return player.getLocation();
}
return location;
}
public ParticleData clone() {
return new ParticleData(world, player, location, deg);
}
}

Datei anzeigen

@ -1,29 +0,0 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
@FunctionalInterface
public interface ParticleFunction {
void accept(World world, Player player, double time);
}

Datei anzeigen

@ -0,0 +1,66 @@
/*
* 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 lombok.Setter;
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 {
private final Material material;
private final String name;
private final Set<String> attributes = new LinkedHashSet<>();
@Setter
private String unlockedBy;
public ParticleItem addAttribute(String attribute) {
this.attributes.add(attribute);
return this;
}
public SWItem toSWItem(Player player) {
String translatedName = LobbySystem.getMessage().parse(name, player);
List<String> lore = new ArrayList<>();
lore.add("");
if (!attributes.isEmpty()) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_ATTRIBUTE", player));
attributes.forEach(attribute -> lore.add(LobbySystem.getMessage().parse(attribute, player)));
lore.add("");
}
if (unlockedBy != null) {
lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player));
lore.add(LobbySystem.getMessage().parse(unlockedBy, player));
lore.add("");
}
lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player));
return new SWItem(material, translatedName, lore, false, clickType -> {});
}
}

Datei anzeigen

@ -1,8 +1,7 @@
/* /*
*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2020 SteamWar.de-Serverteam * Copyright (C) 2022 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Affero General Public License as published by
@ -20,29 +19,31 @@
package de.steamwar.lobby.particle; package de.steamwar.lobby.particle;
import org.bukkit.*; import de.steamwar.lobby.particle.BaseParticle;
import org.bukkit.entity.Player; import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleItem;
import org.bukkit.Location;
import org.bukkit.Particle;
import java.util.List; public class SimpleParticle implements BaseParticle {
public class SimpleParticle extends SpecialParticle { private final ParticleItem particleItem;
private final Particle particle;
private Particle particle;
private boolean customVelocity = false; private boolean customVelocity = false;
private float vx; private float vx;
private float vy; private float vy;
private float vz; private float vz;
private double time = 1; private double time = 1;
public SimpleParticle(Material material, String name, List<String> lore, Particle particle) { public SimpleParticle(ParticleItem particleItem, Particle particle) {
super(material, name, lore); this.particleItem = particleItem;
this.particle = particle; this.particle = particle;
} }
public SimpleParticle(Material material, String name, List<String> lore, Particle particle, float vx, float vy, float vz, double time) { public SimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time) {
super(material, name, lore); this.particleItem = particleItem;
this.particle = particle; this.particle = particle;
customVelocity = true; this.customVelocity = true;
this.vx = vx; this.vx = vx;
this.vy = vy; this.vy = vy;
this.vz = vz; this.vz = vz;
@ -50,13 +51,17 @@ public class SimpleParticle extends SpecialParticle {
} }
@Override @Override
public void particle(World world, Player player, double deg) { public ParticleItem getItem() {
Location location = player.getLocation().add(0.0, 0.2, 0.0); return particleItem;
if (customVelocity) {
world.spawnParticle(particle, location, 5, vx, vy, vz, time);
} else {
world.spawnParticle(particle, location, 5);
}
} }
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation().add(0.0, 0.2, 0.0);
if (customVelocity) {
particleData.getWorld().spawnParticle(particle, location, 5, vx, vy, vz, time);
} else {
particleData.getWorld().spawnParticle(particle, location, 5);
}
}
} }

Datei anzeigen

@ -1,83 +0,0 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.inventory.SWItem;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public abstract class SpecialParticle {
private static final List<String> EMPTY_LORE = new ArrayList<>();
private static Random random = new Random();
public static Color randomColor() {
return Color.fromRGB(random.nextInt(256), random.nextInt(256), random.nextInt(256));
}
public static float randomSize() {
return random.nextFloat() / 2 + 1;
}
public static Particle.DustOptions getParticleDust() {
return new Particle.DustOptions(randomColor(), randomSize());
}
private Material material;
private String name;
private List<String> lore;
protected boolean asCloud = false;
protected SpecialParticle(Material material, String name, List<String> lore) {
if (lore == null) {
lore = EMPTY_LORE;
}
this.material = material;
this.name = name;
this.lore = lore;
}
public final SWItem getItem() {
return new SWItem(material, name, lore, false, clickType -> {});
}
public final void execute(World world, Player player, double deg) {
if (asCloud) {
if (world.getBlockAt(player.getLocation().subtract(0, 1, 0)).getType() == Material.AIR) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false));
} else {
player.removePotionEffect(PotionEffectType.SLOW_FALLING);
return;
}
}
particle(world, player, deg);
}
public abstract void particle(World world, Player player, double deg);
}

Datei anzeigen

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

Datei anzeigen

@ -0,0 +1,58 @@
/*
* 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;
}
particle.particle(particleData);
}
}

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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