Add an option to disallow jailing offline players.

This closes #163 and adds a new configuration option
This commit is contained in:
Bradley Hilton
2019-04-15 13:22:38 -05:00
parent ec2b6ba0f4
commit ac78c941bf
6 changed files with 17 additions and 4 deletions

View File

@@ -99,6 +99,11 @@ public class JailCommand implements Command {
String uuid = "";
if(p == null) {
if (!jm.getPlugin().getConfig().getBoolean(Settings.ALLOWJAILINGOFFLINEPLAYERS.getPath())) {
sender.sendMessage(Lang.PLAYERHASNEVERPLAYEDBEFORE.get());
return true;
}
//TODO: Make this whole jail command non-blocking
OfflinePlayer of = jm.getPlugin().getServer().getOfflinePlayer(params.getPlayer());

View File

@@ -101,6 +101,8 @@ public enum Lang {
UNJAILED("jailing"),
/** The message sent to the person who released a prisoner from jail. */
UNJAILSUCCESS("jailing"),
/** The message sent when you jailing offline players is not allowed. */
UNALLOWEDTOJAILOFFLINE("jailing"),
/** The message went when an offline player is unjailed. */
WILLBEUNJAILED("jailing"),
/** The message sent when trying to jail a player in an unloaded world. */

View File

@@ -2,6 +2,7 @@ package com.graywolf336.jail.enums;
public enum Settings {
ALLOWJAILINGNEVERPLAYEDBEFOREPLAYERS("jailing.jail.allowJailingNeverPlayedBeforePlayers"),
ALLOWJAILINGOFFLINEPLAYERS("jailing.jail.allowJaillingOfflinePlayers"),
AUTOMATICCELL("jailing.jail.automaticCell"),
AUTOMATICMUTE("jailing.jail.automaticMute"),
BROADCASTJAILING("jailing.jail.broadcastJailing"),