mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2024-06-25 10:14:56 +02:00
Version 1.2.1 (#32)
* Version 1.2.1 * Added null checks. * Added null checks. * Added tests for Settings. * Improve code smells * Updated .gitignore * Made fields local * JavaDoc fixes * Make fields final * Removed exception * Renamed plugin Pladdon * Enderpearls were moving islandd centers in other worlds https://github.com/BentoBoxWorld/Boxed/issues/31
This commit is contained in:
parent
1453239a96
commit
e99802ba33
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
|||
/.DS_Store
|
||||
/pom.xml.versionsBackup
|
||||
/bin/
|
||||
/boxed.iml
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -59,13 +59,13 @@
|
|||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.17-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>1.17.0</bentobox.version>
|
||||
<bentobox.version>1.17.3</bentobox.version>
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
<revision>${build.version}-SNAPSHOT</revision>
|
||||
<!-- Do not change unless you want different name for local builds. -->
|
||||
<build.number>-LOCAL</build.number>
|
||||
<!-- This allows to change between versions. -->
|
||||
<build.version>1.2.0</build.version>
|
||||
<build.version>1.2.1</build.version>
|
||||
|
||||
<sonar.projectKey>BentoBoxWorld_Boxed</sonar.projectKey>
|
||||
<sonar.organization>bentobox-world</sonar.organization>
|
||||
|
|
|
@ -37,7 +37,7 @@ public class AdvancementsManager {
|
|||
private int unknownAdvChange;
|
||||
|
||||
/**
|
||||
* @param addon
|
||||
* @param addon addon
|
||||
*/
|
||||
public AdvancementsManager(Boxed addon) {
|
||||
this.addon = addon;
|
||||
|
|
|
@ -49,11 +49,10 @@ public class Boxed extends GameModeAddon {
|
|||
// Settings
|
||||
private Settings settings;
|
||||
private ChunkGenerator chunkGenerator;
|
||||
private Config<Settings> configObject = new Config<>(this, Settings.class);
|
||||
private final Config<Settings> configObject = new Config<>(this, Settings.class);
|
||||
private AdvancementsManager advManager;
|
||||
private DeleteGen delChunks;
|
||||
private ChunkGenerator netherChunkGenerator;
|
||||
private PlaceholdersManager phManager;
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
@ -104,10 +103,10 @@ public class Boxed extends GameModeAddon {
|
|||
return;
|
||||
}
|
||||
// Check for recommended addons
|
||||
if (!this.getPlugin().getAddonsManager().getAddonByName("Border").isPresent()) {
|
||||
if (this.getPlugin().getAddonsManager().getAddonByName("Border").isEmpty()) {
|
||||
this.logWarning("Boxed normally requires the Border addon.");
|
||||
}
|
||||
if (!this.getPlugin().getAddonsManager().getAddonByName("InvSwitcher").isPresent()) {
|
||||
if (this.getPlugin().getAddonsManager().getAddonByName("InvSwitcher").isEmpty()) {
|
||||
this.logWarning("Boxed normally requires the InvSwitcher addon for per-world Advancements.");
|
||||
}
|
||||
// Advancements manager
|
||||
|
@ -130,7 +129,7 @@ public class Boxed extends GameModeAddon {
|
|||
this.registerListener(new EnderPearlListener(this));
|
||||
|
||||
// Register placeholders
|
||||
phManager = new PlaceholdersManager(this);
|
||||
PlaceholdersManager phManager = new PlaceholdersManager(this);
|
||||
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"visited_island_advancements", phManager::getCountByLocation);
|
||||
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"island_advancements", phManager::getCount);
|
||||
|
||||
|
|
|
@ -33,9 +33,12 @@ public class PlaceholdersManager {
|
|||
* @return string of advancement count
|
||||
*/
|
||||
public String getCountByLocation(User user) {
|
||||
if (user == null || user.getUniqueId() == null) return "";
|
||||
return addon.getIslands().getIslandAt(user.getLocation())
|
||||
.map(i -> String.valueOf(addon.getAdvManager().getIsland(i).getAdvancements().size())).orElse("");
|
||||
if (user != null && user.getUniqueId() != null && user.getLocation() != null) {
|
||||
return addon.getIslands().getIslandAt(user.getLocation())
|
||||
.map(i -> String.valueOf(addon.getAdvManager().getIsland(i).getAdvancements().size())).orElse("");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,11 +36,6 @@ abstract class AbstractBoxedBiomeGenerator implements BiomeGenerator {
|
|||
ENV_MAP = Collections.unmodifiableMap(e);
|
||||
}
|
||||
|
||||
private final SortedMap<Double, Biome> northEast;
|
||||
private final SortedMap<Double, Biome> southEast;
|
||||
private final SortedMap<Double, Biome> northWest;
|
||||
private final SortedMap<Double, Biome> southWest;
|
||||
|
||||
protected final Map<BlockFace, SortedMap<Double, Biome>> quadrants;
|
||||
|
||||
private final Boxed addon;
|
||||
|
@ -50,7 +45,7 @@ abstract class AbstractBoxedBiomeGenerator implements BiomeGenerator {
|
|||
private final Biome defaultBiome;
|
||||
|
||||
|
||||
public AbstractBoxedBiomeGenerator(Boxed boxed, Environment env, Biome defaultBiome) {
|
||||
protected AbstractBoxedBiomeGenerator(Boxed boxed, Environment env, Biome defaultBiome) {
|
||||
this.addon = boxed;
|
||||
this.defaultBiome = defaultBiome;
|
||||
dist = addon.getSettings().getIslandDistance();
|
||||
|
@ -62,10 +57,10 @@ abstract class AbstractBoxedBiomeGenerator implements BiomeGenerator {
|
|||
addon.saveResource("biomes.yml", true);
|
||||
}
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(biomeFile);
|
||||
northEast = loadQuad(config, ENV_MAP.get(env) + ".north-east");
|
||||
southEast = loadQuad(config, ENV_MAP.get(env) + ".south-east");
|
||||
northWest = loadQuad(config, ENV_MAP.get(env) + ".north-west");
|
||||
southWest = loadQuad(config, ENV_MAP.get(env) + ".south-west");
|
||||
SortedMap<Double, Biome> northEast = loadQuad(config, ENV_MAP.get(env) + ".north-east");
|
||||
SortedMap<Double, Biome> southEast = loadQuad(config, ENV_MAP.get(env) + ".south-east");
|
||||
SortedMap<Double, Biome> northWest = loadQuad(config, ENV_MAP.get(env) + ".north-west");
|
||||
SortedMap<Double, Biome> southWest = loadQuad(config, ENV_MAP.get(env) + ".south-west");
|
||||
|
||||
quadrants = new EnumMap<>(BlockFace.class);
|
||||
quadrants.put(BlockFace.NORTH_EAST, northEast);
|
||||
|
|
|
@ -15,7 +15,7 @@ public class BoxedChunkGenerator {
|
|||
|
||||
private final WorldRef wordRef;
|
||||
private final Boxed addon;
|
||||
private WorldRef wordRefNether;
|
||||
private final WorldRef wordRefNether;
|
||||
|
||||
public BoxedChunkGenerator(Boxed addon) {
|
||||
this.addon = addon;
|
||||
|
|
|
@ -19,7 +19,7 @@ public class DeleteGen extends ChunkGenerator {
|
|||
|
||||
private final Map<World, World> backMap;
|
||||
/**
|
||||
* @param addon
|
||||
* @param addon addon
|
||||
*/
|
||||
public DeleteGen(Boxed addon) {
|
||||
backMap = new HashMap<>();
|
||||
|
|
|
@ -27,7 +27,6 @@ public class NetherGenerator implements BaseNoiseGenerator {
|
|||
private final BiomeNoise defaultNoise = new BiomeNoise(10D, 0D, 2D);
|
||||
private final NoiseGenerator mainNoiseGenerator;
|
||||
private final Boxed addon;
|
||||
private final YamlConfiguration config;
|
||||
private final Map<Biome, BiomeNoise> biomeNoiseMap;
|
||||
|
||||
|
||||
|
@ -40,7 +39,7 @@ public class NetherGenerator implements BaseNoiseGenerator {
|
|||
if (!biomeFile.exists()) {
|
||||
addon.saveResource("biomes.yml", true);
|
||||
}
|
||||
config = YamlConfiguration.loadConfiguration(biomeFile);
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(biomeFile);
|
||||
biomeNoiseMap = new EnumMap<>(Biome.class);
|
||||
if (config.isConfigurationSection(NETHER_BIOMES)) {
|
||||
for (String key : config.getConfigurationSection(NETHER_BIOMES).getKeys(false)) {
|
||||
|
@ -53,14 +52,14 @@ public class NetherGenerator implements BaseNoiseGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
class BiomeNoise {
|
||||
static class BiomeNoise {
|
||||
double noiseScaleHorizontal = 10D;
|
||||
double height = 0D;
|
||||
double noiseScaleVertical = 2D;
|
||||
/**
|
||||
* @param noiseScaleHorizontal
|
||||
* @param height
|
||||
* @param noiseScaleVertical
|
||||
* @param noiseScaleHorizontal horizontal noise scale
|
||||
* @param height height
|
||||
* @param noiseScaleVertical vertical noise scale
|
||||
*/
|
||||
public BiomeNoise(double noiseScaleHorizontal, double height, double noiseScaleVertical) {
|
||||
this.noiseScaleHorizontal = noiseScaleHorizontal;
|
||||
|
|
|
@ -3,6 +3,7 @@ package world.bentobox.boxed.listeners;
|
|||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
@ -42,14 +43,14 @@ import world.bentobox.boxed.Boxed;
|
|||
*/
|
||||
public class AdvancementListener implements Listener {
|
||||
|
||||
private Boxed addon;
|
||||
private final Boxed addon;
|
||||
private final Advancement netherAdvancement;
|
||||
private final Advancement endAdvancement;
|
||||
private final Advancement netherRoot;
|
||||
private final Advancement endRoot;
|
||||
|
||||
/**
|
||||
* @param addon
|
||||
* @param addon addon
|
||||
*/
|
||||
public AdvancementListener(Boxed addon) {
|
||||
this.addon = addon;
|
||||
|
@ -77,20 +78,27 @@ public class AdvancementListener implements Listener {
|
|||
e.getAdvancement().getCriteria().forEach(c ->
|
||||
e.getPlayer().getAdvancementProgress(e.getAdvancement()).revokeCriteria(c));
|
||||
User u = User.getInstance(e.getPlayer());
|
||||
u.notify("boxed.adv-disallowed", TextVariables.NAME, e.getPlayer().getName(), TextVariables.DESCRIPTION, this.keyToString(u, e.getAdvancement().getKey()));
|
||||
if (u != null) {
|
||||
u.notify("boxed.adv-disallowed", TextVariables.NAME, e.getPlayer().getName(), TextVariables.DESCRIPTION, this.keyToString(u, e.getAdvancement().getKey()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int score = addon.getAdvManager().addAdvancement(e.getPlayer(), e.getAdvancement());
|
||||
if (score != 0) {
|
||||
User user = User.getInstance(e.getPlayer());
|
||||
Bukkit.getScheduler().runTask(addon.getPlugin(), () -> tellTeam(user, e.getAdvancement().getKey(), score));
|
||||
if (user != null) {
|
||||
Bukkit.getScheduler().runTask(addon.getPlugin(), () -> tellTeam(user, e.getAdvancement().getKey(), score));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tellTeam(User user, NamespacedKey key, int score) {
|
||||
Island island = addon.getIslands().getIsland(addon.getOverWorld(), user);
|
||||
if (island == null) {
|
||||
return;
|
||||
}
|
||||
island.getMemberSet(RanksManager.MEMBER_RANK).stream()
|
||||
.map(User::getInstance)
|
||||
.filter(User::isOnline)
|
||||
|
@ -119,16 +127,16 @@ public class AdvancementListener implements Listener {
|
|||
int diff = addon.getAdvManager().checkIslandSize(island);
|
||||
if (diff > 0) {
|
||||
user.sendMessage("boxed.size-changed", TextVariables.NUMBER, String.valueOf(diff));
|
||||
user.getPlayer().playSound(user.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 2F);
|
||||
user.getPlayer().playSound(Objects.requireNonNull(user.getLocation()), Sound.ENTITY_PLAYER_LEVELUP, 1F, 2F);
|
||||
} else if (diff < 0) {
|
||||
user.sendMessage("boxed.size-decreased", TextVariables.NUMBER, String.valueOf(Math.abs(diff)));
|
||||
user.getPlayer().playSound(user.getLocation(), Sound.ENTITY_VILLAGER_DEATH, 1F, 2F);
|
||||
user.getPlayer().playSound(Objects.requireNonNull(user.getLocation()), Sound.ENTITY_VILLAGER_DEATH, 1F, 2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void informPlayer(User user, NamespacedKey key, int score) {
|
||||
user.getPlayer().playSound(user.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 2F);
|
||||
user.getPlayer().playSound(Objects.requireNonNull(user.getLocation()), Sound.ENTITY_PLAYER_LEVELUP, 1F, 2F);
|
||||
user.sendMessage("boxed.completed", TextVariables.NAME, keyToString(user, key));
|
||||
user.sendMessage("boxed.size-changed", TextVariables.NUMBER, String.valueOf(score));
|
||||
|
||||
|
@ -137,7 +145,7 @@ public class AdvancementListener implements Listener {
|
|||
private String keyToString(User user, NamespacedKey key) {
|
||||
String adv = user.getTranslationOrNothing("boxed.advancements." + key.toString());
|
||||
if (adv.isEmpty()) {
|
||||
adv = Util.prettifyText(key.getKey().substring(key.getKey().lastIndexOf("/") + 1, key.getKey().length()));
|
||||
adv = Util.prettifyText(key.getKey().substring(key.getKey().lastIndexOf("/") + 1));
|
||||
}
|
||||
return adv;
|
||||
}
|
||||
|
@ -186,7 +194,7 @@ public class AdvancementListener implements Listener {
|
|||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onTeamJoinTime(TeamJoinedEvent e) {
|
||||
User user = User.getInstance(e.getPlayerUUID());
|
||||
if (addon.getSettings().isOnJoinResetAdvancements() && user.isOnline()
|
||||
if (user != null && addon.getSettings().isOnJoinResetAdvancements() && user.isOnline()
|
||||
&& addon.getOverWorld().equals(Util.getWorld(user.getWorld()))) {
|
||||
// Clear and set advancements
|
||||
clearAndSetAdv(user, addon.getSettings().isOnJoinResetAdvancements(), addon.getSettings().getOnJoinGrantAdvancements());
|
||||
|
@ -198,7 +206,7 @@ public class AdvancementListener implements Listener {
|
|||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onTeamLeaveTime(TeamLeaveEvent e) {
|
||||
User user = User.getInstance(e.getPlayerUUID());
|
||||
if (addon.getSettings().isOnJoinResetAdvancements() && user.isOnline()
|
||||
if (user != null && addon.getSettings().isOnJoinResetAdvancements() && user.isOnline()
|
||||
&& addon.getOverWorld().equals(Util.getWorld(user.getWorld()))) {
|
||||
// Clear and set advancements
|
||||
clearAndSetAdv(user, addon.getSettings().isOnLeaveResetAdvancements(), addon.getSettings().getOnLeaveGrantAdvancements());
|
||||
|
@ -208,7 +216,10 @@ public class AdvancementListener implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onFirstTime(IslandNewIslandEvent e) {
|
||||
clearAndSetAdv(User.getInstance(e.getPlayerUUID()), addon.getSettings().isOnJoinResetAdvancements(), addon.getSettings().getOnJoinGrantAdvancements());
|
||||
User user = User.getInstance(e.getPlayerUUID());
|
||||
if (user != null) {
|
||||
clearAndSetAdv(user, addon.getSettings().isOnJoinResetAdvancements(), addon.getSettings().getOnJoinGrantAdvancements());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,42 +252,11 @@ public class AdvancementListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
private void clearAdv(User user) {
|
||||
// Clear stats
|
||||
// Statistics
|
||||
Arrays.stream(Statistic.values()).forEach(s -> {
|
||||
switch(s.getType()) {
|
||||
case BLOCK:
|
||||
for (Material m: Material.values()) {
|
||||
if (m.isBlock() && !m.isLegacy()) {
|
||||
user.getPlayer().setStatistic(s, m, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEM:
|
||||
for (Material m: Material.values()) {
|
||||
if (m.isItem() && !m.isLegacy()) {
|
||||
user.getPlayer().setStatistic(s, m, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ENTITY:
|
||||
for (EntityType en: EntityType.values()) {
|
||||
if (en.isAlive()) {
|
||||
user.getPlayer().setStatistic(s, en, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNTYPED:
|
||||
user.getPlayer().setStatistic(s, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
Arrays.stream(Statistic.values()).forEach(s -> resetStats(user, s));
|
||||
// Clear advancements
|
||||
Iterator<Advancement> it = Bukkit.advancementIterator();
|
||||
while (it.hasNext()) {
|
||||
|
@ -287,4 +267,37 @@ public class AdvancementListener implements Listener {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void resetStats(User user, Statistic s) {
|
||||
switch(s.getType()) {
|
||||
case BLOCK:
|
||||
for (Material m: Material.values()) {
|
||||
if (m.isBlock() && !m.isLegacy()) {
|
||||
user.getPlayer().setStatistic(s, m, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ITEM:
|
||||
for (Material m: Material.values()) {
|
||||
if (m.isItem() && !m.isLegacy()) {
|
||||
user.getPlayer().setStatistic(s, m, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ENTITY:
|
||||
for (EntityType en: EntityType.values()) {
|
||||
if (en.isAlive()) {
|
||||
user.getPlayer().setStatistic(s, en, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNTYPED:
|
||||
user.getPlayer().setStatistic(s, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class EnderPearlListener implements Listener {
|
|||
private final Boxed addon;
|
||||
|
||||
/**
|
||||
* @param addon
|
||||
* @param addon addon
|
||||
*/
|
||||
public EnderPearlListener(Boxed addon) {
|
||||
this.addon = addon;
|
||||
|
@ -38,15 +38,15 @@ public class EnderPearlListener implements Listener {
|
|||
public void onEnderPearlLand(ProjectileHitEvent e) {
|
||||
if (!e.getEntityType().equals(EntityType.ENDER_PEARL)
|
||||
|| e.getHitBlock() == null
|
||||
|| !addon.getPlugin().getIWM().inWorld(e.getHitBlock().getLocation())) {
|
||||
|| !addon.inWorld(e.getHitBlock().getLocation())) {
|
||||
return;
|
||||
}
|
||||
Location l = e.getHitBlock().getRelative(BlockFace.UP).getLocation();
|
||||
EnderPearl ep = (EnderPearl)e.getEntity();
|
||||
if (ep.getShooter() instanceof Player) {
|
||||
User u = User.getInstance((Player)ep.getShooter());
|
||||
if (ep.getShooter() instanceof Player player) {
|
||||
User u = User.getInstance(player);
|
||||
addon.getIslands().getIslandAt(l).ifPresent(i -> {
|
||||
// Check flag
|
||||
// Check flag
|
||||
if (i.isAllowed(u, Boxed.MOVE_BOX) && addon.getIslands().isSafeLocation(l)) {
|
||||
// Reset home locations
|
||||
i.getMemberSet().forEach(uuid -> {
|
||||
|
|
|
@ -22,7 +22,7 @@ public class IslandAdvancements implements DataObject {
|
|||
List<String> advancements = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* @param uniqueId
|
||||
* @param uniqueId unique ID
|
||||
*/
|
||||
public IslandAdvancements(String uniqueId) {
|
||||
this.uniqueId = uniqueId;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name: Boxed
|
||||
name: Pladdon
|
||||
main: world.bentobox.boxed.BoxedPladdon
|
||||
version: ${version}
|
||||
api-version: 1.17
|
||||
|
|
421
src/test/java/world/bentobox/boxed/SettingsTest.java
Normal file
421
src/test/java/world/bentobox/boxed/SettingsTest.java
Normal file
|
@ -0,0 +1,421 @@
|
|||
package world.bentobox.boxed;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class SettingsTest {
|
||||
|
||||
Settings s;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
s = new Settings();
|
||||
}
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setFriendlyName(java.lang.String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetFriendlyName() {
|
||||
s.setFriendlyName("name");
|
||||
assertEquals("name", s.getFriendlyName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setWorldName(java.lang.String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetWorldName() {
|
||||
s.setWorldName("name");
|
||||
assertEquals("name", s.getWorldName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setDifficulty(org.bukkit.Difficulty)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetDifficulty() {
|
||||
s.setDifficulty(Difficulty.PEACEFUL);
|
||||
assertEquals(Difficulty.PEACEFUL, s.getDifficulty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setIslandDistance(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetIslandDistance() {
|
||||
s.setIslandDistance(123);
|
||||
assertEquals(123, s.getIslandDistance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setIslandProtectionRange(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetIslandProtectionRange() {
|
||||
s.setIslandProtectionRange(123);
|
||||
assertEquals(123, s.getIslandProtectionRange());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setIslandStartX(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetIslandStartX() {
|
||||
s.setIslandStartX(123);
|
||||
assertEquals(123, s.getIslandStartX());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setIslandStartZ(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetIslandStartZ() {
|
||||
s.setIslandStartZ(123);
|
||||
assertEquals(123, s.getIslandStartZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setIslandHeight(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetIslandHeight() {
|
||||
s.setIslandHeight(123);
|
||||
assertEquals(123, s.getIslandHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setMaxIslands(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetMaxIslands() {
|
||||
s.setMaxIslands(123);
|
||||
assertEquals(123, s.getMaxIslands());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setDefaultGameMode(org.bukkit.GameMode)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetDefaultGameMode() {
|
||||
s.setDefaultGameMode(GameMode.CREATIVE);
|
||||
assertEquals(GameMode.CREATIVE, s.getDefaultGameMode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setNetherGenerate(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetNetherGenerate() {
|
||||
s.setNetherGenerate(true);
|
||||
assertTrue(s.isNetherGenerate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setNetherSpawnRadius(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetNetherSpawnRadius() {
|
||||
s.setNetherSpawnRadius(123);
|
||||
assertEquals(123, s.getNetherSpawnRadius());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setEndGenerate(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetEndGenerate() {
|
||||
s.setEndGenerate(true);
|
||||
assertTrue(s.isEndGenerate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setRemoveMobsWhitelist(java.util.Set)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetRemoveMobsWhitelist() {
|
||||
Set<EntityType> wl = Collections.emptySet();
|
||||
s.setRemoveMobsWhitelist(wl);
|
||||
assertEquals(wl, s.getRemoveMobsWhitelist());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setWorldFlags(java.util.Map)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetWorldFlags() {
|
||||
Map<String, Boolean> worldFlags = Collections.emptyMap();
|
||||
s.setWorldFlags(worldFlags);
|
||||
assertEquals(worldFlags, s.getWorldFlags());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setHiddenFlags(java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetVisibleSettings() {
|
||||
List<String> visibleSettings = Collections.emptyList();
|
||||
s.setHiddenFlags(visibleSettings);
|
||||
assertEquals(visibleSettings, s.getHiddenFlags());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setVisitorBannedCommands(java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetVisitorBannedCommands() {
|
||||
List<String> visitorBannedCommands = Collections.emptyList();
|
||||
s.setVisitorBannedCommands(visitorBannedCommands);
|
||||
assertEquals(visitorBannedCommands, s.getVisitorBannedCommands());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setMaxTeamSize(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetMaxTeamSize() {
|
||||
s.setMaxTeamSize(123);
|
||||
assertEquals(123, s.getMaxTeamSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setMaxHomes(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetMaxHomes() {
|
||||
s.setMaxHomes(123);
|
||||
assertEquals(123, s.getMaxHomes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setResetLimit(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetResetLimit() {
|
||||
s.setResetLimit(123);
|
||||
assertEquals(123, s.getResetLimit());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setLeaversLoseReset(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetLeaversLoseReset() {
|
||||
s.setLeaversLoseReset(true);
|
||||
assertTrue(s.isLeaversLoseReset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setKickedKeepInventory(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetKickedKeepInventory() {
|
||||
s.setKickedKeepInventory(true);
|
||||
assertTrue(s.isKickedKeepInventory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setOnJoinResetMoney(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetOnJoinResetMoney() {
|
||||
s.setOnJoinResetMoney(true);
|
||||
assertTrue(s.isOnJoinResetMoney());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setOnJoinResetInventory(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetOnJoinResetInventory() {
|
||||
s.setOnJoinResetInventory(true);
|
||||
assertTrue(s.isOnJoinResetInventory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setOnJoinResetEnderChest(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetOnJoinResetEnderChest() {
|
||||
s.setOnJoinResetEnderChest(true);
|
||||
assertTrue(s.isOnJoinResetEnderChest());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setOnLeaveResetMoney(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetOnLeaveResetMoney() {
|
||||
s.setOnLeaveResetMoney(true);
|
||||
assertTrue(s.isOnLeaveResetMoney());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setOnLeaveResetInventory(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetOnLeaveResetInventory() {
|
||||
s.setOnLeaveResetInventory(true);
|
||||
assertTrue(s.isOnLeaveResetInventory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setOnLeaveResetEnderChest(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetOnLeaveResetEnderChest() {
|
||||
s.setOnLeaveResetEnderChest(true);
|
||||
assertTrue(s.isOnLeaveResetEnderChest());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setDeathsCounted(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetDeathsCounted() {
|
||||
s.setDeathsCounted(true);
|
||||
assertTrue(s.isDeathsCounted());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setDeathsMax(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetDeathsMax() {
|
||||
s.setDeathsMax(123);
|
||||
assertEquals(123, s.getDeathsMax());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setTeamJoinDeathReset(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetTeamJoinDeathReset() {
|
||||
s.setTeamJoinDeathReset(true);
|
||||
assertTrue(s.isTeamJoinDeathReset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setGeoLimitSettings(java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetGeoLimitSettings() {
|
||||
List<String> geoLimitSettings = Collections.emptyList();
|
||||
s.setGeoLimitSettings(geoLimitSettings);
|
||||
assertEquals(geoLimitSettings, s.getGeoLimitSettings());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setIvSettings(java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetIvSettings() {
|
||||
List<String> ivSettings = Collections.emptyList();
|
||||
s.setIvSettings(ivSettings);
|
||||
assertEquals(ivSettings, s.getIvSettings());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setAllowSetHomeInNether(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetAllowSetHomeInNether() {
|
||||
s.setAllowSetHomeInNether(true);
|
||||
assertTrue(s.isAllowSetHomeInNether());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setAllowSetHomeInTheEnd(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetAllowSetHomeInTheEnd() {
|
||||
s.setAllowSetHomeInTheEnd(true);
|
||||
assertTrue(s.isAllowSetHomeInTheEnd());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setRequireConfirmationToSetHomeInNether(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetRequireConfirmationToSetHomeInNether() {
|
||||
s.setRequireConfirmationToSetHomeInNether(true);
|
||||
assertTrue(s.isRequireConfirmationToSetHomeInNether());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setRequireConfirmationToSetHomeInTheEnd(boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetRequireConfirmationToSetHomeInTheEnd() {
|
||||
s.setRequireConfirmationToSetHomeInTheEnd(true);
|
||||
assertTrue(s.isRequireConfirmationToSetHomeInTheEnd());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setResetEpoch(long)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetResetEpoch() {
|
||||
s.setResetEpoch(123);
|
||||
assertEquals(123, s.getResetEpoch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#getPermissionPrefix()}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPermissionPrefix() {
|
||||
assertEquals("boxed", s.getPermissionPrefix());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#isWaterUnsafe()}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsWaterUnsafe() {
|
||||
assertFalse(s.isWaterUnsafe());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setBanLimit(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetBanLimit() {
|
||||
s.setBanLimit(123);
|
||||
assertEquals(123, s.getBanLimit());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link Settings#getPlayerCommandAliases()} Command()}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetIslandCommand() {
|
||||
s.setPlayerCommandAliases("island");
|
||||
assertEquals("island", s.getPlayerCommandAliases());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link Settings#getAdminCommandAliases()}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAdminCommand() {
|
||||
s.setAdminCommandAliases("admin");
|
||||
assertEquals("admin", s.getAdminCommandAliases());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user