13
0

Add ParticleEnum
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Update Particle and add new ParticleRequirment
Dieser Commit ist enthalten in:
yoyosource 2023-04-03 21:11:38 +02:00
Ursprung bd4dc2ad21
Commit f22cd77464
5 geänderte Dateien mit 43 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ PARTICLE_LOCKED = {0} §8- §c§lLocked
PARTICLE_UNLOCKED_BY = §eUnlocked by PARTICLE_UNLOCKED_BY = §eUnlocked by
PARTICLE_UNLOCKED_BY_TEAM = §fJoin a team PARTICLE_UNLOCKED_BY_TEAM = §fJoin a team
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0} PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0}
PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0}
PARTICLE_UNLOCKED_BY_EVENT = §fEvent participation PARTICLE_UNLOCKED_BY_EVENT = §fEvent participation
PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServer Team PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServer Team
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. or 3. Place PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. or 3. Place

Datei anzeigen

@ -23,6 +23,7 @@ PARTICLE_LOCKED = {0} §8- §c§lGesperrt
PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch PARTICLE_UNLOCKED_BY = §eFreigeschaltet durch
PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt PARTICLE_UNLOCKED_BY_TEAM = §fTeambeitritt
PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0} PARTICLE_UNLOCKED_BY_SPECIFIC_TEAM = §fTeam {0}
PARTICLE_UNLOCKED_BY_SPECIFIC_USER = §fUser {0}
PARTICLE_UNLOCKED_BY_EVENT = §fEventteilnahme PARTICLE_UNLOCKED_BY_EVENT = §fEventteilnahme
PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServerteam PARTICLE_UNLOCKED_BY_SERVER_TEAM = §fServerteam
PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz PARTICLE_UNLOCKED_BY_EVENT_PLACEMENT = §f{0} 1., 2. oder 3. Platz

Datei anzeigen

@ -12,10 +12,27 @@ import java.util.Set;
public class Particle { public class Particle {
private Material material; private final Material material;
private String name; private final String name;
private Set<String> attributes = new LinkedHashSet<>(); private final Set<String> attributes = new LinkedHashSet<>();
private ParticleRequirement requirement; 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) { public SWItem toSWItem(Player player) {
String translatedName = LobbySystem.getMessage().parse(name, player); String translatedName = LobbySystem.getMessage().parse(name, player);

Datei anzeigen

@ -0,0 +1,5 @@
package de.steamwar.lobby.otherparticle;
public interface ParticleEnum {
Particle getParticle();
}

Datei anzeigen

@ -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 { interface ParticleRequirementPredicate {
boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig); boolean test(SteamwarUser user, Set<Integer> eventTeilname, String eggHuntConfig);
} }