mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
[Feature] Add config optn. to disable jail free tp
Adds the teleport-back-when-freed-from-jail configuration option. When set to true (default), as with previous versions will teleport the player which was jailed back to their previous position when freed. When false, Essentials will not teleport the player anywhere, leaving them where they are. Closes #1947
This commit is contained in:
parent
b2a5280971
commit
70387f73f6
4 changed files with 24 additions and 5 deletions
|
@ -306,4 +306,6 @@ public interface ISettings extends IConf {
|
|||
List<String> getDefaultEnabledConfirmCommands();
|
||||
|
||||
boolean isConfirmCommandEnabledByDefault(String commandName);
|
||||
|
||||
boolean isTeleportBackWhenFreedFromJail();
|
||||
}
|
||||
|
|
|
@ -533,6 +533,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
currencyFormat = _getCurrencyFormat();
|
||||
unprotectedSigns = _getUnprotectedSign();
|
||||
defaultEnabledConfirmCommands = _getDefaultEnabledConfirmCommands();
|
||||
teleportBackWhenFreedFromJail = _isTeleportBackWhenFreedFromJail();
|
||||
}
|
||||
|
||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||
|
@ -1439,4 +1440,15 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
public boolean isConfirmCommandEnabledByDefault(String commandName) {
|
||||
return getDefaultEnabledConfirmCommands().contains(commandName.toLowerCase());
|
||||
}
|
||||
|
||||
private boolean teleportBackWhenFreedFromJail;
|
||||
|
||||
private boolean _isTeleportBackWhenFreedFromJail() {
|
||||
return config.getBoolean("teleport-back-when-freed-from-jail", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTeleportBackWhenFreedFromJail() {
|
||||
return teleportBackWhenFreedFromJail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -514,12 +514,14 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||
setJailed(false);
|
||||
sendMessage(tl("haveBeenReleased"));
|
||||
setJail(null);
|
||||
try {
|
||||
getTeleport().back();
|
||||
} catch (Exception ex) {
|
||||
if (ess.getSettings().isTeleportBackWhenFreedFromJail()) {
|
||||
try {
|
||||
getTeleport().respawn(null, TeleportCause.PLUGIN);
|
||||
} catch (Exception ex1) {
|
||||
getTeleport().back();
|
||||
} catch (Exception ex) {
|
||||
try {
|
||||
getTeleport().respawn(null, TeleportCause.PLUGIN);
|
||||
} catch (Exception ex1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -522,6 +522,9 @@ default-enabled-confirm-commands:
|
|||
#- pay
|
||||
#- clearinventory
|
||||
|
||||
# Whether or not to teleport a player back to their previous position after they have been freed from jail.
|
||||
teleport-back-when-freed-from-jail: true
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | EssentialsHome | #
|
||||
|
|
Loading…
Reference in a new issue