diff --git a/.travis.yml b/.travis.yml
index af3496c..62d57c1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@ addons:
organization: "bentobox-world"
jdk:
- - openjdk8
+ - openjdk11
script:
# JaCoCo is used to have code coverage, the agent has to be activated
diff --git a/pom.xml b/pom.xml
index 4515a2c..f329fb0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,14 +58,14 @@
2.0.4
- 1.16.1-R0.1-SNAPSHOT
+ 1.16.2-R0.1-SNAPSHOT
1.14.0
${build.version}-SNAPSHOT
-LOCAL
- 1.14.2
+ 1.14.3
@@ -147,6 +147,10 @@
codemc-repo
https://repo.codemc.org/repository/maven-public/
+
+ ess-repo
+ https://ci.ender.zone/plugin/repository/everything/
+
@@ -192,6 +196,13 @@
org.eclipse.jdt.annotation
2.2.200
+
+
+ net.ess3
+ EssentialsX
+ 2.17.2
+ provided
+
@@ -267,11 +278,13 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.0.1
+ 3.2.0
+
public
false
-Xdoclint:none
+
diff --git a/src/main/java/world/bentobox/acidisland/AISettings.java b/src/main/java/world/bentobox/acidisland/AISettings.java
index ed8bc5a..513eaf7 100644
--- a/src/main/java/world/bentobox/acidisland/AISettings.java
+++ b/src/main/java/world/bentobox/acidisland/AISettings.java
@@ -153,7 +153,7 @@ public class AISettings implements WorldSettings {
@ConfigComment("World difficulty setting - PEACEFUL, EASY, NORMAL, HARD")
@ConfigComment("Other plugins may override this setting")
@ConfigEntry(path = "world.difficulty")
- private Difficulty difficulty;
+ private Difficulty difficulty = Difficulty.NORMAL;
@ConfigComment("Spawn limits. These override the limits set in bukkit.yml")
@ConfigComment("If set to a negative number, the server defaults will be used")
@@ -175,7 +175,6 @@ public class AISettings implements WorldSettings {
private int ticksPerMonsterSpawns = -1;
@ConfigComment("Radius of island in blocks. (So distance between islands is twice this)")
- @ConfigComment("Will be rounded up to the nearest 16 blocks.")
@ConfigComment("It is the same for every dimension : Overworld, Nether and End.")
@ConfigComment("This value cannot be changed mid-game and the plugin will not start if it is different.")
@ConfigEntry(path = "world.distance-between-islands", needsReset = true)
@@ -1082,7 +1081,9 @@ public class AISettings implements WorldSettings {
/**
* @param adminCommand what you want your admin command to be
*/
- public void setAdminCommand(String adminCommand) { this.adminCommandAliases = adminCommand; }
+ public void setAdminCommand(String adminCommand) {
+ this.adminCommandAliases = adminCommand;
+ }
/**
* @param allowSetHomeInNether the allowSetHomeInNether to set
*/
@@ -1196,7 +1197,9 @@ public class AISettings implements WorldSettings {
/**
* @param islandCommand what you want your island command to be
*/
- public void setIslandCommand(String islandCommand) { this.playerCommandAliases = islandCommand; }
+ public void setIslandCommand(String islandCommand) {
+ this.playerCommandAliases = islandCommand;
+ }
/**
* @param islandDistance the islandDistance to set
diff --git a/src/main/java/world/bentobox/acidisland/AcidIsland.java b/src/main/java/world/bentobox/acidisland/AcidIsland.java
index 92e05d1..ccedb2c 100644
--- a/src/main/java/world/bentobox/acidisland/AcidIsland.java
+++ b/src/main/java/world/bentobox/acidisland/AcidIsland.java
@@ -1,5 +1,6 @@
package world.bentobox.acidisland;
+import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
@@ -30,7 +31,7 @@ public class AcidIsland extends GameModeAddon {
private @Nullable AISettings settings;
private @Nullable AcidTask acidTask;
private @Nullable ChunkGenerator chunkGenerator;
- private Config config = new Config<>(this, AISettings.class);
+ private final Config config = new Config<>(this, AISettings.class);
private static final String NETHER = "_nether";
private static final String THE_END = "_the_end";
@@ -100,33 +101,28 @@ public class AcidIsland extends GameModeAddon {
return settings;
}
- @Override
- public void log(String string) {
- getPlugin().log(string);
- }
-
/* (non-Javadoc)
* @see world.bentobox.bentobox.api.addons.GameModeAddon#createWorlds()
*/
@Override
public void createWorlds() {
String worldName = settings.getWorldName().toLowerCase();
- if (getServer().getWorld(worldName) == null) {
- getLogger().info("Creating AcidIsland...");
+ if (Bukkit.getWorld(worldName) == null) {
+ log("Creating AcidIsland...");
}
// Create the world if it does not exist
chunkGenerator = new ChunkGeneratorWorld(this);
islandWorld = getWorld(worldName, World.Environment.NORMAL, chunkGenerator);
// Make the nether if it does not exist
if (settings.isNetherGenerate()) {
- if (getServer().getWorld(worldName + NETHER) == null) {
+ if (Bukkit.getWorld(worldName + NETHER) == null) {
log("Creating AcidIsland's Nether...");
}
netherWorld = settings.isNetherIslands() ? getWorld(worldName, World.Environment.NETHER, chunkGenerator) : getWorld(worldName, World.Environment.NETHER, null);
}
// Make the end if it does not exist
if (settings.isEndGenerate()) {
- if (getServer().getWorld(worldName + THE_END) == null) {
+ if (Bukkit.getWorld(worldName + THE_END) == null) {
log("Creating AcidIsland's End World...");
}
endWorld = settings.isEndIslands() ? getWorld(worldName, World.Environment.THE_END, chunkGenerator) : getWorld(worldName, World.Environment.THE_END, null);
@@ -161,7 +157,7 @@ public class AcidIsland extends GameModeAddon {
@Override
public WorldSettings getWorldSettings() {
- return settings;
+ return getSettings();
}
@Override
diff --git a/src/main/java/world/bentobox/acidisland/events/AbstractAcidEvent.java b/src/main/java/world/bentobox/acidisland/events/AbstractAcidEvent.java
new file mode 100644
index 0000000..130414c
--- /dev/null
+++ b/src/main/java/world/bentobox/acidisland/events/AbstractAcidEvent.java
@@ -0,0 +1,99 @@
+package world.bentobox.acidisland.events;
+
+import java.util.List;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.potion.PotionEffectType;
+
+/**
+ * This event is fired when a player is going to be burned by acid or acid rain
+ *
+ * @author tastybento
+ *
+ */
+public abstract class AbstractAcidEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ private Player player;
+ private final double protection;
+ /**
+ * @since 1.9.1
+ */
+ private List potionEffects;
+
+ private boolean cancelled;
+
+
+ /**
+ * @param player
+ * @param rainDamage
+ * @param protection
+ */
+ protected AbstractAcidEvent(Player player, double protection, List potionEffects) {
+ this.player = player;
+ this.protection = protection;
+ this.potionEffects = potionEffects;
+ }
+
+ /**
+ * @return the player being damaged by acid rain
+ */
+ public Player getPlayer() {
+ return player;
+ }
+
+ /**
+ * @param player the player to set
+ */
+ public void setPlayer(Player player) {
+ this.player = player;
+ }
+
+ /**
+ * Get the amount the damage was reduced for this player due to armor, etc.
+ * @return the protection
+ */
+ public double getProtection() {
+ return protection;
+ }
+
+ /**
+ * Returns the potion effects that will be applied to the player.
+ * @return list of potion effect types
+ * @since 1.9.1
+ */
+ public List getPotionEffects() {
+ return potionEffects;
+ }
+
+ /**
+ *
+ * @param potionEffects the potionEffects to set
+ * @since 1.9.1
+ */
+ public void setPotionEffects(List potionEffects) {
+ this.potionEffects = potionEffects;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return getHandlerList();
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+}
diff --git a/src/main/java/world/bentobox/acidisland/events/AcidEvent.java b/src/main/java/world/bentobox/acidisland/events/AcidEvent.java
index 48cf8f0..132b55e 100644
--- a/src/main/java/world/bentobox/acidisland/events/AcidEvent.java
+++ b/src/main/java/world/bentobox/acidisland/events/AcidEvent.java
@@ -3,9 +3,6 @@ package world.bentobox.acidisland.events;
import java.util.List;
import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
import org.bukkit.potion.PotionEffectType;
/**
@@ -14,13 +11,9 @@ import org.bukkit.potion.PotionEffectType;
* @author tastybento
*
*/
-public class AcidEvent extends Event implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
+public class AcidEvent extends AbstractAcidEvent {
- private Player player;
private double totalDamage;
- private final double protection;
- private List potionEffects;
/**
* @param player - player
@@ -29,26 +22,8 @@ public class AcidEvent extends Event implements Cancellable {
* @param potionEffects - potion effects given to the player
*/
public AcidEvent(Player player, double totalDamage, double protection, List potionEffects) {
- this.player = player;
+ super(player, protection, potionEffects);
this.totalDamage = totalDamage;
- this.protection = protection;
- this.potionEffects = potionEffects;
- }
-
- private boolean cancelled;
-
- /**
- * @return the player being damaged by acid rain
- */
- public Player getPlayer() {
- return player;
- }
-
- /**
- * @param player the player to set
- */
- public void setPlayer(Player player) {
- this.player = player;
}
/**
@@ -59,14 +34,6 @@ public class AcidEvent extends Event implements Cancellable {
return totalDamage;
}
- /**
- * Get the amount the damage was reduced for this player due to armor, etc.
- * @return the protection
- */
- public double getProtection() {
- return protection;
- }
-
/**
* @param totalDamage to set
*/
@@ -74,36 +41,4 @@ public class AcidEvent extends Event implements Cancellable {
this.totalDamage = totalDamage;
}
- /**
- * @return the potionEffects
- */
- public List getPotionEffects() {
- return potionEffects;
- }
-
- /**
- * @param potionEffects the potionEffects to set
- */
- public void setPotionEffects(List potionEffects) {
- this.potionEffects = potionEffects;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
}
diff --git a/src/main/java/world/bentobox/acidisland/events/AcidRainEvent.java b/src/main/java/world/bentobox/acidisland/events/AcidRainEvent.java
index f1ab40e..f83d8a4 100644
--- a/src/main/java/world/bentobox/acidisland/events/AcidRainEvent.java
+++ b/src/main/java/world/bentobox/acidisland/events/AcidRainEvent.java
@@ -3,9 +3,6 @@ package world.bentobox.acidisland.events;
import java.util.List;
import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
import org.bukkit.potion.PotionEffectType;
/**
@@ -14,44 +11,18 @@ import org.bukkit.potion.PotionEffectType;
* @author tastybento
*
*/
-public class AcidRainEvent extends Event implements Cancellable {
- private static final HandlerList handlers = new HandlerList();
-
- private Player player;
+public class AcidRainEvent extends AbstractAcidEvent {
private double rainDamage;
- private final double protection;
- /**
- * @since 1.9.1
- */
- private List potionEffects;
-
- private boolean cancelled;
-
/**
- * @param player
- * @param rainDamage
- * @param protection
+ * @param player - player
+ * @param rainDamage - rain damage caused
+ * @param protection - protection reducer to damage
+ * @param potionEffects - potion effects to apply if acid rain affects player
*/
public AcidRainEvent(Player player, double rainDamage, double protection, List potionEffects) {
- this.player = player;
+ super(player, protection, potionEffects);
this.rainDamage = rainDamage;
- this.protection = protection;
- this.potionEffects = potionEffects;
- }
-
- /**
- * @return the player being damaged by acid rain
- */
- public Player getPlayer() {
- return player;
- }
-
- /**
- * @param player the player to set
- */
- public void setPlayer(Player player) {
- this.player = player;
}
/**
@@ -62,14 +33,6 @@ public class AcidRainEvent extends Event implements Cancellable {
return rainDamage;
}
- /**
- * Get the amount the damage was reduced for this player due to armor, etc.
- * @return the protection
- */
- public double getProtection() {
- return protection;
- }
-
/**
* @param rainDamage the rainDamage to set
*/
@@ -77,40 +40,4 @@ public class AcidRainEvent extends Event implements Cancellable {
this.rainDamage = rainDamage;
}
- /**
- * Returns the potion effects that will be applied to the player.
- * @return list of potion effect types
- * @since 1.9.1
- */
- public List getPotionEffects() {
- return potionEffects;
- }
-
- /**
- *
- * @param potionEffects the potionEffects to set
- * @since 1.9.1
- */
- public void setPotionEffects(List potionEffects) {
- this.potionEffects = potionEffects;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
}
diff --git a/src/main/java/world/bentobox/acidisland/events/ItemFillWithAcidEvent.java b/src/main/java/world/bentobox/acidisland/events/ItemFillWithAcidEvent.java
index f93d30c..f2a2d24 100644
--- a/src/main/java/world/bentobox/acidisland/events/ItemFillWithAcidEvent.java
+++ b/src/main/java/world/bentobox/acidisland/events/ItemFillWithAcidEvent.java
@@ -15,7 +15,6 @@ public class ItemFillWithAcidEvent extends IslandBaseEvent {
private final Player player;
private final ItemStack item;
- // TODO: dispenser?
public ItemFillWithAcidEvent(Island island, Player player, ItemStack item) {
super(island);
this.player = player;
diff --git a/src/main/java/world/bentobox/acidisland/listeners/AcidEffect.java b/src/main/java/world/bentobox/acidisland/listeners/AcidEffect.java
index ed3ee5b..47a7d2d 100644
--- a/src/main/java/world/bentobox/acidisland/listeners/AcidEffect.java
+++ b/src/main/java/world/bentobox/acidisland/listeners/AcidEffect.java
@@ -1,12 +1,13 @@
package world.bentobox.acidisland.listeners;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.bukkit.Bukkit;
import org.bukkit.GameMode;
-import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World.Environment;
@@ -18,6 +19,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.EntityEquipment;
@@ -29,10 +31,13 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
+import com.earth2me.essentials.Essentials;
+
import world.bentobox.acidisland.AcidIsland;
import world.bentobox.acidisland.events.AcidEvent;
import world.bentobox.acidisland.events.AcidRainEvent;
import world.bentobox.acidisland.world.AcidTask;
+import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;
/**
@@ -43,22 +48,35 @@ import world.bentobox.bentobox.util.Util;
public class AcidEffect implements Listener {
private final AcidIsland addon;
- private final Map burningPlayers = new HashMap<>();
- private final Map wetPlayers = new HashMap<>();
- private static final List EFFECTS = Arrays.asList(
- PotionEffectType.BLINDNESS,
- PotionEffectType.CONFUSION,
- PotionEffectType.HUNGER,
- PotionEffectType.SLOW,
- PotionEffectType.SLOW_DIGGING,
- PotionEffectType.WEAKNESS,
- PotionEffectType.POISON);
- private static final List IMMUNE_EFFECTS = Arrays.asList(
- PotionEffectType.WATER_BREATHING,
- PotionEffectType.CONDUIT_POWER);
+ private final Map burningPlayers;
+ private final Map wetPlayers;
+ private Essentials essentials;
+ private boolean essentialsCheck;
+ private static final List EFFECTS;
+ static {
+ List pe = Arrays.asList(
+ PotionEffectType.BLINDNESS,
+ PotionEffectType.CONFUSION,
+ PotionEffectType.HUNGER,
+ PotionEffectType.SLOW,
+ PotionEffectType.SLOW_DIGGING,
+ PotionEffectType.WEAKNESS,
+ PotionEffectType.POISON);
+ EFFECTS = Collections.unmodifiableList(pe);
+ }
+
+ private static final List IMMUNE_EFFECTS;
+ static {
+ List im = Arrays.asList(
+ PotionEffectType.WATER_BREATHING,
+ PotionEffectType.CONDUIT_POWER);
+ IMMUNE_EFFECTS = Collections.unmodifiableList(im);
+ }
public AcidEffect(AcidIsland addon) {
this.addon = addon;
+ burningPlayers = new HashMap<>();
+ wetPlayers = new HashMap<>();
// Burn monsters or animals that fall into the acid
new AcidTask(addon);
}
@@ -93,7 +111,6 @@ public class AcidEffect implements Listener {
return;
}
// Slow checks
- Location playerLoc = player.getLocation();
// Check for acid rain
if (addon.getSettings().getAcidRainDamage() > 0D && addon.getOverWorld().hasStorm()) {
if (isSafeFromRain(player)) {
@@ -110,24 +127,10 @@ public class AcidEffect implements Listener {
@Override
public void run() {
// Check if it is still raining or player is safe or dead or there is no damage
- if (!addon.getOverWorld().hasStorm() || player.isDead() || isSafeFromRain(player) || addon.getSettings().getAcidRainDamage() <= 0D) {
- wetPlayers.remove(player);
+ if (checkForRain(player)) {
this.cancel();
- // Check they are still in this world
- } else if (wetPlayers.containsKey(player) && wetPlayers.get(player) < System.currentTimeMillis()) {
- double protection = addon.getSettings().getAcidRainDamage() * getDamageReduced(player);
- double totalDamage = Math.max(0, addon.getSettings().getAcidRainDamage() - protection);
- AcidRainEvent event = new AcidRainEvent(player, totalDamage, protection, addon.getSettings().getAcidRainEffects());
- addon.getServer().getPluginManager().callEvent(event);
- if (!event.isCancelled()) {
- event.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, addon.getSettings().getRainEffectDuation() * 20, 1)));
- // Apply damage if there is any
- if (event.getRainDamage() > 0D) {
- player.damage(event.getRainDamage());
- player.getWorld().playSound(playerLoc, Sound.ENTITY_CREEPER_PRIMED, 3F, 3F);
- }
- }
}
+
}
}.runTaskTimer(addon.getPlugin(), 0L, 20L);
}
@@ -135,10 +138,7 @@ public class AcidEffect implements Listener {
}
// If they are already burning in acid then return
- if (burningPlayers.containsKey(player)) {
- return;
- }
- if (isSafeFromAcid(player)) {
+ if (burningPlayers.containsKey(player) || isSafeFromAcid(player)) {
return;
}
// ACID!
@@ -149,39 +149,73 @@ public class AcidEffect implements Listener {
new BukkitRunnable() {
@Override
public void run() {
- if (player.isDead() || isSafeFromAcid(player)) {
- burningPlayers.remove(player);
+ if (continuouslyHurtPlayer(player)) {
this.cancel();
- } else if (burningPlayers.containsKey(player) && burningPlayers.get(player) < System.currentTimeMillis()) {
- double protection = addon.getSettings().getAcidDamage() * getDamageReduced(player);
- double totalDamage = Math.max(0, addon.getSettings().getAcidDamage() - protection);
- AcidEvent acidEvent = new AcidEvent(player, totalDamage, protection, addon.getSettings().getAcidEffects());
- addon.getServer().getPluginManager().callEvent(acidEvent);
- if (!acidEvent.isCancelled()) {
- acidEvent.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, addon.getSettings().getAcidEffectDuation() * 20, 1)));
- // Apply damage if there is any
- if (acidEvent.getTotalDamage() > 0D) {
- player.damage(acidEvent.getTotalDamage());
- player.getWorld().playSound(playerLoc, Sound.ENTITY_CREEPER_PRIMED, 3F, 3F);
- }
- }
}
+
}
}.runTaskTimer(addon.getPlugin(), 0L, 20L);
}
+ protected boolean checkForRain(Player player) {
+ if (!addon.getOverWorld().hasStorm() || player.isDead() || isSafeFromRain(player) || addon.getSettings().getAcidRainDamage() <= 0D) {
+ wetPlayers.remove(player);
+ return true;
+ // Check they are still in this world
+ } else if (wetPlayers.containsKey(player) && wetPlayers.get(player) < System.currentTimeMillis()) {
+ double protection = addon.getSettings().getAcidRainDamage() * getDamageReduced(player);
+ double totalDamage = Math.max(0, addon.getSettings().getAcidRainDamage() - protection);
+ AcidRainEvent event = new AcidRainEvent(player, totalDamage, protection, addon.getSettings().getAcidRainEffects());
+ addon.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ event.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, addon.getSettings().getRainEffectDuation() * 20, 1)));
+ // Apply damage if there is any
+ if (event.getRainDamage() > 0D) {
+ player.damage(event.getRainDamage());
+ player.getWorld().playSound(player.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 3F, 3F);
+ }
+ }
+ }
+ return false;
+ }
+
+ protected boolean continuouslyHurtPlayer(Player player) {
+ if (player.isDead() || isSafeFromAcid(player)) {
+ burningPlayers.remove(player);
+ return true;
+ } else if (burningPlayers.containsKey(player) && burningPlayers.get(player) < System.currentTimeMillis()) {
+ double protection = addon.getSettings().getAcidDamage() * getDamageReduced(player);
+ double totalDamage = Math.max(0, addon.getSettings().getAcidDamage() - protection);
+ AcidEvent event = new AcidEvent(player, totalDamage, protection, addon.getSettings().getAcidEffects());
+ addon.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ event.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, addon.getSettings().getAcidEffectDuation() * 20, 1)));
+ // Apply damage if there is any
+ if (event.getTotalDamage() > 0D) {
+ player.damage(event.getTotalDamage());
+ player.getWorld().playSound(player.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 3F, 3F);
+ }
+ }
+ }
+ return false;
+ }
+
/**
* Check if player is safe from rain
* @param player - player
* @return true if they are safe
*/
private boolean isSafeFromRain(Player player) {
- if (player.getWorld().getEnvironment().equals(Environment.NETHER)
+ if (isEssentialsGodMode(player)
+ || player.getWorld().getEnvironment().equals(Environment.NETHER)
|| player.getWorld().getEnvironment().equals(Environment.THE_END)
|| (addon.getSettings().isHelmetProtection() && (player.getInventory().getHelmet() != null && player.getInventory().getHelmet().getType().name().contains("HELMET")))
|| (!addon.getSettings().isAcidDamageSnow() && player.getLocation().getBlock().getTemperature() < 0.1) // snow falls
|| player.getLocation().getBlock().getHumidity() == 0 // dry
|| (player.getActivePotionEffects().stream().map(PotionEffect::getType).anyMatch(IMMUNE_EFFECTS::contains))
+ // Protect visitors
+ || (addon.getPlugin().getIWM().getIvSettings(player.getWorld()).contains(DamageCause.CUSTOM.name())
+ && !addon.getIslands().userIsOnIsland(player.getWorld(), User.getInstance(player)))
) {
return true;
}
@@ -200,6 +234,14 @@ public class AcidEffect implements Listener {
* @return true if player is safe
*/
private boolean isSafeFromAcid(Player player) {
+ // Check for GodMode
+ if (isEssentialsGodMode(player)
+ // Protect visitors
+ || (addon.getPlugin().getIWM().getIvSettings(player.getWorld()).contains(DamageCause.CUSTOM.name())
+ && !addon.getIslands().userIsOnIsland(player.getWorld(), User.getInstance(player)))
+ ) {
+ return true;
+ }
// Not in liquid or on snow
if (!player.getLocation().getBlock().getType().equals(Material.WATER)
&& !player.getLocation().getBlock().getType().equals(Material.BUBBLE_COLUMN)
@@ -221,6 +263,19 @@ public class AcidEffect implements Listener {
return player.getActivePotionEffects().stream().map(PotionEffect::getType).anyMatch(IMMUNE_EFFECTS::contains);
}
+ /**
+ * Checks if player has Essentials God Mode enabled.
+ * @param player - player
+ * @return true if God Mode enabled, false if not or if Essentials plug does not exist
+ */
+ private boolean isEssentialsGodMode(Player player) {
+ if (!essentialsCheck && essentials == null) {
+ essentials = (Essentials)Bukkit.getPluginManager().getPlugin("Essentials");
+ essentialsCheck = true;
+ }
+ return essentials != null && essentials.getUser(player).isGodModeEnabled();
+ }
+
/**
* Checks what protection armor provides and slightly damages it as a result of the acid
* @param le - player
@@ -236,35 +291,24 @@ public class AcidEffect implements Listener {
ItemStack helmet = inv.getHelmet();
ItemStack chest = inv.getChestplate();
ItemStack pants = inv.getLeggings();
- if (helmet != null) {
- // Damage if helmet
- if (helmet.getType().name().contains("HELMET") && damage(helmet)) {
- le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
- inv.setHelmet(null);
- }
+ // Damage if helmet
+ if (helmet != null&& helmet.getType().name().contains("HELMET") && damage(helmet)) {
+ le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
+ inv.setHelmet(null);
}
- if (boots != null) {
- // Damage
- if (damage(boots)) {
- le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
- inv.setBoots(null);
- }
+ if (boots != null && damage(boots)) {
+ le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
+ inv.setBoots(null);
}
// Pants
- if (pants != null) {
- // Damage
- if (damage(pants)) {
- le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
- inv.setLeggings(null);
- }
+ if (pants != null && damage(pants)) {
+ le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
+ inv.setLeggings(null);
}
// Chest plate
- if (chest != null) {
- // Damage
- if (damage(chest)) {
- le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
- inv.setChestplate(null);
- }
+ if (chest != null && damage(chest)) {
+ le.getWorld().playSound(le.getLocation(), Sound.ENTITY_ITEM_BREAK, 1F, 1F);
+ inv.setChestplate(null);
}
return red;
}
diff --git a/src/main/java/world/bentobox/acidisland/listeners/LavaCheck.java b/src/main/java/world/bentobox/acidisland/listeners/LavaCheck.java
index a0669a0..1cc0c3e 100644
--- a/src/main/java/world/bentobox/acidisland/listeners/LavaCheck.java
+++ b/src/main/java/world/bentobox/acidisland/listeners/LavaCheck.java
@@ -1,5 +1,6 @@
package world.bentobox.acidisland.listeners;
+import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.event.EventHandler;
@@ -8,6 +9,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFromToEvent;
import world.bentobox.acidisland.AcidIsland;
+import world.bentobox.bentobox.util.Util;
public class LavaCheck implements Listener {
@@ -26,14 +28,13 @@ public class LavaCheck implements Listener {
*/
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onCleanstoneGen(BlockFromToEvent e) {
- // Only do this in AcidIsland over world
- if (!e.getBlock().getWorld().equals(addon.getOverWorld()) || addon.getSettings().getAcidDamage() <= 0
- // TODO: backward compatibility hack
- || !(e.getToBlock().getType().name().equals("WATER"))) {
+ if (!(e.getToBlock().getType().equals(Material.WATER)
+ || !addon.getOverWorld().equals(Util.getWorld(e.getBlock().getWorld()))
+ || addon.getSettings().getAcidDamage() <= 0)) {
return;
}
Material prev = e.getToBlock().getType();
- addon.getServer().getScheduler().runTask(addon.getPlugin(), () -> {
+ Bukkit.getScheduler().runTask(addon.getPlugin(), () -> {
if (e.getToBlock().getType().equals(Material.STONE)) {
e.getToBlock().setType(prev);
e.getToBlock().getWorld().playSound(e.getToBlock().getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, 2F);
diff --git a/src/main/java/world/bentobox/acidisland/world/AcidTask.java b/src/main/java/world/bentobox/acidisland/world/AcidTask.java
index 1407e39..baa9720 100644
--- a/src/main/java/world/bentobox/acidisland/world/AcidTask.java
+++ b/src/main/java/world/bentobox/acidisland/world/AcidTask.java
@@ -27,7 +27,7 @@ public class AcidTask {
private final AcidIsland addon;
private static final List IMMUNE = Arrays.asList(EntityType.TURTLE, EntityType.POLAR_BEAR, EntityType.DROWNED);
private Map itemsInWater = new ConcurrentHashMap<>();
- private BukkitTask findMobsTask;
+ private final BukkitTask findMobsTask;
/**
* Runs repeating tasks to deliver acid damage to mobs, etc.
@@ -35,7 +35,7 @@ public class AcidTask {
*/
public AcidTask(AcidIsland addon) {
this.addon = addon;
- findMobsTask = Bukkit.getScheduler().runTaskTimerAsynchronously(addon.getPlugin(), () -> findEntities(), 0L, 20L);
+ findMobsTask = Bukkit.getScheduler().runTaskTimerAsynchronously(addon.getPlugin(), this::findEntities, 0L, 20L);
}
void findEntities() {
@@ -60,7 +60,7 @@ public class AcidTask {
}
}
// Remove any entities not on the burn list
- itemsInWater.keySet().removeIf(i -> !burnList.keySet().contains(i));
+ itemsInWater.keySet().removeIf(i -> !burnList.containsKey(i));
if (!burnList.isEmpty()) {
Bukkit.getScheduler().runTask(addon.getPlugin(), () ->
diff --git a/src/main/java/world/bentobox/acidisland/world/ChunkGeneratorWorld.java b/src/main/java/world/bentobox/acidisland/world/ChunkGeneratorWorld.java
index 6704ba0..69e094d 100644
--- a/src/main/java/world/bentobox/acidisland/world/ChunkGeneratorWorld.java
+++ b/src/main/java/world/bentobox/acidisland/world/ChunkGeneratorWorld.java
@@ -27,8 +27,8 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
private final AcidIsland addon;
private final Random rand = new Random();
- private Map seaHeight = new EnumMap<>(Environment.class);
- private Map roofChunk = new HashMap<>();
+ private final Map seaHeight = new EnumMap<>(Environment.class);
+ private final Map roofChunk = new HashMap<>();
/**
* @param addon - addon
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 2148bf4..3445097 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -445,7 +445,6 @@ protection:
invincible-visitors:
- BLOCK_EXPLOSION
- CONTACT
- - CUSTOM
- DROWNING
- ENTITY_ATTACK
- ENTITY_EXPLOSION
diff --git a/src/main/resources/locales/vi.yml b/src/main/resources/locales/vi.yml
new file mode 100644
index 0000000..ec990e9
--- /dev/null
+++ b/src/main/resources/locales/vi.yml
@@ -0,0 +1,7 @@
+---
+acidisland:
+ sign:
+ line0: "&1Đảo Axit"
+ line1: "[tên]"
+ line2: Nước là axit!
+ line3: Hãy cẩn thận! &c<3
diff --git a/src/test/java/world/bentobox/acidisland/AISettingsTest.java b/src/test/java/world/bentobox/acidisland/AISettingsTest.java
new file mode 100644
index 0000000..0278808
--- /dev/null
+++ b/src/test/java/world/bentobox/acidisland/AISettingsTest.java
@@ -0,0 +1,1815 @@
+package world.bentobox.acidisland;
+
+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 org.bukkit.Difficulty;
+import org.bukkit.GameMode;
+import org.bukkit.block.Biome;
+import org.bukkit.entity.EntityType;
+import org.bukkit.potion.PotionEffectType;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import world.bentobox.bentobox.lists.Flags;
+
+/**
+ * @author tastybento
+ *
+ */
+public class AISettingsTest {
+
+ /**
+ * Class under test
+ */
+ private AISettings s;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ s = new AISettings();
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidDamage()}.
+ */
+ @Test
+ public void testGetAcidDamage() {
+ assertEquals(10, s.getAcidDamage());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidDamageAnimal()}.
+ */
+ @Test
+ public void testGetAcidDamageAnimal() {
+ assertEquals(1, s.getAcidDamageAnimal());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidDamageDelay()}.
+ */
+ @Test
+ public void testGetAcidDamageDelay() {
+ assertEquals(2, s.getAcidDamageDelay());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidDamageMonster()}.
+ */
+ @Test
+ public void testGetAcidDamageMonster() {
+ assertEquals(5, s.getAcidDamageMonster());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidDestroyItemTime()}.
+ */
+ @Test
+ public void testGetAcidDestroyItemTime() {
+ assertEquals(0, s.getAcidDestroyItemTime());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidEffects()}.
+ */
+ @Test
+ public void testGetAcidEffects() {
+ assertTrue(s.getAcidEffects().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidRainDamage()}.
+ */
+ @Test
+ public void testGetAcidRainDamage() {
+ assertEquals(1, s.getAcidRainDamage());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getBanLimit()}.
+ */
+ @Test
+ public void testGetBanLimit() {
+ assertEquals(-1, s.getBanLimit());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getCustomRanks()}.
+ */
+ @Test
+ public void testGetCustomRanks() {
+ assertTrue(s.getCustomRanks().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDeathsMax()}.
+ */
+ @Test
+ public void testGetDeathsMax() {
+ assertEquals(10, s.getDeathsMax());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultBiome()}.
+ */
+ @Test
+ public void testGetDefaultBiome() {
+ assertEquals(Biome.WARM_OCEAN, s.getDefaultBiome());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultGameMode()}.
+ */
+ @Test
+ public void testGetDefaultGameMode() {
+ assertEquals(GameMode.SURVIVAL, s.getDefaultGameMode());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultIslandFlags()}.
+ */
+ @Test
+ public void testGetDefaultIslandFlags() {
+ assertTrue(s.getDefaultIslandFlags().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultIslandSettings()}.
+ */
+ @Test
+ public void testGetDefaultIslandSettings() {
+ assertTrue(s.getDefaultIslandSettings().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDifficulty()}.
+ */
+ @Test
+ public void testGetDifficulty() {
+ assertEquals(Difficulty.NORMAL, s.getDifficulty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getEndSeaHeight()}.
+ */
+ @Test
+ public void testGetEndSeaHeight() {
+ assertEquals(54, s.getEndSeaHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getFriendlyName()}.
+ */
+ @Test
+ public void testGetFriendlyName() {
+ assertEquals("AcidIsland", s.getFriendlyName());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getGeoLimitSettings()}.
+ */
+ @Test
+ public void testGetGeoLimitSettings() {
+ assertTrue(s.getGeoLimitSettings().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIslandDistance()}.
+ */
+ @Test
+ public void testGetIslandDistance() {
+ assertEquals(192, s.getIslandDistance());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIslandHeight()}.
+ */
+ @Test
+ public void testGetIslandHeight() {
+ assertEquals(50, s.getIslandHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIslandProtectionRange()}.
+ */
+ @Test
+ public void testGetIslandProtectionRange() {
+ assertEquals(100, s.getIslandProtectionRange());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIslandStartX()}.
+ */
+ @Test
+ public void testGetIslandStartX() {
+ assertEquals(0, s.getIslandStartX());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIslandStartZ()}.
+ */
+ @Test
+ public void testGetIslandStartZ() {
+ assertEquals(0, s.getIslandStartZ());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIslandXOffset()}.
+ */
+ @Test
+ public void testGetIslandXOffset() {
+ assertEquals(0, s.getIslandXOffset());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIslandZOffset()}.
+ */
+ @Test
+ public void testGetIslandZOffset() {
+ assertEquals(0, s.getIslandZOffset());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getIvSettings()}.
+ */
+ @Test
+ public void testGetIvSettings() {
+ assertTrue(s.getIvSettings().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getMaxHomes()}.
+ */
+ @Test
+ public void testGetMaxHomes() {
+ assertEquals(5, s.getMaxHomes());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getMaxIslands()}.
+ */
+ @Test
+ public void testGetMaxIslands() {
+ assertEquals(-1, s.getMaxIslands());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getMaxTeamSize()}.
+ */
+ @Test
+ public void testGetMaxTeamSize() {
+ assertEquals(4, s.getMaxTeamSize());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getNetherSeaHeight()}.
+ */
+ @Test
+ public void testGetNetherSeaHeight() {
+ assertEquals(54, s.getNetherSeaHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getNetherSpawnRadius()}.
+ */
+ @Test
+ public void testGetNetherSpawnRadius() {
+ assertEquals(32, s.getNetherSpawnRadius());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getPermissionPrefix()}.
+ */
+ @Test
+ public void testGetPermissionPrefix() {
+ assertEquals("acidisland", s.getPermissionPrefix());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getRemoveMobsWhitelist()}.
+ */
+ @Test
+ public void testGetRemoveMobsWhitelist() {
+ assertTrue(s.getRemoveMobsWhitelist().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getResetEpoch()}.
+ */
+ @Test
+ public void testGetResetEpoch() {
+ assertEquals(0, s.getResetEpoch());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getResetLimit()}.
+ */
+ @Test
+ public void testGetResetLimit() {
+ assertEquals(-1, s.getResetLimit());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getSeaHeight()}.
+ */
+ @Test
+ public void testGetSeaHeight() {
+ assertEquals(54, s.getSeaHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getHiddenFlags()}.
+ */
+ @Test
+ public void testGetHiddenFlags() {
+ assertTrue(s.getHiddenFlags().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getVisitorBannedCommands()}.
+ */
+ @Test
+ public void testGetVisitorBannedCommands() {
+ assertTrue(s.getVisitorBannedCommands().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getFallingBannedCommands()}.
+ */
+ @Test
+ public void testGetFallingBannedCommands() {
+ assertTrue(s.getFallingBannedCommands().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getWorldFlags()}.
+ */
+ @Test
+ public void testGetWorldFlags() {
+ assertTrue(s.getWorldFlags().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getWorldName()}.
+ */
+ @Test
+ public void testGetWorldName() {
+ assertEquals("acidisland_world", s.getWorldName());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isAcidDamageChickens()}.
+ */
+ @Test
+ public void testIsAcidDamageChickens() {
+ assertFalse(s.isAcidDamageChickens());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isAcidDamageOp()}.
+ */
+ @Test
+ public void testIsAcidDamageOp() {
+ assertFalse(s.isAcidDamageOp());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isAllowSetHomeInNether()}.
+ */
+ @Test
+ public void testIsAllowSetHomeInNether() {
+ assertTrue(s.isAllowSetHomeInNether());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isAllowSetHomeInTheEnd()}.
+ */
+ @Test
+ public void testIsAllowSetHomeInTheEnd() {
+ assertTrue(s.isAllowSetHomeInTheEnd());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isDeathsCounted()}.
+ */
+ @Test
+ public void testIsDeathsCounted() {
+ assertTrue(s.isDeathsCounted());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isDragonSpawn()}.
+ */
+ @Test
+ public void testIsDragonSpawn() {
+ assertFalse(s.isDragonSpawn());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isEndGenerate()}.
+ */
+ @Test
+ public void testIsEndGenerate() {
+ assertTrue(s.isEndGenerate());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isEndIslands()}.
+ */
+ @Test
+ public void testIsEndIslands() {
+ assertTrue(s.isEndIslands());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isFullArmorProtection()}.
+ */
+ @Test
+ public void testIsFullArmorProtection() {
+ assertFalse(s.isFullArmorProtection());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isHelmetProtection()}.
+ */
+ @Test
+ public void testIsHelmetProtection() {
+ assertFalse(s.isHelmetProtection());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isKickedKeepInventory()}.
+ */
+ @Test
+ public void testIsKickedKeepInventory() {
+ assertFalse(s.isKickedKeepInventory());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isCreateIslandOnFirstLoginEnabled()}.
+ */
+ @Test
+ public void testIsCreateIslandOnFirstLoginEnabled() {
+ assertFalse(s.isCreateIslandOnFirstLoginEnabled());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getCreateIslandOnFirstLoginDelay()}.
+ */
+ @Test
+ public void testGetCreateIslandOnFirstLoginDelay() {
+ assertEquals(5, s.getCreateIslandOnFirstLoginDelay());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isCreateIslandOnFirstLoginAbortOnLogout()}.
+ */
+ @Test
+ public void testIsCreateIslandOnFirstLoginAbortOnLogout() {
+ assertTrue(s.isCreateIslandOnFirstLoginAbortOnLogout());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isLeaversLoseReset()}.
+ */
+ @Test
+ public void testIsLeaversLoseReset() {
+ assertFalse(s.isLeaversLoseReset());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isNetherGenerate()}.
+ */
+ @Test
+ public void testIsNetherGenerate() {
+ assertTrue(s.isNetherGenerate());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isNetherIslands()}.
+ */
+ @Test
+ public void testIsNetherIslands() {
+ assertTrue(s.isNetherIslands());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isNetherRoof()}.
+ */
+ @Test
+ public void testIsNetherRoof() {
+ assertTrue(s.isNetherRoof());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnJoinResetEnderChest()}.
+ */
+ @Test
+ public void testIsOnJoinResetEnderChest() {
+ assertFalse(s.isOnJoinResetEnderChest());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnJoinResetInventory()}.
+ */
+ @Test
+ public void testIsOnJoinResetInventory() {
+ assertFalse(s.isOnJoinResetInventory());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnJoinResetMoney()}.
+ */
+ @Test
+ public void testIsOnJoinResetMoney() {
+ assertFalse(s.isOnJoinResetMoney());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnLeaveResetEnderChest()}.
+ */
+ @Test
+ public void testIsOnLeaveResetEnderChest() {
+ assertFalse(s.isOnLeaveResetEnderChest());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnLeaveResetInventory()}.
+ */
+ @Test
+ public void testIsOnLeaveResetInventory() {
+ assertFalse(s.isOnLeaveResetInventory());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnLeaveResetMoney()}.
+ */
+ @Test
+ public void testIsOnLeaveResetMoney() {
+ assertFalse(s.isOnLeaveResetMoney());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isRequireConfirmationToSetHomeInNether()}.
+ */
+ @Test
+ public void testIsRequireConfirmationToSetHomeInNether() {
+ assertTrue(s.isRequireConfirmationToSetHomeInNether());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isRequireConfirmationToSetHomeInTheEnd()}.
+ */
+ @Test
+ public void testIsRequireConfirmationToSetHomeInTheEnd() {
+ assertTrue(s.isRequireConfirmationToSetHomeInTheEnd());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isTeamJoinDeathReset()}.
+ */
+ @Test
+ public void testIsTeamJoinDeathReset() {
+ assertTrue(s.isTeamJoinDeathReset());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isUseOwnGenerator()}.
+ */
+ @Test
+ public void testIsUseOwnGenerator() {
+ assertFalse(s.isUseOwnGenerator());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isWaterUnsafe()}.
+ */
+ @Test
+ public void testIsWaterUnsafe() {
+ assertTrue(s.isWaterUnsafe());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDamage(int)}.
+ */
+ @Test
+ public void testSetAcidDamage() {
+ s.setAcidDamage(99);
+ assertEquals(99, s.getAcidDamage());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDamageAnimal(int)}.
+ */
+ @Test
+ public void testSetAcidDamageAnimal() {
+ s.setAcidDamageAnimal(99);
+ assertEquals(99, s.getAcidDamageAnimal());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDamageChickens(boolean)}.
+ */
+ @Test
+ public void testSetAcidDamageChickens() {
+ s.setAcidDamageChickens(true);
+ assertTrue(s.isAcidDamageChickens());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDamageDelay(long)}.
+ */
+ @Test
+ public void testSetAcidDamageDelay() {
+ s.setAcidDamageDelay(99);
+ assertEquals(99, s.getAcidDamageDelay());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDamageMonster(int)}.
+ */
+ @Test
+ public void testSetAcidDamageMonster() {
+ s.setAcidDamageMonster(99);
+ assertEquals(99, s.getAcidDamageMonster());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDamageOp(boolean)}.
+ */
+ @Test
+ public void testSetAcidDamageOp() {
+ s.setAcidDamageOp(true);
+ assertTrue(s.isAcidDamageOp());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDestroyItemTime(long)}.
+ */
+ @Test
+ public void testSetAcidDestroyItemTime() {
+ s.setAcidDestroyItemTime(99);
+ assertEquals(99, s.getAcidDestroyItemTime());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidEffects(java.util.List)}.
+ */
+ @Test
+ public void testSetAcidEffects() {
+ List list = Collections.singletonList(PotionEffectType.ABSORPTION);
+ s.setAcidEffects(list);
+ assertEquals(list, s.getAcidEffects());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidRainDamage(int)}.
+ */
+ @Test
+ public void testSetAcidRainDamage() {
+ s.setAcidRainDamage(99);
+ assertEquals(99, s.getAcidRainDamage());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAdminCommand(java.lang.String)}.
+ */
+ @Test
+ public void testSetAdminCommand() {
+ s.setAdminCommand("admin");
+ assertEquals("admin", s.getAdminCommandAliases());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAllowSetHomeInNether(boolean)}.
+ */
+ @Test
+ public void testSetAllowSetHomeInNether() {
+ s.setAllowSetHomeInNether(false);
+ assertFalse(s.isAllowSetHomeInNether());
+ s.setAllowSetHomeInNether(true);
+ assertTrue(s.isAllowSetHomeInNether());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAllowSetHomeInTheEnd(boolean)}.
+ */
+ @Test
+ public void testSetAllowSetHomeInTheEnd() {
+ s.setAllowSetHomeInTheEnd(false);
+ assertFalse(s.isAllowSetHomeInTheEnd());
+ s.setAllowSetHomeInTheEnd(true);
+ assertTrue(s.isAllowSetHomeInTheEnd());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setBanLimit(int)}.
+ */
+ @Test
+ public void testSetBanLimit() {
+ s.setBanLimit(99);
+ assertEquals(99, s.getBanLimit());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setCustomRanks(java.util.Map)}.
+ */
+ @Test
+ public void testSetCustomRanks() {
+ s.setCustomRanks(Collections.singletonMap("string", 10));
+ assertEquals(10, (int)s.getCustomRanks().get("string"));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDeathsCounted(boolean)}.
+ */
+ @Test
+ public void testSetDeathsCounted() {
+ s.setDeathsCounted(false);
+ assertFalse(s.isDeathsCounted());
+ s.setDeathsCounted(true);
+ assertTrue(s.isDeathsCounted());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDeathsMax(int)}.
+ */
+ @Test
+ public void testSetDeathsMax() {
+ s.setDeathsMax(99);
+ assertEquals(99, s.getDeathsMax());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultBiome(org.bukkit.block.Biome)}.
+ */
+ @Test
+ public void testSetDefaultBiome() {
+ s.setDefaultBiome(Biome.BADLANDS);
+ assertEquals(Biome.BADLANDS, s.getDefaultBiome());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultGameMode(org.bukkit.GameMode)}.
+ */
+ @Test
+ public void testSetDefaultGameMode() {
+ s.setDefaultGameMode(GameMode.SPECTATOR);
+ assertEquals(GameMode.SPECTATOR, s.getDefaultGameMode());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultIslandFlags(java.util.Map)}.
+ */
+ @Test
+ public void testSetDefaultIslandFlags() {
+ s.setDefaultIslandFlags(Collections.singletonMap(Flags.ANIMAL_NATURAL_SPAWN, 10));
+ assertEquals(10, (int)s.getDefaultIslandFlags().get(Flags.ANIMAL_NATURAL_SPAWN));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultIslandSettings(java.util.Map)}.
+ */
+ @Test
+ public void testSetDefaultIslandSettings() {
+ s.setDefaultIslandSettings(Collections.singletonMap(Flags.ANIMAL_NATURAL_SPAWN, 10));
+ assertEquals(10, (int)s.getDefaultIslandSettings().get(Flags.ANIMAL_NATURAL_SPAWN));
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDifficulty(org.bukkit.Difficulty)}.
+ */
+ @Test
+ public void testSetDifficulty() {
+ s.setDifficulty(Difficulty.PEACEFUL);
+ assertEquals(Difficulty.PEACEFUL, s.getDifficulty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDragonSpawn(boolean)}.
+ */
+ @Test
+ public void testSetDragonSpawn() {
+ s.setDragonSpawn(false);
+ assertFalse(s.isDragonSpawn());
+ s.setDragonSpawn(true);
+ assertTrue(s.isDragonSpawn());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setEndGenerate(boolean)}.
+ */
+ @Test
+ public void testSetEndGenerate() {
+ s.setEndGenerate(false);
+ assertFalse(s.isEndGenerate());
+ s.setEndGenerate(true);
+ assertTrue(s.isEndGenerate());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setEndIslands(boolean)}.
+ */
+ @Test
+ public void testSetEndIslands() {
+ s.setEndIslands(false);
+ assertFalse(s.isEndIslands());
+ s.setEndIslands(true);
+ assertTrue(s.isEndIslands());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setFriendlyName(java.lang.String)}.
+ */
+ @Test
+ public void testSetFriendlyName() {
+ s.setFriendlyName("hshshs");
+ assertEquals("hshshs", s.getFriendlyName());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setFullArmorProtection(boolean)}.
+ */
+ @Test
+ public void testSetFullArmorProtection() {
+ s.setFullArmorProtection(false);
+ assertFalse(s.isFullArmorProtection());
+ s.setFullArmorProtection(true);
+ assertTrue(s.isFullArmorProtection());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setGeoLimitSettings(java.util.List)}.
+ */
+ @Test
+ public void testSetGeoLimitSettings() {
+ s.setGeoLimitSettings(Collections.singletonList("ghghhg"));
+ assertEquals("ghghhg", s.getGeoLimitSettings().get(0));
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setHelmetProtection(boolean)}.
+ */
+ @Test
+ public void testSetHelmetProtection() {
+ s.setHelmetProtection(false);
+ assertFalse(s.isHelmetProtection());
+ s.setHelmetProtection(true);
+ assertTrue(s.isHelmetProtection());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandCommand(java.lang.String)}.
+ */
+ @Test
+ public void testSetIslandCommand() {
+ s.setIslandCommand("command");
+ assertEquals("command", s.getPlayerCommandAliases());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandDistance(int)}.
+ */
+ @Test
+ public void testSetIslandDistance() {
+ s.setIslandDistance(99);
+ assertEquals(99, s.getIslandDistance());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandHeight(int)}.
+ */
+ @Test
+ public void testSetIslandHeight() {
+ s.setIslandHeight(99);
+ assertEquals(99, s.getIslandHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandProtectionRange(int)}.
+ */
+ @Test
+ public void testSetIslandProtectionRange() {
+ s.setIslandProtectionRange(99);
+ assertEquals(99, s.getIslandProtectionRange());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandStartX(int)}.
+ */
+ @Test
+ public void testSetIslandStartX() {
+ s.setIslandStartX(99);
+ assertEquals(99, s.getIslandStartX());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandStartZ(int)}.
+ */
+ @Test
+ public void testSetIslandStartZ() {
+ s.setIslandStartZ(99);
+ assertEquals(99, s.getIslandStartZ());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandXOffset(int)}.
+ */
+ @Test
+ public void testSetIslandXOffset() {
+ s.setIslandXOffset(99);
+ assertEquals(99, s.getIslandXOffset());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIslandZOffset(int)}.
+ */
+ @Test
+ public void testSetIslandZOffset() {
+ s.setIslandZOffset(99);
+ assertEquals(99, s.getIslandZOffset());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setIvSettings(java.util.List)}.
+ */
+ @Test
+ public void testSetIvSettings() {
+ s.setIvSettings(Collections.singletonList("ffff"));
+ assertEquals("ffff", s.getIvSettings().get(0));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setKickedKeepInventory(boolean)}.
+ */
+ @Test
+ public void testSetKickedKeepInventory() {
+ s.setKickedKeepInventory(false);
+ assertFalse(s.isKickedKeepInventory());
+ s.setKickedKeepInventory(true);
+ assertTrue(s.isKickedKeepInventory());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setLeaversLoseReset(boolean)}.
+ */
+ @Test
+ public void testSetLeaversLoseReset() {
+ s.setLeaversLoseReset(false);
+ assertFalse(s.isLeaversLoseReset());
+ s.setLeaversLoseReset(true);
+ assertTrue(s.isLeaversLoseReset());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setMaxHomes(int)}.
+ */
+ @Test
+ public void testSetMaxHomes() {
+ s.setMaxHomes(99);
+ assertEquals(99, s.getMaxHomes());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setMaxIslands(int)}.
+ */
+ @Test
+ public void testSetMaxIslands() {
+ s.setMaxIslands(99);
+ assertEquals(99, s.getMaxIslands());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setMaxTeamSize(int)}.
+ */
+ @Test
+ public void testSetMaxTeamSize() {
+ s.setMaxTeamSize(99);
+ assertEquals(99, s.getMaxTeamSize());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setNetherGenerate(boolean)}.
+ */
+ @Test
+ public void testSetNetherGenerate() {
+ s.setNetherGenerate(false);
+ assertFalse(s.isNetherGenerate());
+ s.setNetherGenerate(true);
+ assertTrue(s.isNetherGenerate());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setNetherIslands(boolean)}.
+ */
+ @Test
+ public void testSetNetherIslands() {
+ s.setNetherIslands(false);
+ assertFalse(s.isNetherIslands());
+ s.setNetherIslands(true);
+ assertTrue(s.isNetherIslands());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setNetherRoof(boolean)}.
+ */
+ @Test
+ public void testSetNetherRoof() {
+ s.setNetherRoof(false);
+ assertFalse(s.isNetherRoof());
+ s.setNetherRoof(true);
+ assertTrue(s.isNetherRoof());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setNetherSpawnRadius(int)}.
+ */
+ @Test
+ public void testSetNetherSpawnRadius() {
+ s.setNetherSpawnRadius(99);
+ assertEquals(99,s.getNetherSpawnRadius());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnJoinResetEnderChest(boolean)}.
+ */
+ @Test
+ public void testSetOnJoinResetEnderChest() {
+ s.setOnJoinResetEnderChest(false);
+ assertFalse(s.isOnJoinResetEnderChest());
+ s.setOnJoinResetEnderChest(true);
+ assertTrue(s.isOnJoinResetEnderChest());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnJoinResetInventory(boolean)}.
+ */
+ @Test
+ public void testSetOnJoinResetInventory() {
+ s.setOnJoinResetInventory(false);
+ assertFalse(s.isOnJoinResetInventory());
+ s.setOnJoinResetInventory(true);
+ assertTrue(s.isOnJoinResetInventory());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnJoinResetMoney(boolean)}.
+ */
+ @Test
+ public void testSetOnJoinResetMoney() {
+ s.setOnJoinResetMoney(false);
+ assertFalse(s.isOnJoinResetMoney());
+ s.setOnJoinResetMoney(true);
+ assertTrue(s.isOnJoinResetMoney());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnLeaveResetEnderChest(boolean)}.
+ */
+ @Test
+ public void testSetOnLeaveResetEnderChest() {
+ s.setOnLeaveResetEnderChest(false);
+ assertFalse(s.isOnLeaveResetEnderChest());
+ s.setOnLeaveResetEnderChest(true);
+ assertTrue(s.isOnLeaveResetEnderChest());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnLeaveResetInventory(boolean)}.
+ */
+ @Test
+ public void testSetOnLeaveResetInventory() {
+ s.setOnLeaveResetInventory(false);
+ assertFalse(s.isOnLeaveResetInventory());
+ s.setOnLeaveResetInventory(true);
+ assertTrue(s.isOnLeaveResetInventory());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnLeaveResetMoney(boolean)}.
+ */
+ @Test
+ public void testSetOnLeaveResetMoney() {
+ s.setOnLeaveResetMoney(false);
+ assertFalse(s.isOnLeaveResetMoney());
+ s.setOnLeaveResetMoney(true);
+ assertTrue(s.isOnLeaveResetMoney());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setRemoveMobsWhitelist(java.util.Set)}.
+ */
+ @Test
+ public void testSetRemoveMobsWhitelist() {
+ s.setRemoveMobsWhitelist(Collections.singleton(EntityType.GHAST));
+ assertTrue(s.getRemoveMobsWhitelist().contains(EntityType.GHAST));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setRequireConfirmationToSetHomeInNether(boolean)}.
+ */
+ @Test
+ public void testSetRequireConfirmationToSetHomeInNether() {
+ s.setRequireConfirmationToSetHomeInNether(false);
+ assertFalse(s.isRequireConfirmationToSetHomeInNether());
+ s.setRequireConfirmationToSetHomeInNether(true);
+ assertTrue(s.isRequireConfirmationToSetHomeInNether());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setRequireConfirmationToSetHomeInTheEnd(boolean)}.
+ */
+ @Test
+ public void testSetRequireConfirmationToSetHomeInTheEnd() {
+ s.setRequireConfirmationToSetHomeInTheEnd(false);
+ assertFalse(s.isRequireConfirmationToSetHomeInTheEnd());
+ s.setRequireConfirmationToSetHomeInTheEnd(true);
+ assertTrue(s.isRequireConfirmationToSetHomeInTheEnd());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setResetEpoch(long)}.
+ */
+ @Test
+ public void testSetResetEpoch() {
+ s.setResetEpoch(3456L);
+ assertEquals(3456L, s.getResetEpoch());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setResetLimit(int)}.
+ */
+ @Test
+ public void testSetResetLimit() {
+ s.setResetLimit(99);
+ assertEquals(99, s.getResetLimit());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setSeaHeight(int)}.
+ */
+ @Test
+ public void testSetSeaHeight() {
+ s.setSeaHeight(99);
+ assertEquals(99, s.getSeaHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setNetherSeaHeight(int)}.
+ */
+ @Test
+ public void testSetNetherSeaHeight() {
+ s.setNetherSeaHeight(99);
+ assertEquals(99, s.getNetherSeaHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setEndSeaHeight(int)}.
+ */
+ @Test
+ public void testSetEndSeaHeight() {
+ s.setEndSeaHeight(99);
+ assertEquals(99, s.getEndSeaHeight());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setTeamJoinDeathReset(boolean)}.
+ */
+ @Test
+ public void testSetTeamJoinDeathReset() {
+ s.setTeamJoinDeathReset(false);
+ assertFalse(s.isTeamJoinDeathReset());
+ s.setTeamJoinDeathReset(true);
+ assertTrue(s.isTeamJoinDeathReset());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setUseOwnGenerator(boolean)}.
+ */
+ @Test
+ public void testSetUseOwnGenerator() {
+ s.setUseOwnGenerator(false);
+ assertFalse(s.isUseOwnGenerator());
+ s.setUseOwnGenerator(true);
+ assertTrue(s.isUseOwnGenerator());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setHiddenFlags(java.util.List)}.
+ */
+ @Test
+ public void testSetHiddenFlags() {
+ s.setHiddenFlags(Collections.singletonList("flag"));
+ assertEquals("flag", s.getHiddenFlags().get(0));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setVisitorBannedCommands(java.util.List)}.
+ */
+ @Test
+ public void testSetVisitorBannedCommands() {
+ s.setVisitorBannedCommands(Collections.singletonList("flag"));
+ assertEquals("flag", s.getVisitorBannedCommands().get(0));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setFallingBannedCommands(java.util.List)}.
+ */
+ @Test
+ public void testSetFallingBannedCommands() {
+ s.setFallingBannedCommands(Collections.singletonList("flag"));
+ assertEquals("flag", s.getFallingBannedCommands().get(0));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setWorldFlags(java.util.Map)}.
+ */
+ @Test
+ public void testSetWorldFlags() {
+ s.setWorldFlags(Collections.singletonMap("flag", true));
+ assertTrue(s.getWorldFlags().get("flag"));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setWorldName(java.lang.String)}.
+ */
+ @Test
+ public void testSetWorldName() {
+ s.setWorldName("ugga");
+ assertEquals("ugga", s.getWorldName());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isAcidDamageSnow()}.
+ */
+ @Test
+ public void testIsAcidDamageSnow() {
+ assertFalse(s.isAcidDamageSnow());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidDamageSnow(boolean)}.
+ */
+ @Test
+ public void testSetAcidDamageSnow() {
+ s.setAcidDamageSnow(false);
+ assertFalse(s.isAcidDamageSnow());
+ s.setAcidDamageSnow(true);
+ assertTrue(s.isAcidDamageSnow());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isDeathsResetOnNewIsland()}.
+ */
+ @Test
+ public void testIsDeathsResetOnNewIsland() {
+ assertTrue(s.isDeathsResetOnNewIsland());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDeathsResetOnNewIsland(boolean)}.
+ */
+ @Test
+ public void testSetDeathsResetOnNewIsland() {
+ s.setDeathsResetOnNewIsland(false);
+ assertFalse(s.isDeathsResetOnNewIsland());
+ s.setDeathsResetOnNewIsland(true);
+ assertTrue(s.isDeathsResetOnNewIsland());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getOnJoinCommands()}.
+ */
+ @Test
+ public void testGetOnJoinCommands() {
+ assertTrue(s.getOnJoinCommands().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnJoinCommands(java.util.List)}.
+ */
+ @Test
+ public void testSetOnJoinCommands() {
+ s.setOnJoinCommands(Collections.singletonList("command"));
+ assertEquals("command", s.getOnJoinCommands().get(0));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getOnLeaveCommands()}.
+ */
+ @Test
+ public void testGetOnLeaveCommands() {
+ assertTrue(s.getOnLeaveCommands().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnLeaveCommands(java.util.List)}.
+ */
+ @Test
+ public void testSetOnLeaveCommands() {
+ s.setOnLeaveCommands(Collections.singletonList("command"));
+ assertEquals("command", s.getOnLeaveCommands().get(0));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnJoinResetHealth()}.
+ */
+ @Test
+ public void testIsOnJoinResetHealth() {
+ assertTrue(s.isOnJoinResetHealth());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnJoinResetHealth(boolean)}.
+ */
+ @Test
+ public void testSetOnJoinResetHealth() {
+ s.setOnJoinResetHealth(false);
+ assertFalse(s.isOnJoinResetHealth());
+ s.setOnJoinResetHealth(true);
+ assertTrue(s.isOnJoinResetHealth());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnJoinResetHunger()}.
+ */
+ @Test
+ public void testIsOnJoinResetHunger() {
+ assertTrue(s.isOnJoinResetHunger());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnJoinResetHunger(boolean)}.
+ */
+ @Test
+ public void testSetOnJoinResetHunger() {
+ s.setOnJoinResetHunger(false);
+ assertFalse(s.isOnJoinResetHunger());
+ s.setOnJoinResetHunger(true);
+ assertTrue(s.isOnJoinResetHunger());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnJoinResetXP()}.
+ */
+ @Test
+ public void testIsOnJoinResetXP() {
+ assertFalse(s.isOnJoinResetXP());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnJoinResetXP(boolean)}.
+ */
+ @Test
+ public void testSetOnJoinResetXP() {
+ s.setOnJoinResetXP(false);
+ assertFalse(s.isOnJoinResetXP());
+ s.setOnJoinResetXP(true);
+ assertTrue(s.isOnJoinResetXP());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnLeaveResetHealth()}.
+ */
+ @Test
+ public void testIsOnLeaveResetHealth() {
+ assertFalse(s.isOnLeaveResetHealth());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnLeaveResetHealth(boolean)}.
+ */
+ @Test
+ public void testSetOnLeaveResetHealth() {
+ s.setOnLeaveResetHealth(false);
+ assertFalse(s.isOnLeaveResetHealth());
+ s.setOnLeaveResetHealth(true);
+ assertTrue(s.isOnLeaveResetHealth());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnLeaveResetHunger()}.
+ */
+ @Test
+ public void testIsOnLeaveResetHunger() {
+ assertFalse(s.isOnLeaveResetHunger());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnLeaveResetHunger(boolean)}.
+ */
+ @Test
+ public void testSetOnLeaveResetHunger() {
+ s.setOnLeaveResetHunger(false);
+ assertFalse(s.isOnLeaveResetHunger());
+ s.setOnLeaveResetHunger(true);
+ assertTrue(s.isOnLeaveResetHunger());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isOnLeaveResetXP()}.
+ */
+ @Test
+ public void testIsOnLeaveResetXP() {
+ assertFalse(s.isOnLeaveResetXP());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setOnLeaveResetXP(boolean)}.
+ */
+ @Test
+ public void testSetOnLeaveResetXP() {
+
+ s.setOnLeaveResetXP(false);
+ assertFalse(s.isOnLeaveResetXP());
+ s.setOnLeaveResetXP(true);
+ assertTrue(s.isOnLeaveResetXP());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setCreateIslandOnFirstLoginEnabled(boolean)}.
+ */
+ @Test
+ public void testSetCreateIslandOnFirstLoginEnabled() {
+ s.setCreateIslandOnFirstLoginEnabled(false);
+ assertFalse(s.isCreateIslandOnFirstLoginEnabled());
+ s.setCreateIslandOnFirstLoginEnabled(true);
+ assertTrue(s.isCreateIslandOnFirstLoginEnabled());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setCreateIslandOnFirstLoginDelay(int)}.
+ */
+ @Test
+ public void testSetCreateIslandOnFirstLoginDelay() {
+ s.setCreateIslandOnFirstLoginDelay(40);
+ assertEquals(40, s.getCreateIslandOnFirstLoginDelay());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setCreateIslandOnFirstLoginAbortOnLogout(boolean)}.
+ */
+ @Test
+ public void testSetCreateIslandOnFirstLoginAbortOnLogout() {
+ s.setCreateIslandOnFirstLoginAbortOnLogout(false);
+ assertFalse(s.isCreateIslandOnFirstLoginAbortOnLogout());
+ s.setCreateIslandOnFirstLoginAbortOnLogout(true);
+ assertTrue(s.isCreateIslandOnFirstLoginAbortOnLogout());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#isPasteMissingIslands()}.
+ */
+ @Test
+ public void testIsPasteMissingIslands() {
+ assertFalse(s.isPasteMissingIslands());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setPasteMissingIslands(boolean)}.
+ */
+ @Test
+ public void testSetPasteMissingIslands() {
+ s.setPasteMissingIslands(false);
+ assertFalse(s.isPasteMissingIslands());
+ s.setPasteMissingIslands(true);
+ assertTrue(s.isPasteMissingIslands());
+
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidRainEffects()}.
+ */
+ @Test
+ public void testGetAcidRainEffects() {
+ assertTrue(s.getAcidRainEffects().isEmpty());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidRainEffects(java.util.List)}.
+ */
+ @Test
+ public void testSetAcidRainEffects() {
+ s.setAcidRainEffects(Collections.singletonList(PotionEffectType.BAD_OMEN));
+ assertEquals(PotionEffectType.BAD_OMEN, s.getAcidRainEffects().get(0));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getRainEffectDuation()}.
+ */
+ @Test
+ public void testGetRainEffectDuation() {
+ assertEquals(10, s.getRainEffectDuation());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setRainEffectDuation(int)}.
+ */
+ @Test
+ public void testSetRainEffectDuation() {
+ s.setRainEffectDuation(99);
+ assertEquals(99, s.getRainEffectDuation());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAcidEffectDuation()}.
+ */
+ @Test
+ public void testGetAcidEffectDuation() {
+ assertEquals(30, s.getAcidEffectDuation());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAcidEffectDuation(int)}.
+ */
+ @Test
+ public void testSetAcidEffectDuation() {
+ s.setAcidEffectDuation(99);
+ assertEquals(99, s.getAcidEffectDuation());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getSpawnLimitMonsters()}.
+ */
+ @Test
+ public void testGetSpawnLimitMonsters() {
+ assertEquals(-1, s.getSpawnLimitMonsters());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setSpawnLimitMonsters(int)}.
+ */
+ @Test
+ public void testSetSpawnLimitMonsters() {
+ s.setSpawnLimitMonsters(99);
+ assertEquals(99, s.getSpawnLimitMonsters());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getSpawnLimitAnimals()}.
+ */
+ @Test
+ public void testGetSpawnLimitAnimals() {
+ assertEquals(-1, s.getSpawnLimitAnimals());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setSpawnLimitAnimals(int)}.
+ */
+ @Test
+ public void testSetSpawnLimitAnimals() {
+ s.setSpawnLimitAnimals(99);
+ assertEquals(99, s.getSpawnLimitAnimals());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getSpawnLimitWaterAnimals()}.
+ */
+ @Test
+ public void testGetSpawnLimitWaterAnimals() {
+ assertEquals(-1, s.getSpawnLimitWaterAnimals());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setSpawnLimitWaterAnimals(int)}.
+ */
+ @Test
+ public void testSetSpawnLimitWaterAnimals() {
+ s.setSpawnLimitWaterAnimals(99);
+ assertEquals(99, s.getSpawnLimitWaterAnimals());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getSpawnLimitAmbient()}.
+ */
+ @Test
+ public void testGetSpawnLimitAmbient() {
+ assertEquals(-1, s.getSpawnLimitAmbient());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setSpawnLimitAmbient(int)}.
+ */
+ @Test
+ public void testSetSpawnLimitAmbient() {
+ s.setSpawnLimitAmbient(99);
+ assertEquals(99, s.getSpawnLimitAmbient());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getTicksPerAnimalSpawns()}.
+ */
+ @Test
+ public void testGetTicksPerAnimalSpawns() {
+ assertEquals(-1, s.getTicksPerAnimalSpawns());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setTicksPerAnimalSpawns(int)}.
+ */
+ @Test
+ public void testSetTicksPerAnimalSpawns() {
+ s.setTicksPerAnimalSpawns(99);
+ assertEquals(99, s.getTicksPerAnimalSpawns());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getTicksPerMonsterSpawns()}.
+ */
+ @Test
+ public void testGetTicksPerMonsterSpawns() {
+ assertEquals(-1, s.getTicksPerMonsterSpawns());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setTicksPerMonsterSpawns(int)}.
+ */
+ @Test
+ public void testSetTicksPerMonsterSpawns() {
+ s.setTicksPerMonsterSpawns(99);
+ assertEquals(99, s.getTicksPerMonsterSpawns());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getMaxCoopSize()}.
+ */
+ @Test
+ public void testGetMaxCoopSize() {
+ assertEquals(4, s.getMaxCoopSize());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setMaxCoopSize(int)}.
+ */
+ @Test
+ public void testSetMaxCoopSize() {
+ s.setMaxCoopSize(99);
+ assertEquals(99, s.getMaxCoopSize());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getMaxTrustSize()}.
+ */
+ @Test
+ public void testGetMaxTrustSize() {
+ assertEquals(4, s.getMaxTrustSize());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setMaxTrustSize(int)}.
+ */
+ @Test
+ public void testSetMaxTrustSize() {
+ s.setMaxTrustSize(99);
+ assertEquals(99, s.getMaxTrustSize());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getPlayerCommandAliases()}.
+ */
+ @Test
+ public void testGetPlayerCommandAliases() {
+ assertEquals("ai", s.getPlayerCommandAliases());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setPlayerCommandAliases(java.lang.String)}.
+ */
+ @Test
+ public void testSetPlayerCommandAliases() {
+ s.setPlayerCommandAliases("adm");
+ assertEquals("adm", s.getPlayerCommandAliases());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getAdminCommandAliases()}.
+ */
+ @Test
+ public void testGetAdminCommandAliases() {
+ assertEquals("acid", s.getAdminCommandAliases());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setAdminCommandAliases(java.lang.String)}.
+ */
+ @Test
+ public void testSetAdminCommandAliases() {
+ s.setAdminCommandAliases("adm");
+ assertEquals("adm", s.getAdminCommandAliases());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultNewPlayerAction()}.
+ */
+ @Test
+ public void testGetDefaultNewPlayerAction() {
+ assertEquals("create", s.getDefaultNewPlayerAction());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultNewPlayerAction(java.lang.String)}.
+ */
+ @Test
+ public void testSetDefaultNewPlayerAction() {
+ s.setDefaultNewPlayerAction("cr");
+ assertEquals("cr", s.getDefaultNewPlayerAction());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultPlayerAction()}.
+ */
+ @Test
+ public void testGetDefaultPlayerAction() {
+ assertEquals("go", s.getDefaultPlayerAction());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultPlayerAction(java.lang.String)}.
+ */
+ @Test
+ public void testSetDefaultPlayerAction() {
+ s.setDefaultPlayerAction("go2");
+ assertEquals("go2", s.getDefaultPlayerAction());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultNetherBiome()}.
+ */
+ @Test
+ public void testGetDefaultNetherBiome() {
+ assertEquals(Biome.NETHER_WASTES, s.getDefaultNetherBiome());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultNetherBiome(org.bukkit.block.Biome)}.
+ */
+ @Test
+ public void testSetDefaultNetherBiome() {
+ s.setDefaultNetherBiome(Biome.END_BARRENS);
+ assertEquals(Biome.END_BARRENS, s.getDefaultNetherBiome());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#getDefaultEndBiome()}.
+ */
+ @Test
+ public void testGetDefaultEndBiome() {
+ assertEquals(Biome.THE_END, s.getDefaultEndBiome());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AISettings#setDefaultEndBiome(org.bukkit.block.Biome)}.
+ */
+ @Test
+ public void testSetDefaultEndBiome() {
+ s.setDefaultEndBiome(Biome.END_BARRENS);
+ assertEquals(Biome.END_BARRENS, s.getDefaultEndBiome());
+ }
+
+}
diff --git a/src/test/java/world/bentobox/acidisland/AcidIslandTest.java b/src/test/java/world/bentobox/acidisland/AcidIslandTest.java
new file mode 100644
index 0000000..59dda5e
--- /dev/null
+++ b/src/test/java/world/bentobox/acidisland/AcidIslandTest.java
@@ -0,0 +1,269 @@
+/**
+ *
+ */
+package world.bentobox.acidisland;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.logging.Logger;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Server;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.PluginManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.stubbing.Answer;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.reflect.Whitebox;
+
+import world.bentobox.acidisland.world.ChunkGeneratorWorld;
+import world.bentobox.bentobox.BentoBox;
+import world.bentobox.bentobox.Settings;
+import world.bentobox.bentobox.api.addons.AddonDescription;
+import world.bentobox.bentobox.api.configuration.Config;
+import world.bentobox.bentobox.api.user.User;
+import world.bentobox.bentobox.database.objects.Island;
+import world.bentobox.bentobox.managers.AddonsManager;
+import world.bentobox.bentobox.managers.CommandsManager;
+import world.bentobox.bentobox.managers.FlagsManager;
+import world.bentobox.bentobox.managers.IslandWorldManager;
+import world.bentobox.bentobox.managers.IslandsManager;
+
+/**
+ * @author tastybento
+ *
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Config.class })
+public class AcidIslandTest {
+
+ /**
+ * Class under test
+ */
+ private AcidIsland addon;
+
+ @Mock
+ private User user;
+ @Mock
+ private IslandsManager im;
+ @Mock
+ private Island island;
+ @Mock
+ private BentoBox plugin;
+ @Mock
+ private FlagsManager fm;
+ @Mock
+ private Settings settings;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ // Set up plugin
+ Whitebox.setInternalState(BentoBox.class, "instance", plugin);
+ when(plugin.getLogger()).thenReturn(Logger.getAnonymousLogger());
+ // Command manager
+ CommandsManager cm = mock(CommandsManager.class);
+ when(plugin.getCommandsManager()).thenReturn(cm);
+
+ // Player
+ Player p = mock(Player.class);
+ // Sometimes use Mockito.withSettings().verboseLogging()
+ when(user.isOp()).thenReturn(false);
+ UUID uuid = UUID.randomUUID();
+ when(user.getUniqueId()).thenReturn(uuid);
+ when(user.getPlayer()).thenReturn(p);
+ when(user.getName()).thenReturn("tastybento");
+ User.setPlugin(plugin);
+
+ // Island World Manager
+ IslandWorldManager iwm = mock(IslandWorldManager.class);
+ when(plugin.getIWM()).thenReturn(iwm);
+
+
+ // Player has island to begin with
+ island = mock(Island.class);
+ when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
+ when(plugin.getIslands()).thenReturn(im);
+
+ // Locales
+ // Return the reference (USE THIS IN THE FUTURE)
+ when(user.getTranslation(Mockito.anyString())).thenAnswer((Answer) invocation -> invocation.getArgument(0, String.class));
+
+ // Server
+ PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
+ Server server = mock(Server.class);
+ when(Bukkit.getServer()).thenReturn(server);
+ when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
+ when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
+ when(Bukkit.getWorld(anyString())).thenReturn(null);
+
+ // Addon
+ addon = new AcidIsland();
+ File jFile = new File("addon.jar");
+ List lines = Arrays.asList("# AcidIsland Configuration", "uniqueId: config");
+ Path path = Paths.get("config.yml");
+ Files.write(path, lines, Charset.forName("UTF-8"));
+ try (JarOutputStream tempJarOutputStream = new JarOutputStream(new FileOutputStream(jFile))) {
+ //Added the new files to the jar.
+ try (FileInputStream fis = new FileInputStream(path.toFile())) {
+
+ byte[] buffer = new byte[1024];
+ int bytesRead = 0;
+ JarEntry entry = new JarEntry(path.toString());
+ tempJarOutputStream.putNextEntry(entry);
+ while((bytesRead = fis.read(buffer)) != -1) {
+ tempJarOutputStream.write(buffer, 0, bytesRead);
+ }
+ }
+ }
+ File dataFolder = new File("addons/AcidIsland");
+ addon.setDataFolder(dataFolder);
+ addon.setFile(jFile);
+ AddonDescription desc = new AddonDescription.Builder("bentobox", "AcidIsland", "1.3").description("test").authors("tasty").build();
+ addon.setDescription(desc);
+ // Addons manager
+ AddonsManager am = mock(AddonsManager.class);
+ when(plugin.getAddonsManager()).thenReturn(am);
+
+ // Flags manager
+ when(plugin.getFlagsManager()).thenReturn(fm);
+ when(fm.getFlags()).thenReturn(Collections.emptyList());
+
+ // Settings
+ when(plugin.getSettings()).thenReturn(settings);
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ new File("addon.jar").delete();
+ new File("config.yml").delete();
+ new File("addons/acidisland","config.yml").delete();
+ new File("addons/acidisland").delete();
+ new File("addons").delete();
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#onLoad()}.
+ */
+ @Test
+ public void testOnLoad() {
+ addon.onLoad();
+ // Check that config.yml file has been saved
+ File check = new File("addons/AcidIsland","config.yml");
+ assertTrue(check.exists());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#onEnable()}.
+ */
+ @Test
+ public void testOnEnable() {
+ testOnLoad();
+ addon.onEnable();
+ assertTrue(addon.getPlayerCommand().isPresent());
+ assertTrue(addon.getAdminCommand().isPresent());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#onReload()}.
+ */
+ @Test
+ public void testOnReload() {
+ addon.onReload();
+ // Check that config.yml file has been saved
+ File check = new File("addons/AcidIsland","config.yml");
+ assertTrue(check.exists());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#createWorlds()}.
+ */
+ @Test
+ public void testCreateWorlds() {
+ addon.onLoad();
+ addon.createWorlds();
+ Mockito.verify(plugin).log("[AcidIsland] Creating AcidIsland...");
+ Mockito.verify(plugin).log("[AcidIsland] Creating AcidIsland's Nether...");
+ Mockito.verify(plugin).log("[AcidIsland] Creating AcidIsland's End World...");
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#getSettings()}.
+ */
+ @Test
+ public void testGetSettings() {
+ addon.onLoad();
+ assertNotNull(addon.getSettings());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#getWorldSettings()}.
+ */
+ @Test
+ public void testGetWorldSettings() {
+ addon.onLoad();
+ assertEquals(addon.getSettings(), addon.getWorldSettings());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#getDefaultWorldGenerator(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testGetDefaultWorldGeneratorStringString() {
+ assertNull(addon.getDefaultWorldGenerator("", ""));
+ addon.onLoad();
+ addon.createWorlds();
+ assertNotNull(addon.getDefaultWorldGenerator("", ""));
+ assertTrue(addon.getDefaultWorldGenerator("", "") instanceof ChunkGeneratorWorld);
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#allLoaded()}.
+ */
+ @Test
+ public void testAllLoaded() {
+ addon.allLoaded();
+ }
+
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.AcidIsland#saveWorldSettings()}.
+ */
+ @Test
+ public void testSaveWorldSettings() {
+ addon.saveWorldSettings();
+ }
+
+}
diff --git a/src/test/java/world/bentobox/acidisland/events/AcidEventTest.java b/src/test/java/world/bentobox/acidisland/events/AcidEventTest.java
index cef6f3d..c3d2c6b 100644
--- a/src/test/java/world/bentobox/acidisland/events/AcidEventTest.java
+++ b/src/test/java/world/bentobox/acidisland/events/AcidEventTest.java
@@ -21,12 +21,11 @@ public class AcidEventTest {
@Mock
private Player player;
- private List effects;
private AcidEvent e;
@Before
- public void setUp() throws Exception {
- effects = Arrays.asList(PotionEffectType.values());
+ public void setUp() {
+ List effects = Arrays.asList(PotionEffectType.values());
e = new AcidEvent(player, 10, 5, effects);
}
@@ -49,18 +48,18 @@ public class AcidEventTest {
@Test
public void testGetTotalDamage() {
- assertTrue(e.getTotalDamage() == 10D);
+ assertEquals(10D, e.getTotalDamage(), 0D);
}
@Test
public void testGetProtection() {
- assertTrue(e.getProtection() == 5D);
+ assertEquals(5D, e.getProtection(), 0D);
}
@Test
public void testSetTotalDamage() {
e.setTotalDamage(50);
- assertTrue(e.getTotalDamage() == 50D);
+ assertEquals(50D, e.getTotalDamage(), 0D);
}
@Test
diff --git a/src/test/java/world/bentobox/acidisland/events/AcidRainEventTest.java b/src/test/java/world/bentobox/acidisland/events/AcidRainEventTest.java
index c8899a6..d4c28db 100644
--- a/src/test/java/world/bentobox/acidisland/events/AcidRainEventTest.java
+++ b/src/test/java/world/bentobox/acidisland/events/AcidRainEventTest.java
@@ -21,12 +21,11 @@ public class AcidRainEventTest {
@Mock
private Player player;
- private List effects;
private AcidRainEvent e;
@Before
- public void setUp() throws Exception {
- effects = Arrays.asList(PotionEffectType.values());
+ public void setUp() {
+ List effects = Arrays.asList(PotionEffectType.values());
e = new AcidRainEvent(player, 10, 5, effects);
}
diff --git a/src/test/java/world/bentobox/acidisland/listeners/AcidEffectTest.java b/src/test/java/world/bentobox/acidisland/listeners/AcidEffectTest.java
index ab7e93c..99aab9d 100644
--- a/src/test/java/world/bentobox/acidisland/listeners/AcidEffectTest.java
+++ b/src/test/java/world/bentobox/acidisland/listeners/AcidEffectTest.java
@@ -12,6 +12,7 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
@@ -34,6 +35,7 @@ import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.plugin.PluginManager;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler;
@@ -44,12 +46,19 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
+import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.User;
+
import world.bentobox.acidisland.AISettings;
import world.bentobox.acidisland.AcidIsland;
+import world.bentobox.bentobox.BentoBox;
+import world.bentobox.bentobox.managers.IslandWorldManager;
+import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.PlayersManager;
import world.bentobox.bentobox.util.Util;
@@ -91,18 +100,34 @@ public class AcidEffectTest {
private PlayerInventory inv;
@Mock
private ItemMeta itemMeta;
+ @Mock
+ private PluginManager pim;
+ @Mock
+ private Essentials essentials;
+ @Mock
+ private User essentialsUser;
+ @Mock
+ private BentoBox plugin;
+ @Mock
+ private IslandWorldManager iwm;
+ @Mock
+ private IslandsManager im;
/**
- * @throws java.lang.Exception
*/
@Before
- public void setUp() throws Exception {
- PowerMockito.mockStatic(Bukkit.class);
+ public void setUp() {
+ PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
when(Bukkit.getScheduler()).thenReturn(scheduler);
when(addon.getSettings()).thenReturn(settings);
when(addon.getOverWorld()).thenReturn(world);
+ // Essentials
+ when(Bukkit.getPluginManager()).thenReturn(pim);
+ when(pim.getPlugin(eq("Essentials"))).thenReturn(essentials);
+ when(essentials.getUser(any(Player.class))).thenReturn(essentialsUser);
+
// Player
when(player.getGameMode()).thenReturn(GameMode.SURVIVAL);
when(player.getWorld()).thenReturn(world);
@@ -149,14 +174,23 @@ public class AcidEffectTest {
when(world.getMaxHeight()).thenReturn(5);
when(world.getEnvironment()).thenReturn(Environment.NORMAL);
+ // Plugin
+ when(addon.getPlugin()).thenReturn(plugin);
+ when(plugin.getIWM()).thenReturn(iwm);
+ // CUSTOM damage protection
+ when(iwm.getIvSettings(any())).thenReturn(Collections.singletonList("CUSTOM"));
+
+ // Island manager
+ when(addon.getIslands()).thenReturn(im);
+ when(im.userIsOnIsland(any(), any())).thenReturn(true);
+
ae = new AcidEffect(addon);
}
/**
- * @throws java.lang.Exception
*/
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
}
/**
@@ -235,6 +269,40 @@ public class AcidEffectTest {
verify(settings, times(2)).getAcidDamageDelay();
}
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
+ */
+ @Test
+ public void testOnPlayerMoveVisitorNoAcidAndRainDamage() {
+ when(im.userIsOnIsland(any(), any())).thenReturn(false);
+ PlayerMoveEvent e = new PlayerMoveEvent(player, from, to);
+ ae.onPlayerMove(e);
+ verify(settings, never()).getAcidDamageDelay();
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
+ */
+ @Test
+ public void testOnPlayerMoveVisitorAcidAndRainDamage() {
+ // No protection against CUSTOM damage
+ when(iwm.getIvSettings(any())).thenReturn(Collections.emptyList());
+ PlayerMoveEvent e = new PlayerMoveEvent(player, from, to);
+ ae.onPlayerMove(e);
+ verify(settings, times(2)).getAcidDamageDelay();
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
+ */
+ @Test
+ public void testOnPlayerMoveGodModeNoAcidAndRainDamage() {
+ when(essentialsUser.isGodModeEnabled()).thenReturn(true);
+ PlayerMoveEvent e = new PlayerMoveEvent(player, from, to);
+ ae.onPlayerMove(e);
+ verify(settings, never()).getAcidDamageDelay();
+ }
+
/**
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
*/
@@ -319,8 +387,8 @@ public class AcidEffectTest {
PlayerMoveEvent e = new PlayerMoveEvent(player, from, to);
ae.onPlayerMove(e);
- // 2 times only
- verify(addon, times(2)).getPlugin();
+ // 3 times only
+ verify(addon, times(3)).getPlugin();
}
/**
@@ -335,8 +403,8 @@ public class AcidEffectTest {
PlayerMoveEvent e = new PlayerMoveEvent(player, from, to);
ae.onPlayerMove(e);
- // 2 times only
- verify(addon, times(2)).getPlugin();
+ // 3 times only
+ verify(addon, times(3)).getPlugin();
}
/**
diff --git a/src/test/java/world/bentobox/acidisland/listeners/LavaCheckTest.java b/src/test/java/world/bentobox/acidisland/listeners/LavaCheckTest.java
new file mode 100644
index 0000000..c23c29a
--- /dev/null
+++ b/src/test/java/world/bentobox/acidisland/listeners/LavaCheckTest.java
@@ -0,0 +1,194 @@
+package world.bentobox.acidisland.listeners;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyFloat;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.event.block.BlockFromToEvent;
+import org.bukkit.inventory.PlayerInventory;
+import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.plugin.PluginManager;
+import org.bukkit.scheduler.BukkitScheduler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.User;
+
+import world.bentobox.acidisland.AISettings;
+import world.bentobox.acidisland.AcidIsland;
+import world.bentobox.bentobox.BentoBox;
+import world.bentobox.bentobox.managers.IslandWorldManager;
+import world.bentobox.bentobox.managers.IslandsManager;
+import world.bentobox.bentobox.managers.PlayersManager;
+import world.bentobox.bentobox.util.Util;
+
+/**
+ * @author tastybento
+ *
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({Bukkit.class, Util.class})
+public class LavaCheckTest {
+ @Mock
+ private AcidIsland addon;
+ @Mock
+ private BukkitScheduler scheduler;
+ private AISettings settings;
+ @Mock
+ private Location from;
+ @Mock
+ private Location to;
+ @Mock
+ private World world;
+ @Mock
+ private Location location;
+ @Mock
+ private PlayersManager pm;
+ @Mock
+ private Block block;
+ @Mock
+ private Block airBlock;
+ @Mock
+ private Block solidBlock;
+ @Mock
+ private PlayerInventory inv;
+ @Mock
+ private ItemMeta itemMeta;
+ @Mock
+ private PluginManager pim;
+ @Mock
+ private Essentials essentials;
+ @Mock
+ private User essentialsUser;
+ @Mock
+ private BentoBox plugin;
+ @Mock
+ private IslandWorldManager iwm;
+ @Mock
+ private IslandsManager im;
+
+ private LavaCheck lc;
+
+ /**
+ */
+ @Before
+ public void setUp() {
+ PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
+ when(Bukkit.getScheduler()).thenReturn(scheduler);
+ settings = new AISettings();
+ when(addon.getSettings()).thenReturn(settings);
+ when(addon.getOverWorld()).thenReturn(world);
+ // Blocks
+ when(block.getType()).thenReturn(Material.WATER);
+ when(block.getWorld()).thenReturn(world);
+ when(block.getLocation()).thenReturn(location);
+
+ // CUT
+ lc = new LavaCheck(addon);
+ }
+
+ /**
+ */
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.LavaCheck#onCleanstoneGen(org.bukkit.event.block.BlockFromToEvent)}.
+ */
+ @Test
+ public void testOnCleanstoneGen() {
+ ArgumentCaptor argument = ArgumentCaptor.forClass(Runnable.class);
+
+ BlockFromToEvent e = new BlockFromToEvent(airBlock, block);
+ lc.onCleanstoneGen(e);
+
+ verify(scheduler).runTask(any(), argument.capture());
+ // make block now be stone
+ when(block.getType()).thenReturn(Material.STONE);
+ // Run runnable
+ argument.getValue().run();
+ verify(block).setType(eq(Material.WATER));
+ verify(world).playSound(eq(location), eq(Sound.ENTITY_CREEPER_PRIMED), eq(1F), eq(2F));
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.LavaCheck#onCleanstoneGen(org.bukkit.event.block.BlockFromToEvent)}.
+ */
+ @Test
+ public void testOnCleanstoneGenNoStone() {
+ ArgumentCaptor argument = ArgumentCaptor.forClass(Runnable.class);
+
+ BlockFromToEvent e = new BlockFromToEvent(airBlock, block);
+ lc.onCleanstoneGen(e);
+
+ verify(scheduler).runTask(any(), argument.capture());
+ // make block now be obsidian
+ when(block.getType()).thenReturn(Material.OBSIDIAN);
+ // Run runnable
+ argument.getValue().run();
+ verify(block, never()).setType(any());
+ verify(world, never()).playSound(any(Location.class), any(Sound.class), anyFloat(),anyFloat());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.LavaCheck#onCleanstoneGen(org.bukkit.event.block.BlockFromToEvent)}.
+ */
+ @Test
+ public void testOnCleanstoneGenWrongWorld() {
+ when(block.getWorld()).thenReturn(Mockito.mock(World.class));
+
+ BlockFromToEvent e = new BlockFromToEvent(airBlock, block);
+ lc.onCleanstoneGen(e);
+ verify(block, never()).setType(any());
+ verify(world, never()).playSound(any(Location.class), any(Sound.class), anyFloat(),anyFloat());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.LavaCheck#onCleanstoneGen(org.bukkit.event.block.BlockFromToEvent)}.
+ */
+ @Test
+ public void testOnCleanstoneGenNotWater() {
+ when(block.getType()).thenReturn(Material.LAVA);
+
+ BlockFromToEvent e = new BlockFromToEvent(airBlock, block);
+ lc.onCleanstoneGen(e);
+ verify(block, never()).setType(any());
+ verify(world, never()).playSound(any(Location.class), any(Sound.class), anyFloat(),anyFloat());
+ }
+
+ /**
+ * Test method for {@link world.bentobox.acidisland.listeners.LavaCheck#onCleanstoneGen(org.bukkit.event.block.BlockFromToEvent)}.
+ */
+ @Test
+ public void testOnCleanstoneGenNoAcid() {
+ // No acid damage
+ settings.setAcidDamage(0);
+
+ BlockFromToEvent e = new BlockFromToEvent(airBlock, block);
+ lc.onCleanstoneGen(e);
+
+ verify(block, never()).setType(any());
+ verify(world, never()).playSound(any(Location.class), any(Sound.class), anyFloat(),anyFloat());
+ }
+
+
+}
diff --git a/src/test/java/world/bentobox/acidisland/world/AcidTaskTest.java b/src/test/java/world/bentobox/acidisland/world/AcidTaskTest.java
index 00a0a8d..057e381 100644
--- a/src/test/java/world/bentobox/acidisland/world/AcidTaskTest.java
+++ b/src/test/java/world/bentobox/acidisland/world/AcidTaskTest.java
@@ -64,8 +64,6 @@ public class AcidTaskTest {
@Mock
private World world;
- private List mob;
-
@Mock
private @Nullable World nether;
@Mock
@@ -81,10 +79,9 @@ public class AcidTaskTest {
/**
- * @throws java.lang.Exception
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
when(Bukkit.getScheduler()).thenReturn(scheduler);
when(scheduler.runTaskTimerAsynchronously(any(), any(Runnable.class), anyLong(), anyLong())).thenReturn(task);
@@ -101,7 +98,7 @@ public class AcidTaskTest {
// Default squid
- mob = new ArrayList<>();
+ List mob = new ArrayList<>();
Squid squid = mock(Squid.class);
when(squid.getType()).thenReturn(EntityType.SQUID);
when(squid.getLocation()).thenReturn(l);
@@ -141,10 +138,9 @@ public class AcidTaskTest {
}
/**
- * @throws java.lang.Exception
*/
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
}
/**
diff --git a/src/test/java/world/bentobox/acidisland/world/ChunkGeneratorWorldTest.java b/src/test/java/world/bentobox/acidisland/world/ChunkGeneratorWorldTest.java
index 2f02b53..9decf0e 100644
--- a/src/test/java/world/bentobox/acidisland/world/ChunkGeneratorWorldTest.java
+++ b/src/test/java/world/bentobox/acidisland/world/ChunkGeneratorWorldTest.java
@@ -54,10 +54,9 @@ public class ChunkGeneratorWorldTest {
private ChunkData data;
/**
- * @throws java.lang.Exception
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
// Bukkit
PowerMockito.mockStatic(Bukkit.class);
Server server = mock(Server.class);
@@ -76,10 +75,9 @@ public class ChunkGeneratorWorldTest {
}
/**
- * @throws java.lang.Exception
*/
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
}
/**