Archiviert
13
0

Particle #21

Manuell gemergt
YoyoNow hat 12 Commits von Particle nach master 2021-02-23 17:47:54 +01:00 zusammengeführt
2 geänderte Dateien mit 58 neuen und 0 gelöschten Zeilen
Nur Änderungen aus Commit 6f04d2b811 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.lobby.inventories; package de.steamwar.lobby.inventories;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import de.steamwar.lobby.particle.CircleParticle;
import de.steamwar.lobby.particle.FunctionalParticle; import de.steamwar.lobby.particle.FunctionalParticle;
import de.steamwar.lobby.particle.SimpleParticle; import de.steamwar.lobby.particle.SimpleParticle;
import de.steamwar.lobby.particle.SpecialParticle; import de.steamwar.lobby.particle.SpecialParticle;
@ -28,6 +29,7 @@ import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserGroup;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.block.data.type.Fire;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Arrays; import java.util.Arrays;
@ -64,9 +66,12 @@ public class ParticleInventory {
private static final SpecialParticle TOTEM = new SimpleParticle(Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 0F, 0.2F, 0F, 0.01); private static final SpecialParticle TOTEM = new SimpleParticle(Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 0F, 0.2F, 0F, 0.01);
private static final SpecialParticle END = new SimpleParticle(Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01); private static final SpecialParticle END = new SimpleParticle(Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01);
private static final SpecialParticle FIRE_RING = new CircleParticle(Material.MAGMA_BLOCK, "§7Flammen Ring", lore, Particle.FLAME, location -> location.add(0, 1.1, 0));
private static final SpecialParticle[] row_1 = new SpecialParticle[]{SNEEZE, SMOKE, FLAME, WATER, HEART, NOTES, NAUTILIS}; private static final SpecialParticle[] row_1 = new SpecialParticle[]{SNEEZE, SMOKE, FLAME, WATER, HEART, NOTES, NAUTILIS};
private static final SpecialParticle[] row_2 = new SpecialParticle[]{SNOWBALL, EFFECT, CAMPFIRE, MAGIC, RAGE, SLIME, MOB}; private static final SpecialParticle[] row_2 = new SpecialParticle[]{SNOWBALL, EFFECT, CAMPFIRE, MAGIC, RAGE, SLIME, MOB};
private static final SpecialParticle[] row_3 = new SpecialParticle[]{DAMAGE, WITCH, ENCHANTING, FRIEND, FIRE, TOTEM, END}; private static final SpecialParticle[] row_3 = new SpecialParticle[]{DAMAGE, WITCH, ENCHANTING, FRIEND, FIRE, TOTEM, END};
private static final SpecialParticle[] row_4 = new SpecialParticle[]{FIRE_RING};
private static SWInventory createInventory(Player player) { private static SWInventory createInventory(Player player) {
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());

Datei anzeigen

@ -0,0 +1,53 @@
/*
*
* 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.Supplier;
public class CircleParticle extends SpecialParticle {
private Particle particle;
private Function<Location, Location> locationShift;
public CircleParticle(Material material, String name, List<String> lore, Particle particle, Function<Location, Location> locationShift) {
super(material, name, lore);
this.particle = particle;
this.locationShift = locationShift;
}
@Override
public void particle(World world, Player player, int deg) {
Vector vector = new Vector(1, 0, 0);
vector.rotateAroundY(deg);
world.spawnParticle(particle, locationShift.apply(player.getLocation().add(vector)), 5);
}
}