Add option to hide warps from the warp list if you do not have permission to use it, Closes #27

This commit is contained in:
William278 committed 2021-04-16 14:58:38 +01:00
1 parent e5d265a155
commit 8d527033f6
3 files changed
+10

No files matched your search

@@ -86,6 +86,7 @@ public class Settings {
// Warp command settings
private boolean doWarpCommand;
private boolean doPermissionRestrictedWarps;
private boolean hideRestrictedWarps;
private String warpRestrictionPermissionFormat;
public Settings(Plugin plugin) {
@@ -188,6 +189,7 @@ public class Settings {
this.doWarpCommand = config.getBoolean("warp_command.enabled");
this.doPermissionRestrictedWarps = config.getBoolean("warp_command.permission_restrictions.require_permission");
this.warpRestrictionPermissionFormat = config.getString("warp_command.permission_restrictions.format");
this.hideRestrictedWarps = config.getBoolean("warp_command.permission_restrictions.hide_restricted_warps");
this.doRtpCommand = config.getBoolean("random_teleport_command.enabled");
this.rtpRange = config.getInt("random_teleport_command.range");
@@ -400,4 +402,8 @@ public class Settings {
public String getWarpRestrictionPermissionFormat() {
return warpRestrictionPermissionFormat;
}
public boolean doHideRestrictedWarps() {
return hideRestrictedWarps;
}
}
@@ -188,6 +188,9 @@ public class ListHandler {
for (int i = warpsLowerBound; i < warpsUpperBound; i++) {
try {
Warp warp = warps.get(i);
if (HuskHomes.getSettings().doHideRestrictedWarps()) { // Don't show inaccessible warps if hiding restricted warps is on.
if (!Warp.getWarpCanUse(player, warp.getName())) { continue; }
}
if (i != warpsLowerBound) {
warpList.append(divider(), ComponentBuilder.FormatRetention.NONE);
}