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 = ""; String uuid = "";
if(p == null) { 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 //TODO: Make this whole jail command non-blocking
OfflinePlayer of = jm.getPlugin().getServer().getOfflinePlayer(params.getPlayer()); OfflinePlayer of = jm.getPlugin().getServer().getOfflinePlayer(params.getPlayer());

View File

@ -101,6 +101,8 @@ public enum Lang {
UNJAILED("jailing"), UNJAILED("jailing"),
/** The message sent to the person who released a prisoner from jail. */ /** The message sent to the person who released a prisoner from jail. */
UNJAILSUCCESS("jailing"), UNJAILSUCCESS("jailing"),
/** The message sent when you jailing offline players is not allowed. */
UNALLOWEDTOJAILOFFLINE("jailing"),
/** The message went when an offline player is unjailed. */ /** The message went when an offline player is unjailed. */
WILLBEUNJAILED("jailing"), WILLBEUNJAILED("jailing"),
/** The message sent when trying to jail a player in an unloaded world. */ /** 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 { public enum Settings {
ALLOWJAILINGNEVERPLAYEDBEFOREPLAYERS("jailing.jail.allowJailingNeverPlayedBeforePlayers"), ALLOWJAILINGNEVERPLAYEDBEFOREPLAYERS("jailing.jail.allowJailingNeverPlayedBeforePlayers"),
ALLOWJAILINGOFFLINEPLAYERS("jailing.jail.allowJaillingOfflinePlayers"),
AUTOMATICCELL("jailing.jail.automaticCell"), AUTOMATICCELL("jailing.jail.automaticCell"),
AUTOMATICMUTE("jailing.jail.automaticMute"), AUTOMATICMUTE("jailing.jail.automaticMute"),
BROADCASTJAILING("jailing.jail.broadcastJailing"), BROADCASTJAILING("jailing.jail.broadcastJailing"),

View File

@ -20,10 +20,10 @@ jailing:
during: during:
blockBreakPenalty: 5m blockBreakPenalty: 5m
blockBreakProtection: true blockBreakProtection: true
blockBreakWhiteList: ['crops', 'carrot', 'potato'] # these blocks can be broken at any time by prisoners blockBreakWhiteList: ['farmland', 'carrot', 'potato'] # these blocks can be broken at any time by prisoners
blockPlacePenalty: 5m blockPlacePenalty: 5m
blockPlaceProtection: true blockPlaceProtection: true
blockPlaceWhiteList: ['crops', 'carrot', 'potato'] # these blocks can be placed at any time by prisoners blockPlaceWhiteList: ['farmland', 'carrot', 'potato'] # these blocks can be placed at any time by prisoners
cellsign: cellsign:
- '%player%' - '%player%'
- '%prettytime%' - '%prettytime%'
@ -44,17 +44,18 @@ jailing:
movePenalty: 10m movePenalty: 10m
moveProtection: true moveProtection: true
openChest: true openChest: true
preventInteractionBlocks: ['wooden_door', 'iron_door_block'] preventInteractionBlocks: ['oak_door', 'spruce_door', 'birch_door', 'jungle_door', 'acacia_door', 'dark_oak_door', 'iron_door']
preventInteractionBlocksPenalty: 5m preventInteractionBlocksPenalty: 5m
preventInteractionItems: [] preventInteractionItems: []
preventInteractionItemsPenalty: 5m preventInteractionItemsPenalty: 5m
recieveMessages: true recieveMessages: true
scoreboard: scoreboard:
enabled: false enabled: true
title: 'Jail Info' title: 'Jail Info'
time: '&aTime:' time: '&aTime:'
jail: jail:
allowJailingNeverPlayedBeforePlayers: false allowJailingNeverPlayedBeforePlayers: false
allowJaillingOfflinePlayers: true
automaticCell: true automaticCell: true
automaticMute: true automaticMute: true
broadcastJailing: false broadcastJailing: false

View File

@ -84,6 +84,7 @@ language:
transfercompletecell: '&2Successfully transferred %0% to %1% in the cell %2%.' transfercompletecell: '&2Successfully transferred %0% to %1% in the cell %2%.'
transfercompletenocell: '&2Successfully transferred %0% to %1%.' transfercompletenocell: '&2Successfully transferred %0% to %1%.'
transferred: '&9You have been transferred to %0%.' transferred: '&9You have been transferred to %0%.'
unallowedtojailoffline: '&cJailing offline players is not allowed.'
unjailed: '&2You have been released! Please respect the server rules.' unjailed: '&2You have been released! Please respect the server rules.'
unjailsuccess: '&2%0% has been released from jail.' unjailsuccess: '&2%0% has been released from jail.'
willbeunjailed: '&2%0% will be released the next time they log on.' willbeunjailed: '&2%0% will be released the next time they log on.'

View File

@ -6,6 +6,8 @@ authors: [graywolf336]
website: dev.bukkit.org/server-mods/jail/ website: dev.bukkit.org/server-mods/jail/
softdepend: [WorldEdit, Vault, Multiverse-Core] softdepend: [WorldEdit, Vault, Multiverse-Core]
load: POSTWORLD load: POSTWORLD
api-version: 1.13
commands: commands:
jail: jail:
description: Jail specified player for specified amount of time. description: Jail specified player for specified amount of time.
@ -19,6 +21,7 @@ commands:
description: Allows the player to handcuff another player description: Allows the player to handcuff another player
unhandcuff: unhandcuff:
description: Allows the player to unhandcuff someone description: Allows the player to unhandcuff someone
permissions: permissions:
jail.*: jail.*:
children: children: