mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-20 23:47:31 +00:00
Allow updating the compass target to be optional (#1937)
If `compass-towards-home-perm` is enabled in the EssentialsX config, then the permission `essentials.home.compass` is checked before changing the player's compass target. Closes #1918.
This commit is contained in:
parent
27d9f3725a
commit
4873beb100
4 changed files with 30 additions and 6 deletions
|
@ -353,7 +353,10 @@ public class EssentialsPlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes the compass item ingame always point to the first essentials home. #EasterEgg
|
// Makes the compass item ingame always point to the first essentials home. #EasterEgg
|
||||||
|
// EssentialsX: This can now optionally require a permission to enable, if set in the config.
|
||||||
private void updateCompass(final User user) {
|
private void updateCompass(final User user) {
|
||||||
|
if (ess.getSettings().isCompassTowardsHomePerm() && !user.isAuthorized("essentials.home.compass")) return;
|
||||||
|
|
||||||
Location loc = user.getHome(user.getLocation());
|
Location loc = user.getHome(user.getLocation());
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
loc = user.getBase().getBedSpawnLocation();
|
loc = user.getBase().getBedSpawnLocation();
|
||||||
|
|
|
@ -306,4 +306,6 @@ public interface ISettings extends IConf {
|
||||||
List<String> getDefaultEnabledConfirmCommands();
|
List<String> getDefaultEnabledConfirmCommands();
|
||||||
|
|
||||||
boolean isConfirmCommandEnabledByDefault(String commandName);
|
boolean isConfirmCommandEnabledByDefault(String commandName);
|
||||||
|
|
||||||
|
boolean isCompassTowardsHomePerm();
|
||||||
}
|
}
|
||||||
|
|
|
@ -533,6 +533,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
currencyFormat = _getCurrencyFormat();
|
currencyFormat = _getCurrencyFormat();
|
||||||
unprotectedSigns = _getUnprotectedSign();
|
unprotectedSigns = _getUnprotectedSign();
|
||||||
defaultEnabledConfirmCommands = _getDefaultEnabledConfirmCommands();
|
defaultEnabledConfirmCommands = _getDefaultEnabledConfirmCommands();
|
||||||
|
isCompassTowardsHomePerm = _isCompassTowardsHomePerm();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||||
|
@ -1439,4 +1440,15 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
public boolean isConfirmCommandEnabledByDefault(String commandName) {
|
public boolean isConfirmCommandEnabledByDefault(String commandName) {
|
||||||
return getDefaultEnabledConfirmCommands().contains(commandName.toLowerCase());
|
return getDefaultEnabledConfirmCommands().contains(commandName.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCompassTowardsHomePerm;
|
||||||
|
|
||||||
|
private boolean _isCompassTowardsHomePerm() {
|
||||||
|
return config.getBoolean("compass-towards-home-perm", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCompassTowardsHomePerm() {
|
||||||
|
return isCompassTowardsHomePerm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,6 +522,13 @@ default-enabled-confirm-commands:
|
||||||
#- pay
|
#- pay
|
||||||
#- clearinventory
|
#- clearinventory
|
||||||
|
|
||||||
|
# Set the timeout, in seconds for players to accept a tpa before the request is cancelled.
|
||||||
|
# Set to 0 for no timeout.
|
||||||
|
tpa-accept-cancellation: 120
|
||||||
|
|
||||||
|
# Allow players to set hats by clicking on their helmet slot.
|
||||||
|
allow-direct-hat: true
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
# | EssentialsHome | #
|
# | EssentialsHome | #
|
||||||
|
@ -551,12 +558,12 @@ sethome-multiple:
|
||||||
# In this example someone with 'essentials.sethome.multiple' and 'essentials.sethome.multiple.vip' will have 5 homes.
|
# In this example someone with 'essentials.sethome.multiple' and 'essentials.sethome.multiple.vip' will have 5 homes.
|
||||||
# Remember, they MUST have both permission nodes in order to be able to set multiple homes.
|
# Remember, they MUST have both permission nodes in order to be able to set multiple homes.
|
||||||
|
|
||||||
# Set the timeout, in seconds for players to accept a tpa before the request is cancelled.
|
# Controls whether players need the permission "essentials.home.compass" in order to point
|
||||||
# Set to 0 for no timeout.
|
# the player's compass at their first home.
|
||||||
tpa-accept-cancellation: 120
|
#
|
||||||
|
# Leaving this as false will retain Essentials' original behaviour, which is to always
|
||||||
# Allow players to set hats by clicking on their helmet slot.
|
# change the compass' direction to point towards their first home.
|
||||||
allow-direct-hat: true
|
compass-towards-home-perm: false
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
|
|
Loading…
Reference in a new issue