|
|
|
@ -20,6 +20,7 @@
|
|
|
|
|
package de.steamwar.lobby.inventories;
|
|
|
|
|
|
|
|
|
|
import de.steamwar.inventory.SWInventory;
|
|
|
|
|
import de.steamwar.inventory.SWListInv;
|
|
|
|
|
import de.steamwar.lobby.particle.CircleParticle;
|
|
|
|
|
import de.steamwar.lobby.particle.FunctionalParticle;
|
|
|
|
|
import de.steamwar.lobby.particle.SimpleParticle;
|
|
|
|
@ -29,9 +30,9 @@ import de.steamwar.sql.SteamwarUser;
|
|
|
|
|
import de.steamwar.sql.UserGroup;
|
|
|
|
|
import org.bukkit.Material;
|
|
|
|
|
import org.bukkit.Particle;
|
|
|
|
|
import org.bukkit.block.data.type.Fire;
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -42,65 +43,60 @@ public class ParticleInventory {
|
|
|
|
|
|
|
|
|
|
private static final List<String> lore = Arrays.asList("§aKlicken zum Auswählen");
|
|
|
|
|
|
|
|
|
|
private static final SpecialParticle SNEEZE = new SimpleParticle(Material.SLIME_BLOCK, "§aSneeze", lore, Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01);
|
|
|
|
|
private static final SpecialParticle SMOKE = new SimpleParticle(Material.COBWEB, "§7Smoke", lore, Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01);
|
|
|
|
|
private static final SpecialParticle FLAME = new SimpleParticle(Material.LAVA_BUCKET, "§cFeuer", lore, Particle.DRIP_LAVA);
|
|
|
|
|
private static final SpecialParticle WATER = new SimpleParticle(Material.WATER_BUCKET, "§bWasser", lore, Particle.DRIP_WATER);
|
|
|
|
|
private static final SpecialParticle HEART = new FunctionalParticle(Material.RED_DYE, "§cHerzen", lore, (world, player, integer) -> world.spawnParticle(Particle.HEART, player.getLocation().add(0, 2.2, 0), 5));
|
|
|
|
|
private static final SpecialParticle NOTES = new FunctionalParticle(Material.NOTE_BLOCK, "§eNoten", lore, (world, player, integer) -> world.spawnParticle(Particle.NOTE, player.getLocation().add(0, 2.2, 0), 5));
|
|
|
|
|
private static final SpecialParticle NAUTILIS = new SimpleParticle(Material.NAUTILUS_SHELL, "§aNautilis", lore, Particle.NAUTILUS, 0.2F, 0F, 0.2F, 0.01);
|
|
|
|
|
private static final List<SpecialParticle> playerParticles = new ArrayList<>();
|
|
|
|
|
private static final List<SpecialParticle> teamParticles = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
private static final SpecialParticle SNOWBALL = new SimpleParticle(Material.SNOWBALL, "§fSnowball", lore, Particle.SNOWBALL, 0.2F, 0F, 0.2F, 0.01);
|
|
|
|
|
private static final SpecialParticle EFFECT = new SimpleParticle(Material.GLASS_BOTTLE, "§5Effekt", lore, Particle.REDSTONE, 0F, 0.2F, 0F, 0.01);
|
|
|
|
|
private static final SpecialParticle CAMPFIRE = new SimpleParticle(Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 0.0F, 0.2F, 0F, 0.01);
|
|
|
|
|
private static final SpecialParticle MAGIC = new SimpleParticle(Material.CAULDRON, "§5Magie", lore, Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01);
|
|
|
|
|
private static final SpecialParticle RAGE = new SimpleParticle(Material.REDSTONE_BLOCK, "§4Wut", lore, Particle.VILLAGER_ANGRY, 0.2F, 0.02F, 0.2F, 0.01);
|
|
|
|
|
private static final SpecialParticle SLIME = new SimpleParticle(Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME);
|
|
|
|
|
private static final SpecialParticle MOB = new SimpleParticle(Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB);
|
|
|
|
|
private static final List<SWListInv.SWListEntry<SpecialParticle>> playerParticlesEntries = new ArrayList<>();
|
|
|
|
|
private static final List<SWListInv.SWListEntry<SpecialParticle>> teamParticlesEntries = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
private static final SpecialParticle DAMAGE = new SimpleParticle(Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01);
|
|
|
|
|
private static final SpecialParticle WITCH = new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH);
|
|
|
|
|
private static final SpecialParticle ENCHANTING = new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE);
|
|
|
|
|
private static final SpecialParticle FRIEND = new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01);
|
|
|
|
|
private static final SpecialParticle FIRE = new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 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);
|
|
|
|
|
static {
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.SLIME_BLOCK, "§aSneeze", lore, Particle.SNEEZE, 0.2F, 0.2F, 0.2F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.COBWEB, "§7Smoke", lore, Particle.SMOKE_NORMAL, 0.2F, 0.2F, 0.2F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.LAVA_BUCKET, "§cFeuer", lore, Particle.DRIP_LAVA));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.WATER_BUCKET, "§bWasser", lore, Particle.DRIP_WATER));
|
|
|
|
|
playerParticles.add(new FunctionalParticle(Material.RED_DYE, "§cHerzen", lore, (world, player, integer) -> world.spawnParticle(Particle.HEART, player.getLocation().add(0, 2.2, 0), 5)));
|
|
|
|
|
playerParticles.add(new FunctionalParticle(Material.NOTE_BLOCK, "§eNoten", lore, (world, player, integer) -> world.spawnParticle(Particle.NOTE, player.getLocation().add(0, 2.2, 0), 5)));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.NAUTILUS_SHELL, "§aNautilis", lore, Particle.NAUTILUS, 0.2F, 0F, 0.2F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.SNOWBALL, "§fSnowball", lore, Particle.SNOWBALL, 0.2F, 0F, 0.2F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.GLASS_BOTTLE, "§5Effekt", lore, Particle.REDSTONE, 0F, 0.2F, 0F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.CAMPFIRE, "§7Rauch", lore, Particle.CAMPFIRE_COSY_SMOKE, 0.0F, 0.2F, 0F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.CAULDRON, "§5Magie", lore, Particle.CRIT_MAGIC, 0.2F, 0.2F, 0.2F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.REDSTONE_BLOCK, "§4Wut", lore, Particle.VILLAGER_ANGRY, 0.2F, 0.02F, 0.2F, 0.01));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.SLIME_BALL, "§aSchleim", lore, Particle.SLIME));
|
|
|
|
|
playerParticles.add(new SimpleParticle(Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB));
|
|
|
|
|
|
|
|
|
|
private static final SpecialParticle FIRE_RING = new CircleParticle(Material.MAGMA_BLOCK, "§7Flammen Ring", lore, Particle.FLAME, location -> location.add(0, 1.1, 0));
|
|
|
|
|
teamParticles.addAll(playerParticles);
|
|
|
|
|
teamParticles.add(new SimpleParticle(Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01));
|
|
|
|
|
teamParticles.add(new SimpleParticle(Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH));
|
|
|
|
|
teamParticles.add(new SimpleParticle(Material.ENCHANTING_TABLE, "§eZauber", lore, Particle.ENCHANTMENT_TABLE));
|
|
|
|
|
teamParticles.add(new SimpleParticle(Material.EMERALD_BLOCK, "§2Freude", lore, Particle.VILLAGER_HAPPY, 0.2F, 0.2F, 0.2F, 0.01));
|
|
|
|
|
teamParticles.add(new SimpleParticle(Material.FLINT_AND_STEEL, "§7Flammen", lore, Particle.FLAME, 0F, 0.2F, 0F, 0.01));
|
|
|
|
|
teamParticles.add(new SimpleParticle(Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 0F, 0.2F, 0F, 0.01));
|
|
|
|
|
teamParticles.add(new SimpleParticle(Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 0.2F, 0.2F, 0.2F, 0.01));
|
|
|
|
|
teamParticles.add(new CircleParticle(Material.MAGMA_BLOCK, "§7Flammen Ring", lore, Particle.FLAME, location -> location.add(0, 1.1, 0), 0F, 0.0F, 0F, 0.01));
|
|
|
|
|
teamParticles.add(new CircleParticle(Material.ENCHANTED_BOOK, "§fEnchanted Ring", lore, Particle.ENCHANTMENT_TABLE, location -> location.add(0, 1.1, 0), 0.0F, 0.0F, 0.0F, 0.01));
|
|
|
|
|
teamParticles.add(new CircleParticle(Material.NOTE_BLOCK, "§eNoten Ring", lore, Particle.NOTE, location -> location.add(0, 2.2, 0), 0.0F, 0.0F, 0.0F, 0.01));
|
|
|
|
|
|
|
|
|
|
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_3 = new SpecialParticle[]{DAMAGE, WITCH, ENCHANTING, FRIEND, FIRE, TOTEM, END};
|
|
|
|
|
private static final SpecialParticle[] row_4 = new SpecialParticle[]{FIRE_RING};
|
|
|
|
|
playerParticles.forEach(specialParticle -> playerParticlesEntries.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle)));
|
|
|
|
|
teamParticles.forEach(specialParticle -> teamParticlesEntries.add(new SWListInv.SWListEntry<>(specialParticle.getItem(), specialParticle)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static SWInventory createInventory(Player player) {
|
|
|
|
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
|
|
|
|
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
|
|
|
|
UserGroup userGroup = steamwarUser.getUserGroup();
|
|
|
|
|
|
|
|
|
|
SWInventory swInventory = new SWInventory(player, 9 * (userGroup == UserGroup.Member ? 5 : 6), "§6Partikel");
|
|
|
|
|
|
|
|
|
|
add(swInventory, row_1, 10, lobbyPlayer);
|
|
|
|
|
add(swInventory, row_2, 19, lobbyPlayer);
|
|
|
|
|
|
|
|
|
|
SWListInv<SpecialParticle> particleSWListInv;
|
|
|
|
|
if (userGroup == UserGroup.Member) {
|
|
|
|
|
swInventory.setItem(31, Material.BARRIER, "§8Keine Partikel", lore, false, clickType -> {
|
|
|
|
|
lobbyPlayer.setParticle(null);
|
|
|
|
|
});
|
|
|
|
|
particleSWListInv = new SWListInv<>(player, "§6Partikel", false, playerParticlesEntries, (clickType, particle) -> lobbyPlayer.setParticle(particle));
|
|
|
|
|
} else {
|
|
|
|
|
add(swInventory, row_3, 28, lobbyPlayer);
|
|
|
|
|
swInventory.setItem(40, Material.BARRIER, "§8Keine Partikel", lore, false, clickType -> {
|
|
|
|
|
lobbyPlayer.setParticle(null);
|
|
|
|
|
});
|
|
|
|
|
particleSWListInv = new SWListInv<>(player, "§6Partikel", false, teamParticlesEntries, (clickType, particle) -> lobbyPlayer.setParticle(particle));
|
|
|
|
|
}
|
|
|
|
|
particleSWListInv.setItem(49, Material.BARRIER, "§8Keine Partikel", lore, false, clickType -> {
|
|
|
|
|
lobbyPlayer.setParticle(null);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return swInventory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void add(SWInventory swInventory, SpecialParticle[] specialParticles, int index, LobbyPlayer lobbyPlayer) {
|
|
|
|
|
for (int i = 0; i < specialParticles.length; i++) {
|
|
|
|
|
specialParticles[i].add(swInventory, i + index, lobbyPlayer);
|
|
|
|
|
}
|
|
|
|
|
return particleSWListInv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void openParticleInventory(Player player) {
|
|
|
|
|