diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 4049057..e4236b8 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -23,6 +23,7 @@ PARTICLE_LOCKED = {0} §8- §c§lLocked PARTICLE_UNLOCKED_BY = §eUnlocked by PARTICLE_UNLOCKED_BY_TEAM = §fJoin a team PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0} +PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0} PARTICLE_UNLOCKED_BY_EVENT = §fEvent participation PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServer Team PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. or 3. Place diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index 633b0bf..357a0af 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -23,6 +23,7 @@ PARTICLE_LOCKED = {0} §8- §c§lGesperrt PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0} +PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0} PARTICLE_UNLOCKED_BY_EVENT = §fEventteilnahme PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServerteam PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz diff --git a/src/de/steamwar/lobby/otherparticle/Particle.java b/src/de/steamwar/lobby/otherparticle/Particle.java index 6290cbc..3477d3a 100644 --- a/src/de/steamwar/lobby/otherparticle/Particle.java +++ b/src/de/steamwar/lobby/otherparticle/Particle.java @@ -12,10 +12,27 @@ import java.util.Set; public class Particle { - private Material material; - private String name; - private Set attributes = new LinkedHashSet<>(); - private ParticleRequirement requirement; + private final Material material; + private final String name; + private final Set attributes = new LinkedHashSet<>(); + private final ParticleRequirement requirement; + + public Particle(Material material, String name) { + this.material = material; + this.name = name; + this.requirement = ParticleRequirement.NO_REQUIRMENT; + } + + public Particle(Material material, String name, ParticleRequirement requirement) { + this.material = material; + this.name = name; + this.requirement = requirement; + } + + public Particle add(String attribute) { + attributes.add(attribute); + return this; + } public SWItem toSWItem(Player player) { String translatedName = LobbySystem.getMessage().parse(name, player); diff --git a/src/de/steamwar/lobby/otherparticle/ParticleEnum.java b/src/de/steamwar/lobby/otherparticle/ParticleEnum.java new file mode 100644 index 0000000..2e32953 --- /dev/null +++ b/src/de/steamwar/lobby/otherparticle/ParticleEnum.java @@ -0,0 +1,5 @@ +package de.steamwar.lobby.otherparticle; + +public interface ParticleEnum { + Particle getParticle(); +} diff --git a/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java b/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java index 28e3d20..b911693 100644 --- a/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java +++ b/src/de/steamwar/lobby/otherparticle/ParticleRequirement.java @@ -173,6 +173,21 @@ public interface ParticleRequirement { }; } + static ParticleRequirement specificPlayer(int userId) { + String userName = SteamwarUser.get(userId).getUserName(); + return new ParticleRequirement() { + @Override + public String getRequirementName(Player player) { + return LobbySystem.getMessage().parse("PARTICLE_UNLOCKED_BY_SPECIFIC_USER", player, userName); + } + + @Override + public ParticleRequirementPredicate getRequirement() { + return (steamwarUser, integers, eggHuntConfig) -> steamwarUser.getId() == userId; + } + }; + } + interface ParticleRequirementPredicate { boolean test(SteamwarUser user, Set eventTeilname, String eggHuntConfig); }