diff --git a/src/main/java/fr/hashtek/spigot/breakffa/cosmetics/CosmeticManager.java b/src/main/java/fr/hashtek/spigot/breakffa/cosmetics/CosmeticManager.java index c5f4402..e3826b3 100644 --- a/src/main/java/fr/hashtek/spigot/breakffa/cosmetics/CosmeticManager.java +++ b/src/main/java/fr/hashtek/spigot/breakffa/cosmetics/CosmeticManager.java @@ -10,42 +10,16 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -public class CosmeticManager -{ - - /** - * Function used to get the cosmetic setter according to a Player's Cosmetic Manager. - * - * @param Cosmetic - */ - public interface CurrentCosmeticSetter - > - { - - /** - * @param manager Cosmetic Manager of the player who clicked - */ - Consumer getSetter(CosmeticManager manager); +public class CosmeticManager { + public interface CurrentCosmeticSetter> { + Consumer getSetter(CosmeticManager manager); } - /** - * Function used to get the cosmetic getter according to a Player's Cosmetic Manager. - * - * @param Cosmetic - */ - public interface CurrentCosmeticGetter - > - { - - /** - * @param manager Cosmetic Manager of the player who clicked - */ + public interface CurrentCosmeticGetter> { Supplier getGetter(CosmeticManager manager); - } - public static final Map> COSMETIC_REGISTRY = getCosmetics().stream().collect(Collectors.toMap(Cosmetic::getRawName, cosmetic -> cosmetic)); @@ -59,23 +33,13 @@ public interface CurrentCosmeticGetter private Cosmetic currentKillSfx; private Cosmetic currentNexusSfx; - - /** - * Creates a new instance of CosmeticManager. - */ - public CosmeticManager() - { - this.ownedCosmetics = new HashSet>(); + public CosmeticManager() { + this.ownedCosmetics = new HashSet<>(); } - /** - * @return Every cosmetic that exists - */ - @SuppressWarnings("unchecked") - public static Set> getCosmetics() - { + public static Set> getCosmetics() { final Class>>[] cosmeticEnums = - new Class[] { + new Class[]{ CosmeticTypeHat.Hat.class, CosmeticTypeKillSfx.KillSfx.class, CosmeticTypeBlock.Block.class, @@ -87,128 +51,67 @@ public static Set> getCosmetics() return Arrays.stream(cosmeticEnums) .flatMap(enumClass -> Arrays.stream(enumClass.getEnumConstants()) - .map(enumValue -> ((CosmeticCategoryArticles) enumValue).getCosmetic())) + .map(enumValue -> ((CosmeticCategoryArticles) enumValue).getCosmetic())) .collect(Collectors.toSet()); } - /** - * @return Cosmetic that player owns - */ - public Set> getOwnedCosmetics() - { + public Set> getOwnedCosmetics() { return this.ownedCosmetics; } - /** - * @return Current Nexus Sfx - */ - public Cosmetic getCurrentNexusSfx() - { + public Cosmetic getCurrentNexusSfx() { return this.currentNexusSfx; } - /** - * @return Current Kill Sfx - */ - public Cosmetic getCurrentKillSfx() - { + public Cosmetic getCurrentKillSfx() { return this.currentKillSfx; } - /** - * @return Current Kill Particles - */ - public Cosmetic getCurrentKillParticles() - { + public Cosmetic getCurrentKillParticles() { return this.currentKillParticles; } - /** - * @return Current Kill Messages - */ - public Cosmetic getCurrentKillMessages() - { + public Cosmetic getCurrentKillMessages() { return this.currentKillMessages; } - /** - * @return Current Hat - */ - public Cosmetic getCurrentHat() - { + public Cosmetic getCurrentHat() { return this.currentHat; } - /** - * @return Current Emblem - */ - public Cosmetic getCurrentEmblem() - { + public Cosmetic getCurrentEmblem() { return this.currentEmblem; } - /** - * @return Current Block - */ - public Cosmetic getCurrentBlock() - { + public Cosmetic getCurrentBlock() { return this.currentBlock; } - /** - * @param currentBlock New Current Block - */ - public void setCurrentBlock(Cosmetic currentBlock) - { + public void setCurrentBlock(Cosmetic currentBlock) { this.currentBlock = currentBlock; } - /** - * @param currentEmblem New Current Emblem - */ - public void setCurrentEmblem(Cosmetic currentEmblem) - { + public void setCurrentEmblem(Cosmetic currentEmblem) { this.currentEmblem = currentEmblem; } - /** - * @param currentHat New Current Hat - */ - public void setCurrentHat(Cosmetic currentHat) - { + public void setCurrentHat(Cosmetic currentHat) { this.currentHat = currentHat; } - /** - * @param currentKillMessages New Current Kill Messages - */ - public void setCurrentKillMessage(Cosmetic currentKillMessages) - { + public void setCurrentKillMessage(Cosmetic currentKillMessages) { this.currentKillMessages = currentKillMessages; } - /** - * @param currentKillParticles New Current Kill Particles - */ - public void setCurrentKillParticles(Cosmetic currentKillParticles) - { + public void setCurrentKillParticles(Cosmetic currentKillParticles) { this.currentKillParticles = currentKillParticles; } - /** - * @param currentKillSfx New Current Kill Sfx - */ - public void setCurrentKillSfx(Cosmetic currentKillSfx) - { + public void setCurrentKillSfx(Cosmetic currentKillSfx) { this.currentKillSfx = currentKillSfx; } - /** - * @param currentNexusSfx New Current Nexus Sfx - */ - public void setCurrentNexusSfx(Cosmetic currentNexusSfx) - { + public void setCurrentNexusSfx(Cosmetic currentNexusSfx) { this.currentNexusSfx = currentNexusSfx; } - }