Reimplment automatically jailing in cells, fixes #42.
New config option if you want to disable this option.
This commit is contained in:
parent
205e7a4e22
commit
d819bd7d37
@ -146,8 +146,9 @@ public class JailCommand implements Command {
|
||||
}
|
||||
}
|
||||
|
||||
//If they want just any open cell, then let's find the first empty one
|
||||
if(params.isAnyCell()) {
|
||||
//If they want just any open cell or automatic jailing in cells is turned on
|
||||
//and a cell wasn't already found, then find try to find a cell
|
||||
if((params.isAnyCell() || jm.getPlugin().getConfig().getBoolean(Settings.AUTOMATICCELL.getPath(), true)) && c == null) {
|
||||
c = jm.getJail(jailName).getFirstEmptyCell();
|
||||
if(c == null) {
|
||||
//If there wasn't an empty cell, then tell them so.
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.graywolf336.jail.enums;
|
||||
|
||||
public enum Settings {
|
||||
AUTOMATICCELL("jailing.jail.automaticCell"),
|
||||
AUTOMATICMUTE("jailing.jail.automaticMute"),
|
||||
BROADCASTJAILING("jailing.jail.broadcastJailing"),
|
||||
BLOCKBREAKPENALTY("jailing.during.blockBreakPenalty"),
|
||||
|
@ -54,6 +54,7 @@ jailing:
|
||||
title: 'Jail Info'
|
||||
time: '&aTime:'
|
||||
jail:
|
||||
automaticCell: true
|
||||
automaticMute: true
|
||||
broadcastJailing: false
|
||||
clothing:
|
||||
|
@ -123,6 +123,7 @@ public class TestJailDefaultConfig {
|
||||
|
||||
@Test
|
||||
public void testJailingDefaultConfig() {
|
||||
assertTrue("Default setting for automatically jailing in cells is false.", main.getConfig().getBoolean(Settings.AUTOMATICCELL.getPath()));
|
||||
assertTrue("Default setting for automatically muting is false.", main.getConfig().getBoolean(Settings.AUTOMATICMUTE.getPath()));
|
||||
assertFalse("Default setting for broadcasting a jailing is true.", main.getConfig().getBoolean(Settings.BROADCASTJAILING.getPath()));
|
||||
assertTrue("Default setting for jail clothing is not enabled.", main.getConfig().getBoolean(Settings.CLOTHINGENABLED.getPath()));
|
||||
|
Loading…
Reference in New Issue
Block a user