mirror of
https://github.com/BentoBoxWorld/AcidIsland.git
synced 2024-12-23 01:27:36 +01:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
4c6cb94877
562
pom.xml
562
pom.xml
@ -1,254 +1,336 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>acidisland</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>acidisland</artifactId>
|
||||
<version>${revision}</version>
|
||||
|
||||
<name>AcidIsland</name>
|
||||
<description>AcidIsland is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
|
||||
<url>https://github.com/BentoBoxWorld/AcidIsland</url>
|
||||
<inceptionYear>2017</inceptionYear>
|
||||
<name>AcidIsland</name>
|
||||
<description>AcidIsland is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
|
||||
<url>https://github.com/BentoBoxWorld/AcidIsland</url>
|
||||
<inceptionYear>2017</inceptionYear>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/BentoBoxWorld/AcidIsland.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:BentoBoxWorld/AcidIsland.git</developerConnection>
|
||||
<url>https://github.com/BentoBoxWorld/AcidIsland</url>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>tastybento</id>
|
||||
<email>tastybento@bentobox.world</email>
|
||||
<timezone>-8</timezone>
|
||||
<roles>
|
||||
<role>Lead Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<ciManagement>
|
||||
<system>jenkins</system>
|
||||
<url>http://ci.codemc.org/job/BentoBoxWorld/job/AcidIsland</url>
|
||||
</ciManagement>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/BentoBoxWorld/AcidIsland.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:BentoBoxWorld/AcidIsland.git</developerConnection>
|
||||
<url>https://github.com/BentoBoxWorld/AcidIsland</url>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/BentoBoxWorld/AcidIsland/issues</url>
|
||||
</issueManagement>
|
||||
<ciManagement>
|
||||
<system>jenkins</system>
|
||||
<url>http://ci.codemc.org/job/BentoBoxWorld/job/AcidIsland</url>
|
||||
</ciManagement>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.org/repository/maven-snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>codemc-releases</id>
|
||||
<url>https://repo.codemc.org/repository/maven-releases</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/BentoBoxWorld/AcidIsland/issues</url>
|
||||
</issueManagement>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<powermock.version>1.7.4</powermock.version>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.org/repository/maven-snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>codemc-releases</id>
|
||||
<url>https://repo.codemc.org/repository/maven-releases</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- Non-minecraft related dependencies -->
|
||||
<powermock.version>2.0.2</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>1.6.0-SNAPSHOT</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.6.0</build.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.14.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>1.10.19</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>${powermock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito</artifactId>
|
||||
<version>${powermock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>bentobox</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<!-- Profiles will allow to automatically change build version. -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- ci profile is activated if exist environment variable BUILD_NUMBER. -->
|
||||
<!-- It replaces ${build.number} that is currently '-LOCAL' with
|
||||
correct build number from JENKINS machine. -->
|
||||
<id>ci</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- Override only if necessary -->
|
||||
<build.number>-b${env.BUILD_NUMBER}</build.number>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Master profile is activated if exist environment variable
|
||||
GIT_BRANCH and its value is origin/master. -->
|
||||
<!-- It will replace 'revision' with '${build.version}' so it
|
||||
removes '-SNAPSHOT' string at the end. -->
|
||||
<!-- Also, as this is release build, build number can be set
|
||||
to empty string. -->
|
||||
<!-- This profile will be used only if exist environment variable
|
||||
GIT_BRANCH with value origin/master. -->
|
||||
<id>master</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.GIT_BRANCH</name>
|
||||
<value>origin/master</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- Override only if necessary -->
|
||||
<revision>${build.version}</revision>
|
||||
<!-- Empties build number variable. -->
|
||||
<build.number></build.number>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>sonar</id>
|
||||
<properties>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
<sonar.organization>tastybento-github</sonar.organization>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>3.4.1.1168</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sonar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources/locales</directory>
|
||||
<targetPath>./locales</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources/blueprints</directory>
|
||||
<targetPath>./blueprints</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>*.blu</include>
|
||||
<include>*.json</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<nonFilteredFileExtensions>
|
||||
<nonFilteredFileExtension>blu</nonFilteredFileExtension>
|
||||
</nonFilteredFileExtensions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
<failOnError>false</failOnError>
|
||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.1</version>
|
||||
<configuration>
|
||||
<append>true</append>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>pre-unit-test</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>post-unit-test</id>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc</id>
|
||||
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>sonar</id>
|
||||
<properties>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
<sonar.organization>tastybento-github</sonar.organization>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>3.4.1.1168</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sonar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>${spigot.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Mockito (Unit testing) -->
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>${powermock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito2</artifactId>
|
||||
<version>${powermock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>bentobox</artifactId>
|
||||
<version>${bentobox.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- By default ${revision} is ${build.version}-SNAPSHOT -->
|
||||
<!-- If GIT_BRANCH variable is set to origin/master, then it will
|
||||
be only ${build.version}. -->
|
||||
|
||||
<!-- By default ${build.number} is -LOCAL. -->
|
||||
<!-- If the BUILD_NUMBER variable is set, then it will be -b[number]. -->
|
||||
<!-- If GIT_BRANCH variable is set to origin/master, then it will
|
||||
be the empty string. -->
|
||||
<finalName>${project.name}-${revision}${build.number}</finalName>
|
||||
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources/locales</directory>
|
||||
<targetPath>./locales</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources/blueprints</directory>
|
||||
<targetPath>./blueprints</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>*.blu</include>
|
||||
<include>*.json</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<nonFilteredFileExtensions>
|
||||
<nonFilteredFileExtension>blu</nonFilteredFileExtension>
|
||||
</nonFilteredFileExtensions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
<failOnError>false</failOnError>
|
||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.3</version>
|
||||
<configuration>
|
||||
<append>true</append>
|
||||
<excludes>
|
||||
<!-- This is required to prevent Jacoco from adding synthetic fields
|
||||
to a JavaBean class (causes errors in testing) -->
|
||||
<exclude>**/*Names*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>pre-unit-test</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>post-unit-test</id>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -194,11 +194,6 @@ public class AISettings implements WorldSettings {
|
||||
@ConfigEntry(path = "world.nether.sea-height", needsReset = true)
|
||||
private int netherSeaHeight = 54;
|
||||
|
||||
@ConfigComment("Nether trees are made if a player grows a tree in the nether (gravel and glowstone)")
|
||||
@ConfigComment("Applies to both vanilla and islands Nether")
|
||||
@ConfigEntry(path = "world.nether.trees")
|
||||
private boolean netherTrees = true;
|
||||
|
||||
@ConfigComment("Make the nether roof, if false, there is nothing up there")
|
||||
@ConfigComment("Change to false if lag is a problem from the generation")
|
||||
@ConfigComment("Only applies to islands Nether")
|
||||
@ -367,6 +362,10 @@ public class AISettings implements WorldSettings {
|
||||
@ConfigEntry(path = "island.deaths.team-join-reset")
|
||||
private boolean teamJoinDeathReset = true;
|
||||
|
||||
@ConfigComment("Reset player death count when they start a new island or reset and island")
|
||||
@ConfigEntry(path = "island.deaths.reset-on-new-island")
|
||||
private boolean deathsResetOnNewIsland = true;
|
||||
|
||||
// Ranks
|
||||
@ConfigEntry(path = "island.customranks")
|
||||
private Map<String, Integer> customRanks = new HashMap<>();
|
||||
@ -772,13 +771,6 @@ public class AISettings implements WorldSettings {
|
||||
public boolean isNetherRoof() {
|
||||
return netherRoof;
|
||||
}
|
||||
/**
|
||||
* @return the netherTrees
|
||||
*/
|
||||
@Override
|
||||
public boolean isNetherTrees() {
|
||||
return netherTrees;
|
||||
}
|
||||
/**
|
||||
* @return the onJoinResetEnderChest
|
||||
*/
|
||||
@ -1141,12 +1133,6 @@ public class AISettings implements WorldSettings {
|
||||
public void setNetherSpawnRadius(int netherSpawnRadius) {
|
||||
this.netherSpawnRadius = netherSpawnRadius;
|
||||
}
|
||||
/**
|
||||
* @param netherTrees the netherTrees to set
|
||||
*/
|
||||
public void setNetherTrees(boolean netherTrees) {
|
||||
this.netherTrees = netherTrees;
|
||||
}
|
||||
/**
|
||||
* @param onJoinResetEnderChest the onJoinResetEnderChest to set
|
||||
*/
|
||||
@ -1286,5 +1272,18 @@ public class AISettings implements WorldSettings {
|
||||
public void setAcidDamageSnow(boolean acidDamageSnow) {
|
||||
this.acidDamageSnow = acidDamageSnow;
|
||||
}
|
||||
/**
|
||||
* @return the deathsResetOnNewIsland
|
||||
*/
|
||||
@Override
|
||||
public boolean isDeathsResetOnNewIsland() {
|
||||
return deathsResetOnNewIsland;
|
||||
}
|
||||
/**
|
||||
* @param deathsResetOnNewIsland the deathsResetOnNewIsland to set
|
||||
*/
|
||||
public void setDeathsResetOnNewIsland(boolean deathsResetOnNewIsland) {
|
||||
this.deathsResetOnNewIsland = deathsResetOnNewIsland;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public class AcidIsland extends GameModeAddon {
|
||||
private AISettings settings;
|
||||
private AcidTask acidTask;
|
||||
private @NonNull ChunkGenerator chunkGenerator;
|
||||
private Config<AISettings> config = new Config<>(this, AISettings.class);
|
||||
|
||||
private static final String NETHER = "_nether";
|
||||
private static final String THE_END = "_the_end";
|
||||
@ -45,7 +46,7 @@ public class AcidIsland extends GameModeAddon {
|
||||
}
|
||||
|
||||
private boolean loadSettings() {
|
||||
settings = new Config<>(this, AISettings.class).loadConfigObject();
|
||||
settings = config.loadConfigObject();
|
||||
if (settings == null) {
|
||||
// Woops
|
||||
this.logError("AcidIsland settings could not load! Addon disabled.");
|
||||
@ -65,6 +66,11 @@ public class AcidIsland extends GameModeAddon {
|
||||
if (settings == null) {
|
||||
return;
|
||||
}
|
||||
// Set default access to boats
|
||||
Flags.BOAT.setDefaultSetting(islandWorld, true);
|
||||
if (netherWorld != null) Flags.BOAT.setDefaultSetting(netherWorld, true);
|
||||
if (endWorld != null) Flags.BOAT.setDefaultSetting(endWorld, true);
|
||||
|
||||
// Register listeners
|
||||
// Acid Effects
|
||||
registerListener(new AcidEffect(this));
|
||||
@ -92,6 +98,9 @@ public class AcidIsland extends GameModeAddon {
|
||||
getPlugin().log(string);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see world.bentobox.bentobox.api.addons.GameModeAddon#createWorlds()
|
||||
*/
|
||||
@Override
|
||||
public void createWorlds() {
|
||||
String worldName = settings.getWorldName().toLowerCase();
|
||||
@ -102,8 +111,6 @@ public class AcidIsland extends GameModeAddon {
|
||||
chunkGenerator = new ChunkGeneratorWorld(this);
|
||||
islandWorld = WorldCreator.name(worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(chunkGenerator)
|
||||
.createWorld();
|
||||
// Set default access to boats
|
||||
Flags.BOAT.setDefaultSetting(islandWorld, true);
|
||||
// Make the nether if it does not exist
|
||||
if (settings.isNetherGenerate()) {
|
||||
if (getServer().getWorld(worldName + NETHER) == null) {
|
||||
@ -111,7 +118,7 @@ public class AcidIsland extends GameModeAddon {
|
||||
}
|
||||
if (!settings.isNetherIslands()) {
|
||||
netherWorld = WorldCreator.name(worldName + NETHER).type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
|
||||
Flags.BOAT.setDefaultSetting(netherWorld, true);
|
||||
|
||||
} else {
|
||||
netherWorld = WorldCreator.name(worldName + NETHER).type(WorldType.FLAT).generator(chunkGenerator)
|
||||
.environment(World.Environment.NETHER).createWorld();
|
||||
@ -124,7 +131,6 @@ public class AcidIsland extends GameModeAddon {
|
||||
}
|
||||
if (!settings.isEndIslands()) {
|
||||
endWorld = WorldCreator.name(worldName + THE_END).type(WorldType.NORMAL).environment(World.Environment.THE_END).createWorld();
|
||||
Flags.BOAT.setDefaultSetting(endWorld, true);
|
||||
} else {
|
||||
endWorld = WorldCreator.name(worldName + THE_END).type(WorldType.FLAT).generator(chunkGenerator)
|
||||
.environment(World.Environment.THE_END).createWorld();
|
||||
@ -152,7 +158,7 @@ public class AcidIsland extends GameModeAddon {
|
||||
@Override
|
||||
public void saveWorldSettings() {
|
||||
if (settings != null) {
|
||||
new Config<>(this, AISettings.class).saveConfigObject(settings);
|
||||
config.saveConfigObject(settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import world.bentobox.bentobox.api.commands.admin.AdminReloadCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminResetFlagsCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminSetrankCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminSetspawnCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminSwitchCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminSwitchtoCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminTeleportCommand;
|
||||
@ -22,6 +23,7 @@ import world.bentobox.bentobox.api.commands.admin.AdminVersionCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.AdminWhyCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.deaths.AdminDeathsCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.range.AdminRangeCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.resets.AdminResetsResetCommand;
|
||||
import world.bentobox.bentobox.api.commands.admin.team.AdminTeamAddCommand;
|
||||
@ -85,6 +87,10 @@ public class AcidCommand extends CompositeCommand {
|
||||
new AdminSwitchtoCommand(this);
|
||||
// Switch
|
||||
new AdminSwitchCommand(this);
|
||||
// Purge
|
||||
new AdminPurgeCommand(this);
|
||||
// Settings
|
||||
new AdminSettingsCommand(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,6 +12,7 @@ import world.bentobox.bentobox.api.commands.island.IslandExpelCommand;
|
||||
import world.bentobox.bentobox.api.commands.island.IslandGoCommand;
|
||||
import world.bentobox.bentobox.api.commands.island.IslandInfoCommand;
|
||||
import world.bentobox.bentobox.api.commands.island.IslandLanguageCommand;
|
||||
import world.bentobox.bentobox.api.commands.island.IslandNearCommand;
|
||||
import world.bentobox.bentobox.api.commands.island.IslandResetCommand;
|
||||
import world.bentobox.bentobox.api.commands.island.IslandResetnameCommand;
|
||||
import world.bentobox.bentobox.api.commands.island.IslandSethomeCommand;
|
||||
@ -54,6 +55,7 @@ public class AiCommand extends CompositeCommand {
|
||||
new IslandUnbanCommand(this);
|
||||
new IslandBanlistCommand(this);
|
||||
new IslandExpelCommand(this);
|
||||
new IslandNearCommand(this);
|
||||
// Team commands
|
||||
new IslandTeamCommand(this);
|
||||
}
|
||||
@ -69,10 +71,10 @@ public class AiCommand extends CompositeCommand {
|
||||
if (args.isEmpty()) {
|
||||
// If in world, go
|
||||
if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) {
|
||||
return getSubCommand("go").map(goCmd -> goCmd.execute(user, label, new ArrayList<>())).orElse(false);
|
||||
return getSubCommand("go").map(goCmd -> goCmd.call(user, label, new ArrayList<>())).orElse(false);
|
||||
}
|
||||
// No islands currently
|
||||
return getSubCommand("create").map(createCmd -> createCmd.execute(user, label, new ArrayList<>())).orElse(false);
|
||||
return getSubCommand("create").map(createCmd -> createCmd.call(user, label, new ArrayList<>())).orElse(false);
|
||||
}
|
||||
user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getLabel());
|
||||
return false;
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: AcidIsland
|
||||
main: world.bentobox.acidisland.AcidIsland
|
||||
version: ${project.version}
|
||||
version: ${version}${build.number}
|
||||
metrics: true
|
||||
repository: "BentoBoxWorld/AcidIsland"
|
||||
icon: "OAK_BOAT"
|
||||
|
@ -283,6 +283,8 @@ island:
|
||||
max: 10
|
||||
# When a player joins a team, reset their death count
|
||||
team-join-reset: true
|
||||
# Reset player death count when they start a new island or reset and island
|
||||
reset-on-new-island: true
|
||||
customranks: {}
|
||||
protection:
|
||||
# Geo restrict mobs.
|
||||
|
@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.acidisland.commands;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@ -17,6 +14,7 @@ import org.bukkit.entity.Player;
|
||||
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.core.classloader.annotations.PrepareForTest;
|
||||
@ -37,7 +35,8 @@ import world.bentobox.bentobox.managers.CommandsManager;
|
||||
@PrepareForTest({Bukkit.class, BentoBox.class, User.class })
|
||||
public class AcidCommandTest {
|
||||
|
||||
private static final int NUM_COMMANDS = 27;
|
||||
private static final int NUM_COMMANDS = 29;
|
||||
@Mock
|
||||
private User user;
|
||||
|
||||
/**
|
||||
@ -56,7 +55,6 @@ public class AcidCommandTest {
|
||||
// Player
|
||||
Player p = mock(Player.class);
|
||||
// Sometimes use Mockito.withSettings().verboseLogging()
|
||||
user = mock(User.class);
|
||||
when(user.isOp()).thenReturn(false);
|
||||
UUID uuid = UUID.randomUUID();
|
||||
when(user.getUniqueId()).thenReturn(uuid);
|
||||
@ -66,7 +64,7 @@ public class AcidCommandTest {
|
||||
|
||||
// Locales
|
||||
// Return the reference (USE THIS IN THE FUTURE)
|
||||
when(user.getTranslation(Mockito.anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgumentAt(0, String.class));
|
||||
when(user.getTranslation(Mockito.anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,33 +1,43 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.acidisland.commands;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
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.AISettings;
|
||||
import world.bentobox.acidisland.AcidIsland;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
import world.bentobox.bentobox.Settings;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBundle;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.managers.BlueprintsManager;
|
||||
import world.bentobox.bentobox.managers.CommandsManager;
|
||||
import world.bentobox.bentobox.managers.IslandWorldManager;
|
||||
import world.bentobox.bentobox.managers.IslandsManager;
|
||||
@ -40,9 +50,15 @@ import world.bentobox.bentobox.managers.IslandsManager;
|
||||
@PrepareForTest({Bukkit.class, BentoBox.class, User.class })
|
||||
public class AiCommandTest {
|
||||
|
||||
private static final int NUMBER_OF_COMMANDS = 18;
|
||||
@Mock
|
||||
private User user;
|
||||
@Mock
|
||||
private IslandsManager im;
|
||||
@Mock
|
||||
private Island island;
|
||||
@Mock
|
||||
private AcidIsland addon;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
@ -60,28 +76,53 @@ public class AiCommandTest {
|
||||
// Player
|
||||
Player p = mock(Player.class);
|
||||
// Sometimes use Mockito.withSettings().verboseLogging()
|
||||
user = mock(User.class);
|
||||
when(user.isOp()).thenReturn(false);
|
||||
UUID uuid = UUID.randomUUID();
|
||||
when(user.getUniqueId()).thenReturn(uuid);
|
||||
when(user.getPlayer()).thenReturn(p);
|
||||
when(user.getName()).thenReturn("tastybento");
|
||||
when(user.isPlayer()).thenReturn(true);
|
||||
User.setPlugin(plugin);
|
||||
|
||||
// Island World Manager
|
||||
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
||||
// Settings
|
||||
Settings s = mock(Settings.class);
|
||||
when(plugin.getSettings()).thenReturn(s);
|
||||
|
||||
// Player has island to begin with
|
||||
im = mock(IslandsManager.class);
|
||||
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<String>) invocation -> invocation.getArgumentAt(0, String.class));
|
||||
when(user.getTranslation(Mockito.anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
|
||||
// Addon settings
|
||||
AISettings settings = mock(AISettings.class);
|
||||
when(settings.getIslandCommand()).thenReturn("ai");
|
||||
when(addon.getSettings()).thenReturn(settings);
|
||||
|
||||
// Blueprints
|
||||
BlueprintsManager bpm = mock(BlueprintsManager.class);
|
||||
Map<String, BlueprintBundle> map = new HashMap<>();
|
||||
BlueprintBundle bun = mock(BlueprintBundle.class);
|
||||
when(bun.getDisplayName()).thenReturn("aaa", "bbb");
|
||||
map.put("aaa", bun);
|
||||
map.put("bbb", bun);
|
||||
when(bun.getUniqueId()).thenReturn("unique1", "unique2");
|
||||
when(bun.isRequirePermission()).thenReturn(true);
|
||||
when(bpm.getBlueprintBundles(Mockito.any())).thenReturn(map);
|
||||
when(plugin.getBlueprintsManager()).thenReturn(bpm);
|
||||
|
||||
// Bukkit
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
PluginManager pim = mock(PluginManager.class);
|
||||
when(Bukkit.getPluginManager()).thenReturn(pim);
|
||||
BukkitScheduler sch = mock(BukkitScheduler.class);
|
||||
when(Bukkit.getScheduler()).thenReturn(sch);
|
||||
|
||||
}
|
||||
|
||||
@ -91,7 +132,6 @@ public class AiCommandTest {
|
||||
*/
|
||||
@Test
|
||||
public void testAiCommand() {
|
||||
Addon addon = mock(Addon.class);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertEquals("ai", cmd.getLabel());
|
||||
}
|
||||
@ -101,15 +141,13 @@ public class AiCommandTest {
|
||||
*/
|
||||
@Test
|
||||
public void testSetup() {
|
||||
Addon addon = mock(Addon.class);
|
||||
when(addon.getPermissionPrefix()).thenReturn("acidisland.");
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertEquals("acidisland.island", cmd.getPermission());
|
||||
assertTrue(cmd.isOnlyPlayer());
|
||||
assertEquals("commands.ai.parameters", cmd.getParameters());
|
||||
assertEquals("commands.island.help.description", cmd.getDescription());
|
||||
// Number of commands = sub commands + help
|
||||
assertEquals("Number of sub commands registered", 17, cmd.getSubCommands().values().size());
|
||||
assertEquals("Number of sub commands registered", NUMBER_OF_COMMANDS, cmd.getSubCommands().values().size());
|
||||
|
||||
}
|
||||
|
||||
@ -118,9 +156,8 @@ public class AiCommandTest {
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNullUsers() {
|
||||
Addon addon = mock(Addon.class);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertFalse(cmd.execute(null, "ai", Collections.emptyList()));
|
||||
assertFalse(cmd.execute(null, "island", Collections.emptyList()));
|
||||
|
||||
}
|
||||
|
||||
@ -129,31 +166,75 @@ public class AiCommandTest {
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringUnknownCommand() {
|
||||
Addon addon = mock(Addon.class);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertFalse(cmd.execute(user, "ai", Collections.singletonList("unknown")));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-command", TextVariables.LABEL, "ai");
|
||||
assertFalse(cmd.execute(user, "island", Collections.singletonList("unknown")));
|
||||
verify(user).sendMessage("general.errors.unknown-command", TextVariables.LABEL, "ai");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgs() {
|
||||
Addon addon = mock(Addon.class);
|
||||
public void testExecuteUserStringListOfStringNoArgsNoPermission() {
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertTrue(cmd.execute(user, "ai", Collections.emptyList()));
|
||||
assertFalse(cmd.execute(user, "island", Collections.emptyList()));
|
||||
verify(user).sendMessage("general.errors.no-permission", "[permission]", "island.home");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgsNoIsland() {
|
||||
island = null;
|
||||
Addon addon = mock(Addon.class);
|
||||
public void testExecuteUserStringListOfStringNoArgsSuccess() {
|
||||
when(user.hasPermission(anyString())).thenReturn(true);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertTrue(cmd.execute(user, "ai", Collections.emptyList()));
|
||||
assertTrue(cmd.execute(user, "island", Collections.emptyList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgsConsole() {
|
||||
when(user.isPlayer()).thenReturn(false);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertFalse(cmd.execute(user, "island", Collections.emptyList()));
|
||||
verify(user).sendMessage("general.errors.use-in-game");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgsNoIslandConsole() {
|
||||
when(user.isPlayer()).thenReturn(false);
|
||||
when(im.getIsland(any(), any(UUID.class))).thenReturn(null);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertFalse(cmd.execute(user, "island", Collections.emptyList()));
|
||||
verify(user).sendMessage("general.errors.use-in-game");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgsNoIslandNoPermission() {
|
||||
when(im.getIsland(any(), any(UUID.class))).thenReturn(null);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertFalse(cmd.execute(user, "island", Collections.emptyList()));
|
||||
verify(user).sendMessage("general.errors.no-permission", "[permission]", "island.create");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.commands.AiCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgsNoIslandCreateSuccess() {
|
||||
when(im.getIsland(any(), any(UUID.class))).thenReturn(null);
|
||||
when(user.hasPermission(Mockito.eq("island.create"))).thenReturn(true);
|
||||
AiCommand cmd = new AiCommand(addon, "ai");
|
||||
assertTrue(cmd.execute(user, "island", Collections.emptyList()));
|
||||
verify(user).getTranslation("commands.island.create.pick");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,16 +15,17 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
|
||||
public class AcidEventTest {
|
||||
|
||||
@Mock
|
||||
private Player player;
|
||||
private List<PotionEffectType> effects;
|
||||
private AcidEvent e;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
player = mock(Player.class);
|
||||
effects = Arrays.asList(PotionEffectType.values());
|
||||
e = new AcidEvent(player, 10, 5, effects);
|
||||
}
|
||||
|
@ -9,15 +9,16 @@ import static org.mockito.Mockito.mock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
|
||||
public class AcidRainEventTest {
|
||||
|
||||
@Mock
|
||||
private Player player;
|
||||
private AcidRainEvent e;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
player = mock(Player.class);
|
||||
e = new AcidRainEvent(player, 10, 5);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
package world.bentobox.acidisland.world;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -8,7 +12,7 @@ import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.Mock;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
@ -20,17 +24,17 @@ import world.bentobox.acidisland.AcidIsland;
|
||||
@PrepareForTest({Bukkit.class})
|
||||
public class AcidTaskTest {
|
||||
|
||||
@Mock
|
||||
private BukkitScheduler scheduler;
|
||||
@Mock
|
||||
private AISettings settings;
|
||||
@Mock
|
||||
private AcidIsland addon;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
scheduler = mock(BukkitScheduler.class);
|
||||
when(Bukkit.getScheduler()).thenReturn(scheduler);
|
||||
addon = mock(AcidIsland.class);
|
||||
settings = mock(AISettings.class);
|
||||
when(settings.getAcidDestroyItemTime()).thenReturn(0L);
|
||||
when(addon.getSettings()).thenReturn(settings);
|
||||
}
|
||||
@ -38,22 +42,22 @@ public class AcidTaskTest {
|
||||
@Test
|
||||
public void testAcidTaskDoNotDestroyItems() {
|
||||
new AcidTask(addon);
|
||||
Mockito.verify(scheduler).scheduleSyncRepeatingTask(Mockito.any(), Mockito.any(Runnable.class), Mockito.eq(0L), Mockito.eq(20L));
|
||||
verify(scheduler).scheduleSyncRepeatingTask(any(), any(Runnable.class), eq(0L), eq(20L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAcidTaskDestroyItems() {
|
||||
when(settings.getAcidDestroyItemTime()).thenReturn(5L);
|
||||
new AcidTask(addon);
|
||||
Mockito.verify(scheduler).scheduleSyncRepeatingTask(Mockito.any(), Mockito.any(Runnable.class), Mockito.eq(0L), Mockito.eq(20L));
|
||||
Mockito.verify(scheduler).scheduleSyncRepeatingTask(Mockito.any(), Mockito.any(Runnable.class), Mockito.eq(100L), Mockito.eq(100L));
|
||||
verify(scheduler).scheduleSyncRepeatingTask(any(), any(Runnable.class), eq(0L), eq(20L));
|
||||
verify(scheduler).scheduleSyncRepeatingTask(any(), any(Runnable.class), eq(100L), eq(100L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAcidTaskCancelTasks() {
|
||||
AcidTask task = new AcidTask(addon);
|
||||
task.cancelTasks();
|
||||
Mockito.verify(scheduler).cancelTask(Mockito.anyInt());
|
||||
verify(scheduler).cancelTask(anyInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -61,7 +65,7 @@ public class AcidTaskTest {
|
||||
when(settings.getAcidDestroyItemTime()).thenReturn(5L);
|
||||
AcidTask task = new AcidTask(addon);
|
||||
task.cancelTasks();
|
||||
Mockito.verify(scheduler, Mockito.times(2)).cancelTask(Mockito.anyInt());
|
||||
verify(scheduler, times(2)).cancelTask(anyInt());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user