mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +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
|
// Warp command settings
|
||||||
private boolean doWarpCommand;
|
private boolean doWarpCommand;
|
||||||
private boolean doPermissionRestrictedWarps;
|
private boolean doPermissionRestrictedWarps;
|
||||||
|
private boolean hideRestrictedWarps;
|
||||||
private String warpRestrictionPermissionFormat;
|
private String warpRestrictionPermissionFormat;
|
||||||
|
|
||||||
public Settings(Plugin plugin) {
|
public Settings(Plugin plugin) {
|
||||||
@@ -188,6 +189,7 @@ public class Settings {
|
|||||||
this.doWarpCommand = config.getBoolean("warp_command.enabled");
|
this.doWarpCommand = config.getBoolean("warp_command.enabled");
|
||||||
this.doPermissionRestrictedWarps = config.getBoolean("warp_command.permission_restrictions.require_permission");
|
this.doPermissionRestrictedWarps = config.getBoolean("warp_command.permission_restrictions.require_permission");
|
||||||
this.warpRestrictionPermissionFormat = config.getString("warp_command.permission_restrictions.format");
|
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.doRtpCommand = config.getBoolean("random_teleport_command.enabled");
|
||||||
this.rtpRange = config.getInt("random_teleport_command.range");
|
this.rtpRange = config.getInt("random_teleport_command.range");
|
||||||
@@ -400,4 +402,8 @@ public class Settings {
|
|||||||
public String getWarpRestrictionPermissionFormat() {
|
public String getWarpRestrictionPermissionFormat() {
|
||||||
return warpRestrictionPermissionFormat;
|
return warpRestrictionPermissionFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean doHideRestrictedWarps() {
|
||||||
|
return hideRestrictedWarps;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -188,6 +188,9 @@ public class ListHandler {
|
|||||||
for (int i = warpsLowerBound; i < warpsUpperBound; i++) {
|
for (int i = warpsLowerBound; i < warpsUpperBound; i++) {
|
||||||
try {
|
try {
|
||||||
Warp warp = warps.get(i);
|
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) {
|
if (i != warpsLowerBound) {
|
||||||
warpList.append(divider(), ComponentBuilder.FormatRetention.NONE);
|
warpList.append(divider(), ComponentBuilder.FormatRetention.NONE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ warp_command:
|
|||||||
permission_restrictions:
|
permission_restrictions:
|
||||||
require_permission: false
|
require_permission: false
|
||||||
format: 'huskhomes.warp.'
|
format: 'huskhomes.warp.'
|
||||||
|
hide_restricted_warps: true
|
||||||
spawn_command:
|
spawn_command:
|
||||||
enabled: true
|
enabled: true
|
||||||
bungee_network_spawn:
|
bungee_network_spawn:
|
||||||
|
|||||||
Reference in new issue
Block a user