Work on some unit tests for #7 and reorganize part of the config.

This commit is contained in:
graywolf336 2014-07-22 20:58:05 -05:00
parent b63773c7a9
commit 6b8dec6c7b
8 changed files with 159 additions and 54 deletions

View File

@ -24,6 +24,7 @@ import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.beans.Prisoner; import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.beans.SimpleLocation; import com.graywolf336.jail.beans.SimpleLocation;
import com.graywolf336.jail.enums.LangString; import com.graywolf336.jail.enums.LangString;
import com.graywolf336.jail.enums.Settings;
/** /**
* Handles all the saving and loading of the plugin's data. * Handles all the saving and loading of the plugin's data.
@ -61,7 +62,7 @@ public class JailIO {
/** Loads the language file from disk, if there is none then we save the default one. */ /** Loads the language file from disk, if there is none then we save the default one. */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void loadLanguage() { public void loadLanguage() {
String language = pl.getConfig().getString("system.language"); String language = pl.getConfig().getString(Settings.LANGUAGE.getPath());
boolean save = false; boolean save = false;
File langFile = new File(pl.getDataFolder(), language + ".yml"); File langFile = new File(pl.getDataFolder(), language + ".yml");

View File

@ -84,7 +84,7 @@ public class JailCommand implements Command {
Long time = 10L; Long time = 10L;
try { try {
if(params.getTime() == null) { if(params.getTime() == null) {
time = Util.getTime(jm.getPlugin().getConfig().getString(Settings.JAILDEFAULTTIME.getPath(), "30m")); time = Util.getTime(jm.getPlugin().getConfig().getString(Settings.DEFAULTTIME.getPath(), "30m"));
}else if(params.getTime() == String.valueOf(-1)) { }else if(params.getTime() == String.valueOf(-1)) {
time = -1L; time = -1L;
}else { }else {

View File

@ -15,7 +15,7 @@ import com.graywolf336.jail.enums.LangString;
needsPlayer = false, needsPlayer = false,
pattern = "time|t", pattern = "time|t",
permission = "jail.command.jailtime", permission = "jail.command.jailtime",
usage = "/jail time <add|remove|show> <player> <time>" usage = "/jail time [add|remove|show] [player] <time>"
) )
public class JailTimeCommand implements Command { public class JailTimeCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {

View File

@ -19,20 +19,21 @@ public enum Settings {
COMMANDPENALTY("jailing.during.commandPenalty"), COMMANDPENALTY("jailing.during.commandPenalty"),
COMMANDPROTECTION("jailing.during.commandProtection"), COMMANDPROTECTION("jailing.during.commandProtection"),
COMMANDWHITELIST("jailing.during.commandWhitelist"), COMMANDWHITELIST("jailing.during.commandWhitelist"),
CONFIGVERSION("system.version"),
COUNTDOWNTIMEOFFLINE("jailing.during.countDownTimeWhileOffline"), COUNTDOWNTIMEOFFLINE("jailing.during.countDownTimeWhileOffline"),
CROPTRAMPLINGPENALTY("jailing.during.cropTramplingPenalty"), CROPTRAMPLINGPENALTY("jailing.during.cropTramplingPenalty"),
CROPTRAMPLINGPROTECTION("jailing.during.cropTramplingProtection"), CROPTRAMPLINGPROTECTION("jailing.during.cropTramplingProtection"),
DEBUG("system.debug"), DEBUG("system.debug"),
DEFAULTJAIL("jailing.jail.defaultJail"), DEFAULTJAIL("jailing.jail.default.jail"),
DEFAULTTIME("jailing.jail.default.time"),
ENDERMENPROTECTION("jails.endermenProtection"), ENDERMENPROTECTION("jails.endermenProtection"),
EXPLOSIONPROTECTION("jails.explosionProtection"), EXPLOSIONPROTECTION("jails.explosionProtection"),
FOODCONTROL("jailing.during.foodControl"), FOODCONTROL("jailing.during.foodControl.enabled"),
FOODCONTROLMAX("jailing.during.foodControlMax"), FOODCONTROLMAX("jailing.during.foodControl.max"),
FOODCONTROLMIN("jailing.during.foodControlMin"), FOODCONTROLMIN("jailing.during.foodControl.min"),
IGNORESLEEPINGSTATE("jailing.during.ignoreSleeping"), IGNORESLEEPINGSTATE("jailing.during.ignoreSleeping"),
JAILSTICKENABLED("jailstick.enabled"), JAILSTICKENABLED("jailstick.enabled"),
JAILSTICKSTICKS("jailstick.sticks"), JAILSTICKSTICKS("jailstick.sticks"),
JAILDEFAULTTIME("jailing.jail.defaultTime"),
JAILEDGAMEMODE("jailing.jail.gameMode"), JAILEDGAMEMODE("jailing.jail.gameMode"),
JAILEDINVENTORYBLACKLIST("jailing.jail.inventory.blacklist"), JAILEDINVENTORYBLACKLIST("jailing.jail.inventory.blacklist"),
JAILEDSTOREINVENTORY("jailing.jail.inventory.store"), JAILEDSTOREINVENTORY("jailing.jail.inventory.store"),
@ -40,7 +41,9 @@ public enum Settings {
JAILPAYITEM("jailpay.item"), JAILPAYITEM("jailpay.item"),
JAILPAYPRICEPERMINUTE ("jailpay.pricePerMinute"), JAILPAYPRICEPERMINUTE ("jailpay.pricePerMinute"),
JAILPAYPRICEINFINITE ("jailpay.priceInfinite"), JAILPAYPRICEINFINITE ("jailpay.priceInfinite"),
LOGJAILINGTOCONSOLE("jailing.jail.logToConsole"), LANGUAGE("system.language"),
LOGJAILINGTOCONSOLE("jailing.jail.log.console"),
LOGJAILINGTOPROFILE("jailing.jail.log.profile"),
MAXAFKTIME("jailing.during.maxAFKTime"), MAXAFKTIME("jailing.during.maxAFKTime"),
MOVEPENALTY("jailing.during.movePenalty"), MOVEPENALTY("jailing.during.movePenalty"),
MOVEPROTECTION("jailing.during.moveProtection"), MOVEPROTECTION("jailing.during.moveProtection"),

View File

@ -192,8 +192,8 @@ public class LegacyManager {
break; break;
case DefaultJailTime: case DefaultJailTime:
if(global.contains(s.getString())) { if(global.contains(s.getString())) {
c.set(Settings.JAILDEFAULTTIME.getPath(), OldSettings.getGlobalInt(global, s)); c.set(Settings.DEFAULTTIME.getPath(), OldSettings.getGlobalInt(global, s));
pl.debug(Settings.JAILDEFAULTTIME.getPath() + " <-- " + s.getString()); pl.debug(Settings.DEFAULTTIME.getPath() + " <-- " + s.getString());
count++; count++;
} }
break; break;

View File

@ -29,18 +29,22 @@ public class JailingListener implements Listener {
@EventHandler(ignoreCancelled=true) @EventHandler(ignoreCancelled=true)
public void preJailingListener(PrePrisonerJailedEvent event) { public void preJailingListener(PrePrisonerJailedEvent event) {
pl.getJailIO().addRecordEntry(event.getPrisoner().getUUID().toString(), if(pl.getConfig().getBoolean(Settings.LOGJAILINGTOPROFILE.getPath())) {
event.getPrisoner().getLastKnownName(), pl.getJailIO().addRecordEntry(event.getPrisoner().getUUID().toString(),
event.getPrisoner().getJailer(), dateFormat.format(new Date()), event.getPrisoner().getLastKnownName(),
event.getPrisoner().getRemainingTimeInMinutes(), event.getPrisoner().getReason()); event.getPrisoner().getJailer(), dateFormat.format(new Date()),
event.getPrisoner().getRemainingTimeInMinutes(), event.getPrisoner().getReason());
}
} }
@EventHandler(ignoreCancelled=true) @EventHandler(ignoreCancelled=true)
public void preJailingListener(PrePrisonerJailedByJailStickEvent event) { public void preJailingListener(PrePrisonerJailedByJailStickEvent event) {
pl.getJailIO().addRecordEntry(event.getPrisoner().getUUID().toString(), if(pl.getConfig().getBoolean(Settings.LOGJAILINGTOPROFILE.getPath())) {
event.getPrisoner().getLastKnownName(), pl.getJailIO().addRecordEntry(event.getPrisoner().getUUID().toString(),
event.getPrisoner().getJailer(), dateFormat.format(new Date()), event.getPrisoner().getLastKnownName(),
event.getPrisoner().getRemainingTimeInMinutes(), event.getPrisoner().getReason()); event.getPrisoner().getJailer(), dateFormat.format(new Date()),
event.getPrisoner().getRemainingTimeInMinutes(), event.getPrisoner().getReason());
}
} }
@EventHandler @EventHandler

View File

@ -1,5 +1,5 @@
system: system:
configVersion: 3 version: 3
debug: false debug: false
language: 'en' language: 'en'
updates: updates:
@ -30,9 +30,10 @@ jailing:
countDownTimeWhileOffline: false countDownTimeWhileOffline: false
cropTramplingPenalty: 5m cropTramplingPenalty: 5m
cropTramplingProtection: true cropTramplingProtection: true
foodControl: true foodControl:
foodControlMax: 20 enabled: true
foodControlMin: 10 max: 20
min: 10
ignoreSleeping: true ignoreSleeping: true
maxAFKTime: 10m #in minutes maxAFKTime: 10m #in minutes
movePenalty: 10m movePenalty: 10m
@ -57,14 +58,16 @@ jailing:
legs: leather_leggings~175,105,33 legs: leather_leggings~175,105,33
boots: leather_boots~175,105,33 boots: leather_boots~175,105,33
commands: [] commands: []
defaultJail: nearest #the jail nearest to the player default:
defaultTime: 30m #default the time to 30 minutes, if no time jail: nearest #the jail nearest to the player
time: 30m #default the time to 30 minutes, if no time
gameMode: adventure gameMode: adventure
inventory: inventory:
blacklist: [] #items they aren't allowed to keep blacklist: [] #items they aren't allowed to keep
store: true store: true
logToConsole: true log:
logToProfile: false console: true
profile: true
release: release:
backToPreviousPosition: false backToPreviousPosition: false
commands: [] commands: []

View File

@ -3,6 +3,8 @@ package test.java.com.graywolf336.jail;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import java.util.List;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -14,6 +16,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import test.java.com.graywolf336.jail.util.TestInstanceCreator; import test.java.com.graywolf336.jail.util.TestInstanceCreator;
import com.graywolf336.jail.JailMain; import com.graywolf336.jail.JailMain;
import com.graywolf336.jail.enums.Settings;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({ JailMain.class, PluginDescriptionFile.class }) @PrepareForTest({ JailMain.class, PluginDescriptionFile.class })
@ -46,40 +49,131 @@ public class TestJailStuff {
} }
@Test @Test
public void testDefaultConfig() { public void testSystemDefaultConfig() {
assertEquals("The config version is not 3.", 3, main.getConfig().getInt("system.configVersion")); assertEquals("The config version is not 3.", 3, main.getConfig().getInt(Settings.CONFIGVERSION.getPath()));
//This is enabled by default in testing. assertTrue("Default debugging is off.", main.getConfig().getBoolean(Settings.DEBUG.getPath()));
//assertFalse("Default debugging is on.", main.getConfig().getBoolean("system.debug")); assertEquals("Default language is not 'en'.", "en", main.getConfig().getString(Settings.LANGUAGE.getPath()));
assertEquals("Default updating channel is not bukkit.", "bukkit", main.getConfig().getString("system.updates.channel")); assertEquals("Default updating channel is not bukkit.", "bukkit", main.getConfig().getString(Settings.UPDATECHANNEL.getPath()));
assertTrue("Default updating notifications is false.", main.getConfig().getBoolean("system.updates.notification")); assertTrue("Default updating notifications is false.", main.getConfig().getBoolean(Settings.UPDATENOTIFICATIONS.getPath()));
assertEquals("Default updating time checking is not 1h.", "1h", main.getConfig().getString("system.updates.time")); assertEquals("Default updating time checking is not 1h.", "1h", main.getConfig().getString(Settings.UPDATETIME.getPath()));
assertTrue("Default usage of bukkit timer is false.", main.getConfig().getBoolean(Settings.USEBUKKITTIMER.getPath()));
}
//Storage system @Test
public void testStorageDefaultConfig() {
assertEquals("The default storage system is not flatfile.", "flatfile", main.getConfig().getString("storage.type")); assertEquals("The default storage system is not flatfile.", "flatfile", main.getConfig().getString("storage.type"));
assertEquals("The default mysql host is not localhost.", "localhost", main.getConfig().getString("storage.mysql.host")); assertEquals("The default mysql host is not localhost.", "localhost", main.getConfig().getString("storage.mysql.host"));
assertEquals("The default mysql port is not 3306.", 3306, main.getConfig().getInt("storage.mysql.port")); assertEquals("The default mysql port is not 3306.", 3306, main.getConfig().getInt("storage.mysql.port"));
assertEquals("The default mysql username is not root.", "root", main.getConfig().getString("storage.mysql.username")); assertEquals("The default mysql username is not root.", "root", main.getConfig().getString("storage.mysql.username"));
assertEquals("The default mysql password is not password.", "password", main.getConfig().getString("storage.mysql.password")); assertEquals("The default mysql password is not password.", "password", main.getConfig().getString("storage.mysql.password"));
assertEquals("The default mysql database is not jailDatabase.", "jailDatabase", main.getConfig().getString("storage.mysql.database"));
assertEquals("The default mysql prefix is not j3_.", "j3_", main.getConfig().getString("storage.mysql.prefix"));
}
//Settings pertaining to being jailed @Test
assertFalse("Default setting for counting down time while prisoner is offline is true.", main.getConfig().getBoolean("jailing.during.countDownTimeWhileOffline")); public void testDuringJailingDefaultConfig() {
assertTrue("Default setting for ignoring sleeping is false.", main.getConfig().getBoolean("jailing.during.ignoreSleeping")); // block breaking section
assertTrue("Default setting for opening a chest is false.", main.getConfig().getBoolean("jailing.during.openChest")); assertEquals("Default setting for block break penalty is not 5m.", "5m", main.getConfig().getString(Settings.BLOCKBREAKPENALTY.getPath()));
assertTrue("Default setting for block break proection is false.", main.getConfig().getBoolean(Settings.BLOCKBREAKPROTECTION.getPath()));
//Settings pertaining to when jailed List<String> blockbreakwhite = main.getConfig().getStringList(Settings.BLOCKBREAKWHITELIST.getPath());
assertTrue("Default setting for automatically muting is false.", main.getConfig().getBoolean("jailing.jail.automaticMute")); assertTrue("Default block breaking doesn't contain crops.", blockbreakwhite.contains("crops"));
assertFalse("Default setting for broadcasting a jailing is true.", main.getConfig().getBoolean("jailing.jail.broadcastJailing")); assertTrue("Default block breaking doesn't contain carrot.", blockbreakwhite.contains("carrot"));
assertEquals("Default setting for commands contains information.", 0, main.getConfig().getList("jailing.jail.commands").size()); assertTrue("Default block breaking doesn't contain potato.", blockbreakwhite.contains("potato"));
assertEquals("Default setting for default jail is not 'nearest' but something else.", "nearest", main.getConfig().getString("jailing.jail.defaultJail"));
assertEquals("Default setting for time is not 30 minutes.", "30m", main.getConfig().getString("jailing.jail.defaultTime"));
assertFalse("Default setting for deleting inventory is true.", main.getConfig().getBoolean("jailing.jail.deleteInventory"));
assertTrue("Default setting for logging to console when someone is jailed is false.", main.getConfig().getBoolean("jailing.jail.logToConsole"));
assertFalse("Default setting for logging to prisoner's profile is true.", main.getConfig().getBoolean("jailing.jail.logToProfile"));
assertTrue("Default setting for storing prisoner's inventory upon jailing is false.", main.getConfig().getBoolean("jailing.jail.inventory.store"));
//Settings pertaining to after a prisoner is released // block placing section
assertFalse("Default setting for releasing back to previous position is true.", main.getConfig().getBoolean("jailing.release.backToPreviousPosition")); assertEquals("Default setting for block place penalty is not 5m.", "5m", main.getConfig().getString(Settings.BLOCKPLACEPENALTY.getPath()));
assertEquals("Default setting for commands contains information.", 0, main.getConfig().getList("jailing.release.commands").size()); assertTrue("Default setting for block place proection is false.", main.getConfig().getBoolean(Settings.BLOCKPLACEPROTECTION.getPath()));
assertTrue("Default setting for teleporting them out of the jail is false.", main.getConfig().getBoolean("jailing.release.teleport"));
List<String> blockplacewhite = main.getConfig().getStringList(Settings.BLOCKPLACEWHITELIST.getPath());
assertTrue("Default block placing whitelist doesn't contain crops.", blockplacewhite.contains("crops"));
assertTrue("Default block placing whitelist doesn't contain carrot.", blockplacewhite.contains("carrot"));
assertTrue("Default block placing whitelist doesn't contain potato.", blockplacewhite.contains("potato"));
// command protection section
assertEquals("Default setting for command penalty is not 5m.", "5m", main.getConfig().getString(Settings.COMMANDPENALTY.getPath()));
assertTrue("Default setting for command proection is false.", main.getConfig().getBoolean(Settings.COMMANDPROTECTION.getPath()));
List<String> commandwhite = main.getConfig().getStringList(Settings.COMMANDWHITELIST.getPath());
assertTrue("Default command whitelist doesn't contain /ping.", commandwhite.contains("/ping"));
assertTrue("Default command whitelist doesn't contain /list.", commandwhite.contains("/list"));
assertTrue("Default command whitelist doesn't contain /jail status.", commandwhite.contains("/jail status"));
assertTrue("Default command whitelist doesn't contain /jail pay.", commandwhite.contains("/jail pay"));
assertFalse("Default setting for counting down time while prisoner is offline is true.", main.getConfig().getBoolean(Settings.COUNTDOWNTIMEOFFLINE.getPath()));
assertEquals("Default setting for crop trampling penalty is not 5m.", "5m", main.getConfig().getString(Settings.CROPTRAMPLINGPENALTY.getPath()));
assertTrue("Default setting for crop trampling proection is false.", main.getConfig().getBoolean(Settings.CROPTRAMPLINGPROTECTION.getPath()));
assertTrue("Default setting for food control enabled is false.", main.getConfig().getBoolean(Settings.FOODCONTROL.getPath()));
assertEquals("Default setting for food control max is not 20.", 20, main.getConfig().getInt(Settings.FOODCONTROLMAX.getPath()));
assertEquals("Default setting for food control min is not 10.", 10, main.getConfig().getInt(Settings.FOODCONTROLMIN.getPath()));
assertTrue("Default setting for ignoring sleeping is false.", main.getConfig().getBoolean(Settings.IGNORESLEEPINGSTATE.getPath()));
assertEquals("Default setting max afk time is not 10 minutes.", "10m", main.getConfig().getString(Settings.MAXAFKTIME.getPath()));
assertEquals("Default setting move penalty is not 10 minutes.", "10m", main.getConfig().getString(Settings.MOVEPENALTY.getPath()));
assertTrue("Default setting for move protection is false.", main.getConfig().getBoolean(Settings.MOVEPROTECTION.getPath()));
assertTrue("Default setting for opening a chest is false.", main.getConfig().getBoolean(Settings.PRISONEROPENCHEST.getPath()));
// interaction blocks protection section
List<String> interactionBlocks = main.getConfig().getStringList(Settings.PREVENTINTERACTIONBLOCKS.getPath());
assertTrue("Default interaction blocks whitelist doesn't contain wooden_door.", interactionBlocks.contains("wooden_door"));
assertTrue("Default interaction blocks whitelist doesn't contain iron_door_block.", interactionBlocks.contains("iron_door_block"));
assertEquals("Default setting for preventing interaction blocks penalty is not 5m.", "5m", main.getConfig().getString(Settings.PREVENTINTERACTIONBLOCKSPENALTY.getPath()));
// interaction items protection section
assertTrue("Default interaction items whitelist isn't empty.", main.getConfig().getStringList(Settings.PREVENTINTERACTIONITEMS.getPath()).isEmpty());
assertEquals("Default setting for preventing interaction blocks penalty is not 5m.", "5m", main.getConfig().getString(Settings.PREVENTINTERACTIONBLOCKSPENALTY.getPath()));
assertTrue("Default setting for recieving messages is false.", main.getConfig().getBoolean(Settings.RECIEVEMESSAGES.getPath()));
assertFalse("Default setting for scoreboard being enabled is true.", main.getConfig().getBoolean(Settings.SCOREBOARDENABLED.getPath()));
assertEquals("Default setting for the scoreboard title is not Jail Info.", "Jail Info", main.getConfig().getString(Settings.SCOREBOARDTITLE.getPath()));
assertEquals("Default setting for the scoreboard time language is not &aTime:", "&aTime:", main.getConfig().getString(Settings.SCOREBOARDTIME.getPath()));
}
@Test
public void testJailingDefaultConfig() {
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()));
assertEquals("Default setting for jail clothing's helmet is not leather_helmet~175,105,33.", "leather_helmet~175,105,33", main.getConfig().getString(Settings.CLOTHINGHELMET.getPath()));
assertEquals("Default setting for jail clothing's chestplate is not leather_chestplate~175,105,33.", "leather_chestplate~175,105,33", main.getConfig().getString(Settings.CLOTHINGCHEST.getPath()));
assertEquals("Default setting for jail clothing's legs is not leather_leggings~175,105,33.", "leather_leggings~175,105,33", main.getConfig().getString(Settings.CLOTHINGLEGS.getPath()));
assertEquals("Default setting for jail clothing's boots is not leather_boots~175,105,33.", "leather_boots~175,105,33", main.getConfig().getString(Settings.CLOTHINGBOOTS.getPath()));
assertTrue("Default setting for commands is not empty.", main.getConfig().getStringList(Settings.COMMANDSONJAIL.getPath()).isEmpty());
assertEquals("Default setting for default jail is not 'nearest' but something else.", "nearest", main.getConfig().getString(Settings.DEFAULTJAIL.getPath()));
assertEquals("Default setting for time is not 30 minutes.", "30m", main.getConfig().getString(Settings.DEFAULTTIME.getPath()));
assertEquals("Default setting for the prisoner's default gamemode is not adventure.", "adventure", main.getConfig().getString(Settings.JAILEDGAMEMODE.getPath()));
assertTrue("Default setting for inventory storing blacklist is not empty.", main.getConfig().getStringList(Settings.JAILEDINVENTORYBLACKLIST.getPath()).isEmpty());
assertTrue("Default setting for inventory storing is false.", main.getConfig().getBoolean(Settings.JAILEDSTOREINVENTORY.getPath()));
assertTrue("Default setting for logging to console when someone is jailed is false.", main.getConfig().getBoolean(Settings.LOGJAILINGTOCONSOLE.getPath()));
assertTrue("Default setting for logging to prisoner's profile is false.", main.getConfig().getBoolean(Settings.LOGJAILINGTOPROFILE.getPath()));
}
@Test
public void testReleaseDefaultConfig() {
assertFalse("Default setting for releasing back to previous position is true.", main.getConfig().getBoolean(Settings.RELEASETOPREVIOUSPOSITION.getPath()));
assertTrue("Default setting for commands is not empty.", main.getConfig().getStringList(Settings.COMMANDSONRELEASE.getPath()).isEmpty());
assertFalse("Default setting for restoring previous gamemode is true.", main.getConfig().getBoolean(Settings.RESTOREPREVIOUSGAMEMODE.getPath()));
assertTrue("Default setting for teleporting them out of the jail is false.", main.getConfig().getBoolean(Settings.TELEPORTONRELEASE.getPath()));
}
@Test
public void testJailsDefaultConfig() {
assertTrue("Default setting for protecting jails from endermen is false.", main.getConfig().getBoolean(Settings.ENDERMENPROTECTION.getPath()));
assertTrue("Default setting for protecting jails from explosions is false.", main.getConfig().getBoolean(Settings.EXPLOSIONPROTECTION.getPath()));
}
@Test
public void testJailPayDefaultConfig() {
assertFalse("Default setting for jail pay enabled is true, meaning Jail Pay somehow got enabled in testing.", main.getConfig().getBoolean(Settings.JAILPAYENABLED.getPath()));
assertEquals("Default setting for jail pay item is not air.", "air", main.getConfig().getString(Settings.JAILPAYITEM.getPath()));
assertEquals("Default setting for jail pay price per minute is not 1.5.", 1.5, main.getConfig().getDouble(Settings.JAILPAYPRICEPERMINUTE.getPath()), 0);
assertEquals("Default setting for jail pay price for infinite is not 10000.", 10000, main.getConfig().getDouble(Settings.JAILPAYPRICEINFINITE.getPath()), 0);
}
@Test
public void testJailStickDefaultConfig() {
assertTrue("Default setting for jail stick enabled is false.", main.getConfig().getBoolean(Settings.JAILSTICKENABLED.getPath()));
List<String> jailSticks = main.getConfig().getStringList(Settings.JAILSTICKSTICKS.getPath());
assertTrue("Default setting for jail sticks doesn't contain a stick with item of stick.", jailSticks.contains("stick,30m,,Running away,-1"));
assertTrue("Default setting for jail sticks doesn't contain a stick with item of blaze_rod.", jailSticks.contains("blaze_rod,15m,,Having too much fun,6"));
} }
} }