Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class ResidentCommand extends BaseCommand implements CommandExecutor {
"jail",
"plotlist",
"outlawlist",
"trustlist",
"spawn",
"toggle",
"set",
Expand Down Expand Up @@ -148,6 +149,7 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
break;
case "tax":
case "outlawlist":
case "trustlist":
if (args.length == 2)
return getTownyStartingWith(args[1], "r");
break;
Expand Down Expand Up @@ -250,6 +252,7 @@ public void parseResidentCommand(final Player player, String[] split) throws Tow
case "tax" -> parseResidentTax(player, StringMgmt.remFirstArg(split));
case "plotlist" -> parseResidentPlotlist(player, StringMgmt.remFirstArg(split));
case "outlawlist" -> parseResidentOutlawlist(player, StringMgmt.remFirstArg(split));
case "trustlist" -> parseResidentTrustlist(player, StringMgmt.remFirstArg(split));
case "jail" -> parseResidentJail(player, StringMgmt.remFirstArg(split));
case "set" -> residentSet(player, StringMgmt.remFirstArg(split));
case "toggle" -> residentToggle(player, StringMgmt.remFirstArg(split));
Expand Down Expand Up @@ -334,6 +337,14 @@ private void parseResidentOutlawlist(Player player, String[] split) throws Towny
TownyMessaging.sendMessage(player, TownyFormatter.getFormattedTownyObjects(Translatable.of("outlawed_in").forLocale(player), new ArrayList<>(resident.getTownsOutlawedIn())));
}

private void parseResidentTrustlist(Player player, String[] split) throws TownyException {
checkPermOrThrow(player, PermissionNodes.TOWNY_COMMAND_RESIDENT_TRUSTLIST.getNode());

Resident resident = split.length == 0 ? getResidentOrThrow(player) : getResidentOrThrow(split[0]);

TownyMessaging.sendMessage(player, TownyFormatter.getFormattedTownyObjects(Translatable.of("trusted_in").forLocale(player), new ArrayList<>(resident.getTownsTrustedIn())));
}

private void parseResidentJail(Player player, String[] split) throws TownyException {
checkPermOrThrow(player, PermissionNodes.TOWNY_COMMAND_RESIDENT_JAIL.getNode());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,13 @@ public List<Town> getTownsOutlawedIn() {
return TownyUniverse.getInstance().getTowns().stream().filter(t -> t.hasOutlaw(this)).collect(Collectors.toList());
}

/**
* @return All towns that the resident is trusted in.
*/
public List<Town> getTownsTrustedIn() {
return TownyUniverse.getInstance().getTowns().stream().filter(t -> t.hasTrustedResident(this)).collect(Collectors.toList());
}

@Override
public boolean hasTownBlock(TownBlock townBlock) {
return townBlocks.contains(townBlock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public enum PermissionNodes {
TOWNY_COMMAND_RESIDENT_TAX("towny.command.resident.tax"),
TOWNY_COMMAND_RESIDENT_PLOTLIST("towny.command.resident.plotlist"),
TOWNY_COMMAND_RESIDENT_OUTLAWLIST("towny.command.resident.outlawlist"),
TOWNY_COMMAND_RESIDENT_TRUSTLIST("towny.command.resident.trustlist"),
TOWNY_COMMAND_RESIDENT_JAIL("towny.command.resident.jail"),
TOWNY_COMMAND_RESIDENT_SET("towny.command.resident.set.*"),
TOWNY_COMMAND_RESIDENT_SET_PERM("towny.command.resident.set.perm"),
Expand Down
12 changes: 11 additions & 1 deletion Towny/src/main/resources/config-migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -959,5 +959,15 @@
"value": ",END_PORTAL_FRAME"
}
]
}
},
{
"version": "0.103.2.1",
"changes": [
{
"type": "TOWNYPERMS_ADD",
"path": "nomad",
"value": "towny.command.resident.trustlist"
}
]
},
]
1 change: 1 addition & 0 deletions Towny/src/main/resources/lang/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,7 @@ msg_err_name_validation_used_in_command_structure: "%s is used in the command st
msg_town_being_deleted_because_no_residents: "%s is being deleted because it lost its last resident."

outlawed_in: "Outlawed in"
trusted_in: "Trusted in"

msg_warning_town_deposit_hint: "To put money in your town bank use /town deposit [amount]."

Expand Down
1 change: 1 addition & 0 deletions Towny/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ permissions:
towny.command.resident.list: true
towny.command.resident.plotlist: true
towny.command.resident.outlawlist: true
towny.command.resident.trustlist: true
towny.command.resident.set.*: true
towny.command.resident.otherresident: true
towny.command.resident.tax: true
Expand Down
1 change: 1 addition & 0 deletions Towny/src/main/resources/townyperms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ nomad:
- towny.command.resident.set.about
- towny.command.resident.jail
- towny.command.resident.outlawlist
- towny.command.resident.trustlist
- towny.command.town.allylist
- towny.command.town.enemylist

Expand Down
Loading