mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
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:
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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user