forked from SteamWar/SteamWar
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:
@@ -39,7 +39,13 @@ public interface ParticleRequirement {
|
|||||||
|
|
||||||
String getRequirementName(Player player);
|
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() {
|
ParticleRequirement SERVER_TEAM = new ParticleRequirement() {
|
||||||
@Override
|
@Override
|
||||||
@@ -48,7 +54,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return context.getUser().hasPerm(UserPerm.TEAM);
|
return context.getUser().hasPerm(UserPerm.TEAM);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -60,7 +66,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -73,7 +79,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return context.getUser().getTeam() != 0;
|
return context.getUser().getTeam() != 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -84,7 +90,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return !context.getEvents().isEmpty();
|
return !context.getEvents().isEmpty();
|
||||||
}
|
}
|
||||||
}.or(SERVER_TEAM);
|
}.or(SERVER_TEAM);
|
||||||
@@ -100,7 +106,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
String eggHuntConfig = context.getEggHuntConfig();
|
String eggHuntConfig = context.getEggHuntConfig();
|
||||||
if (eggHuntConfig == null) return false;
|
if (eggHuntConfig == null) return false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -123,7 +129,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return context.getUser().getTeam() == teamId;
|
return context.getUser().getTeam() == teamId;
|
||||||
}
|
}
|
||||||
}.or(SERVER_TEAM);
|
}.or(SERVER_TEAM);
|
||||||
@@ -138,7 +144,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return context.getEvents().contains(eventId);
|
return context.getEvents().contains(eventId);
|
||||||
}
|
}
|
||||||
}.or(SERVER_TEAM);
|
}.or(SERVER_TEAM);
|
||||||
@@ -155,7 +161,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
if (!teams.contains(context.getUser().getTeam())) return false;
|
if (!teams.contains(context.getUser().getTeam())) return false;
|
||||||
return context.getEvents().contains(eventId);
|
return context.getEvents().contains(eventId);
|
||||||
}
|
}
|
||||||
@@ -184,7 +190,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
String eggHuntConfig = context.getEggHuntConfig();
|
String eggHuntConfig = context.getEggHuntConfig();
|
||||||
if (eggHuntConfig == null) return false;
|
if (eggHuntConfig == null) return false;
|
||||||
return eggs.stream().allMatch(id -> eggHuntConfig.length() > id && eggHuntConfig.charAt(id) == '1');
|
return eggs.stream().allMatch(id -> eggHuntConfig.length() > id && eggHuntConfig.charAt(id) == '1');
|
||||||
@@ -201,7 +207,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return context.getUser().getId() == userId;
|
return context.getUser().getId() == userId;
|
||||||
}
|
}
|
||||||
}.or(SERVER_TEAM);
|
}.or(SERVER_TEAM);
|
||||||
@@ -216,7 +222,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return context.getUser().getId() == userId;
|
return context.getUser().getId() == userId;
|
||||||
}
|
}
|
||||||
}.or(SERVER_TEAM);
|
}.or(SERVER_TEAM);
|
||||||
@@ -232,7 +238,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return context.getUser().getTeam() == teamId;
|
return context.getUser().getTeam() == teamId;
|
||||||
}
|
}
|
||||||
}.or(SERVER_TEAM);
|
}.or(SERVER_TEAM);
|
||||||
@@ -247,7 +253,7 @@ public interface ParticleRequirement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(UnlockContext context) {
|
public boolean matches(UnlockContext context) {
|
||||||
return particleRequirement.test(context) || ParticleRequirement.this.test(context);
|
return particleRequirement.test(context) || ParticleRequirement.this.test(context);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user