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 they want just any open cell or automatic jailing in cells is turned on
|
||||||
if(params.isAnyCell()) {
|
//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();
|
c = jm.getJail(jailName).getFirstEmptyCell();
|
||||||
if(c == null) {
|
if(c == null) {
|
||||||
//If there wasn't an empty cell, then tell them so.
|
//If there wasn't an empty cell, then tell them so.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.graywolf336.jail.enums;
|
package com.graywolf336.jail.enums;
|
||||||
|
|
||||||
public enum Settings {
|
public enum Settings {
|
||||||
|
AUTOMATICCELL("jailing.jail.automaticCell"),
|
||||||
AUTOMATICMUTE("jailing.jail.automaticMute"),
|
AUTOMATICMUTE("jailing.jail.automaticMute"),
|
||||||
BROADCASTJAILING("jailing.jail.broadcastJailing"),
|
BROADCASTJAILING("jailing.jail.broadcastJailing"),
|
||||||
BLOCKBREAKPENALTY("jailing.during.blockBreakPenalty"),
|
BLOCKBREAKPENALTY("jailing.during.blockBreakPenalty"),
|
||||||
|
@ -54,6 +54,7 @@ jailing:
|
|||||||
title: 'Jail Info'
|
title: 'Jail Info'
|
||||||
time: '&aTime:'
|
time: '&aTime:'
|
||||||
jail:
|
jail:
|
||||||
|
automaticCell: true
|
||||||
automaticMute: true
|
automaticMute: true
|
||||||
broadcastJailing: false
|
broadcastJailing: false
|
||||||
clothing:
|
clothing:
|
||||||
|
@ -123,6 +123,7 @@ public class TestJailDefaultConfig {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testJailingDefaultConfig() {
|
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()));
|
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()));
|
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()));
|
assertTrue("Default setting for jail clothing is not enabled.", main.getConfig().getBoolean(Settings.CLOTHINGENABLED.getPath()));
|
||||||
|
Loading…
Reference in New Issue
Block a user