Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Oct 11, 2020
2 parents c896925 + d72cc11 commit 2d7aa21
Show file tree
Hide file tree
Showing 22 changed files with 2,642 additions and 281 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.4</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.16.1-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.16.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.14.0</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.14.2</build.version>
<build.version>1.14.3</build.version>
</properties>

<!-- Profiles will allow to automatically change build version. -->
Expand Down Expand Up @@ -147,6 +147,10 @@
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>ess-repo</id>
<url>https://ci.ender.zone/plugin/repository/everything/</url>
</repository>
</repositories>


Expand Down Expand Up @@ -192,6 +196,13 @@
<artifactId>org.eclipse.jdt.annotation</artifactId>
<version>2.2.200</version>
</dependency>
<!-- EssentialsX -->
<dependency>
<groupId>net.ess3</groupId>
<artifactId>EssentialsX</artifactId>
<version>2.17.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -267,11 +278,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.2.0</version>
<configuration>
<source>8</source>
<show>public</show>
<failOnError>false</failOnError>
<additionalJOption>-Xdoclint:none</additionalJOption>
<!-- <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable> -->
</configuration>
<executions>
<execution>
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/world/bentobox/acidisland/AISettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -1082,7 +1081,9 @@ public void setAcidRainDamage(int acidRainDamage) {
/**
* @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
*/
Expand Down Expand Up @@ -1196,7 +1197,9 @@ public void setHelmetProtection(boolean helmetProtection) {
/**
* @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
Expand Down
18 changes: 7 additions & 11 deletions src/main/java/world/bentobox/acidisland/AcidIsland.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -30,7 +31,7 @@ public class AcidIsland extends GameModeAddon {
private @Nullable AISettings settings;
private @Nullable AcidTask acidTask;
private @Nullable ChunkGenerator chunkGenerator;
private Config<AISettings> config = new Config<>(this, AISettings.class);
private final Config<AISettings> config = new Config<>(this, AISettings.class);

private static final String NETHER = "_nether";
private static final String THE_END = "_the_end";
Expand Down Expand Up @@ -100,33 +101,28 @@ public AISettings getSettings() {
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);
Expand Down Expand Up @@ -161,7 +157,7 @@ private World getWorld(String worldName2, Environment env, @Nullable ChunkGenera

@Override
public WorldSettings getWorldSettings() {
return settings;
return getSettings();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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<PotionEffectType> potionEffects;

private boolean cancelled;


/**
* @param player
* @param rainDamage
* @param protection
*/
protected AbstractAcidEvent(Player player, double protection, List<PotionEffectType> 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<PotionEffectType> getPotionEffects() {
return potionEffects;
}

/**
*
* @param potionEffects the potionEffects to set
* @since 1.9.1
*/
public void setPotionEffects(List<PotionEffectType> 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;
}
}
69 changes: 2 additions & 67 deletions src/main/java/world/bentobox/acidisland/events/AcidEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
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;

/**
Expand All @@ -14,13 +11,9 @@
* @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<PotionEffectType> potionEffects;

/**
* @param player - player
Expand All @@ -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<PotionEffectType> 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;
}

/**
Expand All @@ -59,51 +34,11 @@ public double getTotalDamage() {
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
*/
public void setTotalDamage(double totalDamage) {
this.totalDamage = totalDamage;
}

/**
* @return the potionEffects
*/
public List<PotionEffectType> getPotionEffects() {
return potionEffects;
}

/**
* @param potionEffects the potionEffects to set
*/
public void setPotionEffects(List<PotionEffectType> 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;
}
}
Loading

0 comments on commit 2d7aa21

Please sign in to comment.