Skip to content

Commit

Permalink
Fix towny-betonquest rank condition (year-old bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
PainOchoco committed Feb 12, 2024
1 parent e751027 commit 4e01d5b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ public RankCondition(Instruction instruction) {
@Override
protected Boolean execute(String playerId) throws QuestRuntimeException {
Resident resident = TownyUniverse.getInstance().getResident(UUID.fromString(playerId));
if (resident == null) return false;
if (resident == null)
return false;
try {
switch (instruction.getPart(1)) {
case "nation":
return resident.hasNationRank(instruction.getPart(1));
return resident.hasNationRank(instruction.getPart(2));
case "town":
return resident.hasTownRank(instruction.getPart(1));
return resident.hasTownRank(instruction.getPart(2));
default:
throw new QuestRuntimeException(
"Invalid argument: " + instruction.getPart(1) + ", possible arguments: town & nation");
Expand Down

0 comments on commit 4e01d5b

Please sign in to comment.