Reimplment automatically jailing in cells, fixes #42.

New config option if you want to disable this option.
This commit is contained in:
graywolf336 2015-02-09 22:08:59 -06:00
parent 205e7a4e22
commit d819bd7d37
4 changed files with 6 additions and 2 deletions

View File

@ -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.

View File

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

View File

@ -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:

View File

@ -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()));