From bd4dc2ad21826f28d3e6814b7f3ee10a8a3accdf Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 27 Mar 2023 22:11:14 +0200 Subject: [PATCH] Update Particle --- .../lobby/otherparticle/Particle.java | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/de/steamwar/lobby/otherparticle/Particle.java b/src/de/steamwar/lobby/otherparticle/Particle.java index 7811f6a..6290cbc 100644 --- a/src/de/steamwar/lobby/otherparticle/Particle.java +++ b/src/de/steamwar/lobby/otherparticle/Particle.java @@ -2,7 +2,6 @@ package de.steamwar.lobby.otherparticle; import de.steamwar.inventory.SWItem; import de.steamwar.lobby.LobbySystem; -import de.steamwar.sql.SteamwarUser; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -10,38 +9,30 @@ import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import java.util.function.Predicate; public class Particle { - private ParticleItem item; + private Material material; + private String name; + private Set attributes = new LinkedHashSet<>(); + private ParticleRequirement requirement; - private static class ParticleItem { - - private Material material; - private String name; - private Set attributes = new LinkedHashSet<>(); - private String unlockedBy; - - public SWItem toSWItem(Player player) { - String translatedName = LobbySystem.getMessage().parse(name, player); - List lore = new ArrayList<>(); + public SWItem toSWItem(Player player) { + String translatedName = LobbySystem.getMessage().parse(name, player); + List 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 (!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 -> {}); } + String unlockedBy = requirement.getRequirementName(player); + if (unlockedBy != null) { + lore.add(LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY", player)); + lore.add(unlockedBy); + lore.add(""); + } + lore.add(LobbySystem.getMessage().parse("PARTICLE_SELECT", player)); + return new SWItem(material, translatedName, lore, false, clickType -> {}); } - - private Predicate unlocked = player -> true; - }