Unlock everything for administrators

Every particle requirement passes for users with the administration
permission. Lore keeps naming the regular requirement.
This commit is contained in:
2026-10-26 14:49:53 +01:00
parent 8e4730bd12
commit 9cb4e0b7db
@@ -39,7 +39,13 @@ public interface ParticleRequirement {
String getRequirementName(Player player);
boolean test(UnlockContext context);
// Whether the player meets this requirement
boolean matches(UnlockContext context);
// Administrators pass every requirement; lore still names the regular requirement
default boolean test(UnlockContext context) {
return context.getUser().hasPerm(UserPerm.ADMINISTRATION) || matches(context);
}
ParticleRequirement SERVER_TEAM = new ParticleRequirement() {
@Override
@@ -48,7 +54,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return context.getUser().hasPerm(UserPerm.TEAM);
}
};
@@ -60,7 +66,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return true;
}
};
@@ -73,7 +79,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return context.getUser().getTeam() != 0;
}
};
@@ -84,7 +90,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return !context.getEvents().isEmpty();
}
}.or(SERVER_TEAM);
@@ -100,7 +106,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
String eggHuntConfig = context.getEggHuntConfig();
if (eggHuntConfig == null) return false;
int count = 0;
@@ -123,7 +129,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return context.getUser().getTeam() == teamId;
}
}.or(SERVER_TEAM);
@@ -138,7 +144,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return context.getEvents().contains(eventId);
}
}.or(SERVER_TEAM);
@@ -155,7 +161,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
if (!teams.contains(context.getUser().getTeam())) return false;
return context.getEvents().contains(eventId);
}
@@ -184,7 +190,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
String eggHuntConfig = context.getEggHuntConfig();
if (eggHuntConfig == null) return false;
return eggs.stream().allMatch(id -> eggHuntConfig.length() > id && eggHuntConfig.charAt(id) == '1');
@@ -201,7 +207,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return context.getUser().getId() == userId;
}
}.or(SERVER_TEAM);
@@ -216,7 +222,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return context.getUser().getId() == userId;
}
}.or(SERVER_TEAM);
@@ -232,7 +238,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return context.getUser().getTeam() == teamId;
}
}.or(SERVER_TEAM);
@@ -247,7 +253,7 @@ public interface ParticleRequirement {
}
@Override
public boolean test(UnlockContext context) {
public boolean matches(UnlockContext context) {
return particleRequirement.test(context) || ParticleRequirement.this.test(context);
}
};