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"),

View File

@ -20,10 +20,10 @@ jailing:
during:
blockBreakPenalty: 5m
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
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:
- '%player%'
- '%prettytime%'
@ -44,17 +44,18 @@ jailing:
movePenalty: 10m
moveProtection: 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
preventInteractionItems: []
preventInteractionItemsPenalty: 5m
recieveMessages: true
scoreboard:
enabled: false
enabled: true
title: 'Jail Info'
time: '&aTime:'
jail:
allowJailingNeverPlayedBeforePlayers: false
allowJaillingOfflinePlayers: true
automaticCell: true
automaticMute: true
broadcastJailing: false

View File

@ -84,6 +84,7 @@ language:
transfercompletecell: '&2Successfully transferred %0% to %1% in the cell %2%.'
transfercompletenocell: '&2Successfully transferred %0% to %1%.'
transferred: '&9You have been transferred to %0%.'
unallowedtojailoffline: '&cJailing offline players is not allowed.'
unjailed: '&2You have been released! Please respect the server rules.'
unjailsuccess: '&2%0% has been released from jail.'
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/
softdepend: [WorldEdit, Vault, Multiverse-Core]
load: POSTWORLD
api-version: 1.13
commands:
jail:
description: Jail specified player for specified amount of time.
@ -19,6 +21,7 @@ commands:
description: Allows the player to handcuff another player
unhandcuff:
description: Allows the player to unhandcuff someone
permissions:
jail.*:
children: