Compare commits
115 Commits
Author | SHA1 | Date |
---|---|---|
tastybento | bcceb819fd | |
tastybento | eb1d21fee1 | |
tastybento | 7b232294ed | |
tastybento | e32e0df220 | |
tastybento | 1058b5fbc1 | |
tastybento | abbc9ab319 | |
tastybento | ac5dedf156 | |
tastybento | 8882eb2605 | |
tastybento | 000489e8ef | |
Dusty | edc1287007 | |
tastybento | 466fafddea | |
tastybento | 198cc66319 | |
tastybento | 40b382d878 | |
tastybento | ec507c9de9 | |
tastybento | 46d80325e5 | |
tastybento | 6c1109cf4e | |
tastybento | 461f3672d8 | |
tastybento | 8c9626b9aa | |
tastybento | 4a1642f403 | |
mt-gitlocalize | 6f3da07886 | |
tastybento | 8ee933f2f2 | |
tastybento | ac999a044a | |
tastybento | 7384711a64 | |
tastybento | a689d36f57 | |
tastybento | 39a7df44ee | |
tastybento | 1d3be20237 | |
tastybento | 533aee12cb | |
tastybento | 48e1923fbb | |
4o4E | 1dd3b1bf85 | |
tastybento | 85835a40b9 | |
tastybento | 817ae62130 | |
tastybento | 9db846a76e | |
tastybento | 9647338a2f | |
tastybento | 46b0c89d3e | |
tastybento | c381f1b1da | |
tastybento | 83f28a672f | |
BONNe | cd5e31a1a4 | |
tastybento | 48a5ca7526 | |
BONNe | 5362fc689e | |
tastybento | 76ab022246 | |
tastybento | 3276813674 | |
tastybento | f79aeac4b8 | |
tastybento | ed9c5abb9a | |
tastybento | cb41ef9ef3 | |
tastybento | 451e2b7045 | |
tastybento | c9dd709a68 | |
tastybento | 5c9eed21fd | |
tastybento | 0bf125498f | |
tastybento | 2039860051 | |
tastybento | 4782d789d8 | |
tastybento | 26156ca4de | |
tastybento | 177f171dfc | |
tastybento | c0e7b6072c | |
tastybento | b703e91129 | |
tastybento | ea16a45114 | |
tastybento | f51ff4165b | |
tastybento | 7aa5dc6187 | |
tastybento | 0411f66d7a | |
tastybento | e4570fed53 | |
gitlocalize-app[bot] | 1b14b0afc5 | |
BONNe | 41aa6f4d57 | |
BONNe | 9e21d9dc86 | |
BONNe | 0e3db2b696 | |
BONNe | 7241845a44 | |
BONNe | 5868815e9d | |
tastybento | 8c8c70d749 | |
BONNe | ea3e92ea67 | |
tastybento | c9072c3e3d | |
gitlocalize-app[bot] | a99fbc3ecb | |
gitlocalize-app[bot] | fe5aa64379 | |
gitlocalize-app[bot] | e17a43d302 | |
gitlocalize-app[bot] | d736639a97 | |
gitlocalize-app[bot] | a754350535 | |
tastybento | 78016ffff1 | |
tastybento | e8b115760f | |
tastybento | 8a0928f087 | |
tastybento | 6925f0002b | |
tastybento | c9367feea8 | |
tastybento | 7db6449af5 | |
tastybento | 86783b5516 | |
tastybento | 6bc6f71a4a | |
tastybento | 21c09a8a34 | |
tastybento | 908b0a834f | |
tastybento | 88e44c9e1d | |
tastybento | f96ff088be | |
tastybento | 563c52e7a1 | |
tastybento | 53ff4f3c65 | |
tastybento | 45757d4ab4 | |
tastybento | 8f65e1807c | |
tastybento | 2917edcc6e | |
tastybento | 0d347b76c8 | |
tastybento | a13e88900b | |
tastybento | f30203f547 | |
tastybento | dd91440201 | |
tastybento | 4bfd78af19 | |
tastybento | a0adae0911 | |
tastybento | 00b0bda860 | |
tastybento | 8e107fc0a9 | |
tastybento | 6be3468b2a | |
tastybento | 5fd56876f1 | |
tastybento | 6a518c4a82 | |
tastybento | f6e9fd4816 | |
tastybento | 72aa445c13 | |
tastybento | 1e39d80ced | |
tastybento | 7fe15dbc76 | |
tastybento | 4122bf1853 | |
BONNe | 2a573e9fc5 | |
BONNe | 611707f31c | |
tastybento | 2c8f833516 | |
tastybento | 65146ab5d0 | |
tastybento | 9fab51482b | |
tastybento | f5e12cf0df | |
tastybento | 890ddc9c9d | |
tastybento | 4f6a5b4c28 | |
tastybento | 8f48064f41 |
|
@ -1,33 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
**Description**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Steps to reproduce the behavior:**
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Server Information:**
|
||||
|
||||
[Please complete the following information:]
|
||||
- Database being used (Flat file, MySQL, Mongo): []
|
||||
- OS: [e.g. iOS]
|
||||
- Java Version: [e.g. Java 8]
|
||||
- BentoBox version: [e.g. 1.7.2.21]
|
||||
- Addons installed? [Do '/bentobox version' and copy/paste from the console]
|
||||
- Other plugins? [Do '/plugins' and copy/paste from the console]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -0,0 +1,38 @@
|
|||
name: SonarCloud
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
name: Build and analyze
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 17
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
- name: Build and analyze
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BentoBoxWorld_AcidIsland
|
18
.travis.yml
18
.travis.yml
|
@ -1,18 +0,0 @@
|
|||
language: java
|
||||
sudo: false
|
||||
addons:
|
||||
sonarcloud:
|
||||
organization: "bentobox-world"
|
||||
|
||||
jdk:
|
||||
- openjdk11
|
||||
|
||||
script:
|
||||
# JaCoCo is used to have code coverage, the agent has to be activated
|
||||
#- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent org.jacoco:jacoco-maven-plugin:report package sonar:sonar
|
||||
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=BentoBoxWorld_AcidIsland
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- '$HOME/.m2/repository'
|
||||
- '$HOME/.sonar/cache'
|
24
README.md
24
README.md
|
@ -1,20 +1,26 @@
|
|||
AcidIsland™
|
||||
===========
|
||||
[![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/AcidIsland)](https://ci.codemc.org/job/BentoBoxWorld/job/AcidIsland/)
|
||||
[![Lines Of Code](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Aacidisland&metric=ncloc)](https://sonarcloud.io/component_measures?id=world.bentobox%3Aacidisland&metric=ncloc)
|
||||
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Aacidisland&metric=sqale_rating)](https://sonarcloud.io/component_measures?id=world.bentobox%3Aacidisland&metric=Maintainability)
|
||||
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Aacidisland&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=world.bentobox%3Aacidisland&metric=Reliability)
|
||||
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Aacidisland&metric=security_rating)](https://sonarcloud.io/component_measures?id=world.bentobox%3Aacidisland&metric=Security)
|
||||
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Aacidisland&metric=bugs)](https://sonarcloud.io/project/issues?id=world.bentobox%3Aacidisland&resolved=false&types=BUG)
|
||||
[![Lines Of Code](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_AcidIsland&metric=ncloc)](https://sonarcloud.io/component_measures?id=BentoBoxWorld_AcidIsland&metric=ncloc)
|
||||
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_AcidIsland&metric=sqale_rating)](https://sonarcloud.io/component_measures?id=BentoBoxWorld_AcidIslandd&metric=Maintainability)
|
||||
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_AcidIsland&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=BentoBoxWorld_AcidIsland&metric=Reliability)
|
||||
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_AcidIsland&metric=security_rating)](https://sonarcloud.io/component_measures?id=BentoBoxWorld_AcidIsland&metric=Security)
|
||||
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_AcidIsland&metric=bugs)](https://sonarcloud.io/project/issues?id=BentoBoxWorld_AcidIsland&resolved=false&types=BUG)
|
||||
|
||||
# Introduction
|
||||
AcidIsland™ add-on for BentoBox, so to run an AcidIsland™ game, you must have BentoBox installed. It is not a Bukkit plugin and trying to use it as one will not work.
|
||||
AcidIsland™ add-on for BentoBox, so to run an AcidIsland™ game, you must have BentoBox installed. Docs can be found at [https://docs.bentobox.world](https://docs.bentobox.world).
|
||||
|
||||
|
||||
## The Story
|
||||
You're on an island, in a sea of acid! If you like Skyblock, try the AcidIsland™ game mode for a new challenge!
|
||||
|
||||
This is a variation of SkyBlock. Instead of falling, you must contend with acid water when expanding your island and players can boat to each other's islands.
|
||||
Instead of falling you must contend with acid water when expanding your island, and players can boat to each other's islands.
|
||||
|
||||
<img width="512" alt="acidislandart" src="https://github.com/BentoBoxWorld/AcidIsland/assets/4407265/60e97bba-2b7d-425e-9130-cffef73cf76e">
|
||||
|
||||
## Download
|
||||
|
||||
You can download from GitHub, or ready made plugin packs from [https://download.bentobox.world](https://download.bentobox.world).
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -36,8 +42,8 @@ AcidIsland™ add-on uses the BentoBox API. Here are some other ones that you ma
|
|||
* Challenges - challenges
|
||||
* Biomes - enables biomes
|
||||
|
||||
You can find the projects on GitHub.
|
||||
You can find the projects on GitHub or download load from [https://download.bentobox.world](https://download.bentobox.world).
|
||||
|
||||
Bugs and Feature requests
|
||||
=========================
|
||||
File bug and feature requests here: https://github.com/BentoBoxWorld/AcidIsland/issues
|
||||
File bug and feature requests here: [https://github.com/BentoBoxWorld/AcidIsland/issues](https://github.com/BentoBoxWorld/AcidIsland/issues)
|
||||
|
|
109
pom.xml
109
pom.xml
|
@ -54,18 +54,22 @@
|
|||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>17</java.version>
|
||||
<!-- Non-minecraft related dependencies -->
|
||||
<powermock.version>2.0.4</powermock.version>
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.16.2-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>1.14.0</bentobox.version>
|
||||
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>2.3.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.14.5</build.version>
|
||||
<build.version>1.19.0</build.version>
|
||||
<!-- Sonar Cloud -->
|
||||
<sonar.projectKey>BentoBoxWorld_AcidIsland</sonar.projectKey>
|
||||
<sonar.organization>bentobox-world</sonar.organization>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
</properties>
|
||||
|
||||
<!-- Profiles will allow to automatically change build version. -->
|
||||
|
@ -108,30 +112,6 @@
|
|||
<build.number></build.number>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>sonar</id>
|
||||
<properties>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
<sonar.organization>bentobox-world</sonar.organization>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>3.6.0.1398</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sonar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
|
@ -139,14 +119,14 @@
|
|||
<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>
|
||||
<repository>
|
||||
<id>codemc</id>
|
||||
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||
|
@ -166,7 +146,7 @@
|
|||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.11.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -194,7 +174,7 @@
|
|||
<dependency>
|
||||
<groupId>org.eclipse.jdt</groupId>
|
||||
<artifactId>org.eclipse.jdt.annotation</artifactId>
|
||||
<version>2.2.200</version>
|
||||
<version>2.2.600</version>
|
||||
</dependency>
|
||||
<!-- EssentialsX -->
|
||||
<dependency>
|
||||
|
@ -261,14 +241,46 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<release>${java.version}</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<argLine>
|
||||
${argLine}
|
||||
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||
--add-opens java.base/java.math=ALL-UNNAMED
|
||||
--add-opens java.base/java.io=ALL-UNNAMED
|
||||
--add-opens java.base/java.util=ALL-UNNAMED
|
||||
--add-opens
|
||||
java.base/java.util.stream=ALL-UNNAMED
|
||||
--add-opens java.base/java.text=ALL-UNNAMED
|
||||
--add-opens
|
||||
java.base/java.util.regex=ALL-UNNAMED
|
||||
--add-opens
|
||||
java.base/java.nio.channels.spi=ALL-UNNAMED
|
||||
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
|
||||
--add-opens java.base/java.net=ALL-UNNAMED
|
||||
--add-opens
|
||||
java.base/java.util.concurrent=ALL-UNNAMED
|
||||
--add-opens java.base/sun.nio.fs=ALL-UNNAMED
|
||||
--add-opens java.base/sun.nio.cs=ALL-UNNAMED
|
||||
--add-opens java.base/java.nio.file=ALL-UNNAMED
|
||||
--add-opens
|
||||
java.base/java.nio.charset=ALL-UNNAMED
|
||||
--add-opens
|
||||
java.base/java.lang.reflect=ALL-UNNAMED
|
||||
--add-opens
|
||||
java.logging/java.util.logging=ALL-UNNAMED
|
||||
--add-opens java.base/java.lang.ref=ALL-UNNAMED
|
||||
--add-opens java.base/java.util.jar=ALL-UNNAMED
|
||||
--add-opens java.base/java.util.zip=ALL-UNNAMED
|
||||
</argLine>
|
||||
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -278,13 +290,13 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.4.1</version>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<source>17</source>
|
||||
<show>public</show>
|
||||
<failOnError>false</failOnError>
|
||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||
<!-- <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable> -->
|
||||
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -329,30 +341,37 @@
|
|||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.3</version>
|
||||
<version>0.8.10</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>
|
||||
<!-- Prevents the Material is too large to mock error -->
|
||||
<exclude>org/bukkit/Material*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>pre-unit-test</id>
|
||||
<id>prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>post-unit-test</id>
|
||||
<id>report</id>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<formats>
|
||||
<format>XML</format>
|
||||
</formats>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package world.bentobox.acidisland;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
@ -20,10 +16,8 @@ import world.bentobox.bentobox.api.configuration.ConfigEntry;
|
|||
import world.bentobox.bentobox.api.configuration.StoreAt;
|
||||
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
||||
import world.bentobox.bentobox.api.flags.Flag;
|
||||
import world.bentobox.bentobox.database.objects.adapters.Adapter;
|
||||
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer;
|
||||
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer2;
|
||||
import world.bentobox.bentobox.database.objects.adapters.PotionEffectListAdapter;
|
||||
import world.bentobox.bentobox.database.objects.adapters.*;
|
||||
|
||||
|
||||
/**
|
||||
* Settings for AcidIsland
|
||||
|
@ -178,13 +172,13 @@ public class AISettings implements WorldSettings {
|
|||
@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)
|
||||
private int islandDistance = 192;
|
||||
private int islandDistance = 64;
|
||||
|
||||
@ConfigComment("Default protection range radius in blocks. Cannot be larger than distance.")
|
||||
@ConfigComment("Admins can change protection sizes for players individually using /acid range set <player> <new range>")
|
||||
@ConfigComment("or set this permission: acidisland.island.range.<number>")
|
||||
@ConfigEntry(path = "world.protection-range", overrideOnChange = true)
|
||||
private int islandProtectionRange = 100;
|
||||
private int islandProtectionRange = 50;
|
||||
|
||||
@ConfigComment("Start islands at these coordinates. This is where new islands will start in the")
|
||||
@ConfigComment("world. These must be a factor of your island distance, but the plugin will auto")
|
||||
|
@ -206,6 +200,10 @@ public class AISettings implements WorldSettings {
|
|||
@ConfigComment("It is the y coordinate of the bedrock block in the schem.")
|
||||
@ConfigEntry(path = "world.island-height")
|
||||
private int islandHeight = 50;
|
||||
|
||||
@ConfigComment("Disallow team members from having their own islands.")
|
||||
@ConfigEntry(path = "world.disallow-team-member-islands")
|
||||
private boolean disallowTeamMemberIslands = false;
|
||||
|
||||
@ConfigComment("Use your own world generator for this world.")
|
||||
@ConfigComment("In this case, the plugin will not generate anything.")
|
||||
|
@ -216,6 +214,30 @@ public class AISettings implements WorldSettings {
|
|||
@ConfigComment("Minimum is 0, which means you are playing Skyblock!")
|
||||
@ConfigEntry(path = "world.sea-height")
|
||||
private int seaHeight = 54;
|
||||
|
||||
@ConfigComment("Water block. This should usually stay as WATER, but may be LAVA for fun")
|
||||
@ConfigEntry(path = "world.water-block", needsReset = true)
|
||||
private Material waterBlock = Material.WATER;
|
||||
|
||||
@ConfigComment("Ocean Floor")
|
||||
@ConfigComment("This creates an ocean floor environment, with vanilla elements.")
|
||||
@ConfigEntry(path = "world.ocean-floor", needsReset = true)
|
||||
private boolean oceanFloor = false;
|
||||
|
||||
@ConfigComment("Structures")
|
||||
@ConfigComment("This creates an vanilla structures in the worlds.")
|
||||
@ConfigEntry(path = "world.make-structures", needsReset = true)
|
||||
private boolean makeStructures = false;
|
||||
|
||||
@ConfigComment("Caves")
|
||||
@ConfigComment("This creates an vanilla caves in the worlds.")
|
||||
@ConfigEntry(path = "world.make-caves", needsReset = true)
|
||||
private boolean makeCaves = false;
|
||||
|
||||
@ConfigComment("Decorations")
|
||||
@ConfigComment("This creates an vanilla decorations in the worlds.")
|
||||
@ConfigEntry(path = "world.make-decorations", needsReset = true)
|
||||
private boolean makeDecorations = true;
|
||||
|
||||
@ConfigComment("Maximum number of islands in the world. Set to -1 or 0 for unlimited. ")
|
||||
@ConfigComment("If the number of islands is greater than this number, no new island will be created.")
|
||||
|
@ -260,6 +282,10 @@ public class AISettings implements WorldSettings {
|
|||
@ConfigComment("Changing mid-game will cause problems!")
|
||||
@ConfigEntry(path = "world.nether.sea-height", needsReset = true)
|
||||
private int netherSeaHeight = 54;
|
||||
|
||||
@ConfigComment("Water block. This should usually stay as WATER, but may be LAVA for fun")
|
||||
@ConfigEntry(path = "world.nether.water-block", needsReset = true)
|
||||
private Material netherWaterBlock = Material.WATER;
|
||||
|
||||
@ConfigComment("Make the nether roof, if false, there is nothing up there")
|
||||
@ConfigComment("Change to false if lag is a problem from the generation")
|
||||
|
@ -274,6 +300,12 @@ public class AISettings implements WorldSettings {
|
|||
@ConfigEntry(path = "world.nether.spawn-radius")
|
||||
private int netherSpawnRadius = 32;
|
||||
|
||||
@ConfigComment("This option indicates if nether portals should be linked via dimensions.")
|
||||
@ConfigComment("Option will simulate vanilla portal mechanics that links portals together")
|
||||
@ConfigComment("or creates a new portal, if there is not a portal in that dimension.")
|
||||
@ConfigEntry(path = "world.nether.create-and-link-portals", since = "1.14.6")
|
||||
private boolean makeNetherPortals = false;
|
||||
|
||||
// End
|
||||
@ConfigComment("End Nether - if this is false, the end world will not be made and access to")
|
||||
@ConfigComment("the end will not occur. Other plugins may still enable portal usage.")
|
||||
|
@ -288,6 +320,15 @@ public class AISettings implements WorldSettings {
|
|||
@ConfigComment("Changing mid-game will cause problems!")
|
||||
@ConfigEntry(path = "world.end.sea-height", needsReset = true)
|
||||
private int endSeaHeight = 54;
|
||||
|
||||
@ConfigComment("Water block. This should usually stay as WATER, but may be LAVA for fun")
|
||||
@ConfigEntry(path = "world.end.water-block", needsReset = true)
|
||||
private Material endWaterBlock = Material.WATER;
|
||||
|
||||
@ConfigComment("This option indicates if obsidian platform in the end should be generated")
|
||||
@ConfigComment("when player enters the end world.")
|
||||
@ConfigEntry(path = "world.end.create-obsidian-platform", since = "1.14.6")
|
||||
private boolean makeEndPortals = false;
|
||||
|
||||
@ConfigEntry(path = "world.end.dragon-spawn", experimental = true)
|
||||
private boolean dragonSpawn = false;
|
||||
|
@ -307,13 +348,12 @@ public class AISettings implements WorldSettings {
|
|||
@ConfigComment("The value is the minimum island rank required allowed to do the action")
|
||||
@ConfigComment("Ranks are: Visitor = 0, Member = 900, Owner = 1000")
|
||||
@ConfigEntry(path = "world.default-island-flags")
|
||||
@Adapter(FlagSerializer.class)
|
||||
private Map<Flag, Integer> defaultIslandFlags = new HashMap<>();
|
||||
private Map<String, Integer> defaultIslandFlagNames = new HashMap<>();
|
||||
|
||||
@ConfigComment("These are the default settings for new islands")
|
||||
@ConfigEntry(path = "world.default-island-settings")
|
||||
@Adapter(FlagSerializer2.class)
|
||||
private Map<Flag, Integer> defaultIslandSettings = new HashMap<>();
|
||||
@Adapter(FlagBooleanSerializer.class)
|
||||
private Map<String, Integer> defaultIslandSettingNames = new HashMap<>();
|
||||
|
||||
@ConfigComment("These settings/flags are hidden from users")
|
||||
@ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings")
|
||||
|
@ -512,6 +552,21 @@ public class AISettings implements WorldSettings {
|
|||
@ConfigEntry(path = "island.commands.on-leave")
|
||||
private List<String> onLeaveCommands = new ArrayList<>();
|
||||
|
||||
@ConfigComment("List of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.")
|
||||
@ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,")
|
||||
@ConfigComment("in which case they are executed by the player.")
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Available placeholders for the commands are the following:")
|
||||
@ConfigComment(" * [name]: name of the player")
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Here are some examples of valid commands to execute:")
|
||||
@ConfigComment(" * '[SUDO] bbox version'")
|
||||
@ConfigComment(" * 'bsbadmin deaths set [player] 0'")
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.")
|
||||
@ConfigEntry(path = "island.commands.on-respawn", since = "1.14.0")
|
||||
private List<String> onRespawnCommands = new ArrayList<>();
|
||||
|
||||
// Sethome
|
||||
@ConfigComment("Allow setting home in the nether. Only available on nether islands, not vanilla nether.")
|
||||
@ConfigEntry(path = "island.sethome.nether.allow")
|
||||
|
@ -647,20 +702,50 @@ public class AISettings implements WorldSettings {
|
|||
public GameMode getDefaultGameMode() {
|
||||
return defaultGameMode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the defaultIslandFlags
|
||||
* @since 1.21.0
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Integer> getDefaultIslandFlagNames()
|
||||
{
|
||||
return defaultIslandFlagNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the defaultIslandSettings
|
||||
* @since 1.21.0
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Integer> getDefaultIslandSettingNames()
|
||||
{
|
||||
return defaultIslandSettingNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the defaultIslandProtection
|
||||
* @deprecated since 1.21
|
||||
*/
|
||||
@Override
|
||||
public Map<Flag, Integer> getDefaultIslandFlags() {
|
||||
return defaultIslandFlags;
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the defaultIslandSettings
|
||||
* @deprecated since 1.21
|
||||
*/
|
||||
@Override
|
||||
public Map<Flag, Integer> getDefaultIslandSettings() {
|
||||
return defaultIslandSettings;
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the difficulty
|
||||
*/
|
||||
|
@ -1164,14 +1249,14 @@ public class AISettings implements WorldSettings {
|
|||
}
|
||||
/**
|
||||
*/
|
||||
public void setDefaultIslandFlags(Map<Flag, Integer> defaultIslandFlags) {
|
||||
this.defaultIslandFlags = defaultIslandFlags;
|
||||
public void setDefaultIslandFlagNames(Map<String, Integer> defaultIslandFlags) {
|
||||
this.defaultIslandFlagNames = defaultIslandFlags;
|
||||
}
|
||||
/**
|
||||
* @param defaultIslandSettings the defaultIslandSettings to set
|
||||
*/
|
||||
public void setDefaultIslandSettings(Map<Flag, Integer> defaultIslandSettings) {
|
||||
this.defaultIslandSettings = defaultIslandSettings;
|
||||
public void setDefaultIslandSettingNames(Map<String, Integer> defaultIslandSettings) {
|
||||
this.defaultIslandSettingNames = defaultIslandSettings;
|
||||
}
|
||||
/**
|
||||
* @param difficulty the difficulty to set
|
||||
|
@ -1520,6 +1605,24 @@ public class AISettings implements WorldSettings {
|
|||
public void setOnLeaveCommands(List<String> onLeaveCommands) {
|
||||
this.onLeaveCommands = onLeaveCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the onRespawnCommands
|
||||
*/
|
||||
@Override
|
||||
public List<String> getOnRespawnCommands() {
|
||||
return onRespawnCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets on respawn commands.
|
||||
*
|
||||
* @param onRespawnCommands the on respawn commands
|
||||
*/
|
||||
public void setOnRespawnCommands(List<String> onRespawnCommands) {
|
||||
this.onRespawnCommands = onRespawnCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the onJoinResetHealth
|
||||
*/
|
||||
|
@ -1651,7 +1754,7 @@ public class AISettings implements WorldSettings {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param acidRainEffects
|
||||
* @param acidRainEffects potion effects from rain
|
||||
* @since 1.9.1
|
||||
*/
|
||||
public void setAcidRainEffects(List<PotionEffectType> acidRainEffects) {
|
||||
|
@ -1884,4 +1987,117 @@ public class AISettings implements WorldSettings {
|
|||
public void setMobLimitSettings(List<String> mobLimitSettings) {
|
||||
this.mobLimitSettings = mobLimitSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the makeNetherPortals
|
||||
*/
|
||||
@Override
|
||||
public boolean isMakeNetherPortals() {
|
||||
return makeNetherPortals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the makeEndPortals
|
||||
*/
|
||||
@Override
|
||||
public boolean isMakeEndPortals() {
|
||||
return makeEndPortals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets make nether portals.
|
||||
* @param makeNetherPortals the make nether portals
|
||||
*/
|
||||
public void setMakeNetherPortals(boolean makeNetherPortals) {
|
||||
this.makeNetherPortals = makeNetherPortals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets make end portals.
|
||||
* @param makeEndPortals the make end portals
|
||||
*/
|
||||
public void setMakeEndPortals(boolean makeEndPortals) {
|
||||
this.makeEndPortals = makeEndPortals;
|
||||
}
|
||||
public Material getWaterBlock() {
|
||||
return waterBlock;
|
||||
}
|
||||
public void setWaterBlock(Material waterBlock) {
|
||||
this.waterBlock = waterBlock;
|
||||
}
|
||||
public Material getNetherWaterBlock() {
|
||||
return netherWaterBlock;
|
||||
}
|
||||
public void setNetherWaterBlock(Material netherWaterBlock) {
|
||||
this.netherWaterBlock = netherWaterBlock;
|
||||
}
|
||||
public Material getEndWaterBlock() {
|
||||
return endWaterBlock;
|
||||
}
|
||||
public void setEndWaterBlock(Material endWaterBlock) {
|
||||
this.endWaterBlock = endWaterBlock;
|
||||
}
|
||||
public boolean isOceanFloor() {
|
||||
return oceanFloor;
|
||||
}
|
||||
public void setOceanFloor(boolean oceanFloor) {
|
||||
this.oceanFloor = oceanFloor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the makeStructures
|
||||
*/
|
||||
public boolean isMakeStructures() {
|
||||
return makeStructures;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param makeStructures the makeStructures to set
|
||||
*/
|
||||
public void setMakeStructures(boolean makeStructures) {
|
||||
this.makeStructures = makeStructures;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the makeCaves
|
||||
*/
|
||||
public boolean isMakeCaves() {
|
||||
return makeCaves;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param makeCaves the makeCaves to set
|
||||
*/
|
||||
public void setMakeCaves(boolean makeCaves) {
|
||||
this.makeCaves = makeCaves;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the makeDecorations
|
||||
*/
|
||||
public boolean isMakeDecorations() {
|
||||
return makeDecorations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param makeDecorations the makeDecorations to set
|
||||
*/
|
||||
public void setMakeDecorations(boolean makeDecorations) {
|
||||
this.makeDecorations = makeDecorations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the disallowTeamMemberIslands
|
||||
*/
|
||||
@Override
|
||||
public boolean isDisallowTeamMemberIslands() {
|
||||
return disallowTeamMemberIslands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param disallowTeamMemberIslands the disallowTeamMemberIslands to set
|
||||
*/
|
||||
public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) {
|
||||
this.disallowTeamMemberIslands = disallowTeamMemberIslands;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package world.bentobox.acidisland;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.entity.SpawnCategory;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
@ -12,6 +16,7 @@ import org.eclipse.jdt.annotation.Nullable;
|
|||
import world.bentobox.acidisland.commands.IslandAboutCommand;
|
||||
import world.bentobox.acidisland.listeners.AcidEffect;
|
||||
import world.bentobox.acidisland.listeners.LavaCheck;
|
||||
import world.bentobox.acidisland.world.AcidBiomeProvider;
|
||||
import world.bentobox.acidisland.world.AcidTask;
|
||||
import world.bentobox.acidisland.world.ChunkGeneratorWorld;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
|
@ -32,9 +37,18 @@ public class AcidIsland extends GameModeAddon {
|
|||
private @Nullable AcidTask acidTask;
|
||||
private @Nullable ChunkGenerator chunkGenerator;
|
||||
private final Config<AISettings> config = new Config<>(this, AISettings.class);
|
||||
private BiomeProvider biomeProvider;
|
||||
|
||||
private static final String NETHER = "_nether";
|
||||
private static final String THE_END = "_the_end";
|
||||
|
||||
/**
|
||||
* This addon uses the new chunk generation API for the sea bottom
|
||||
*/
|
||||
@Override
|
||||
public boolean isUsesNewChunkGeneration() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
@ -42,10 +56,11 @@ public class AcidIsland extends GameModeAddon {
|
|||
saveDefaultConfig();
|
||||
// Load settings from config.yml. This will check if there are any issues with it too.
|
||||
loadSettings();
|
||||
// Make the biome provider
|
||||
this.biomeProvider = new AcidBiomeProvider(this);
|
||||
// Chunk generator
|
||||
chunkGenerator = settings.isUseOwnGenerator() ? null : new ChunkGeneratorWorld(this);
|
||||
// Register commands
|
||||
// Register commands
|
||||
playerCommand = new DefaultPlayerCommand(this)
|
||||
|
||||
{
|
||||
|
@ -70,6 +85,7 @@ public class AcidIsland extends GameModeAddon {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -96,9 +112,9 @@ public class AcidIsland extends GameModeAddon {
|
|||
if (acidTask != null) acidTask.cancelTasks();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
public AISettings getSettings() {
|
||||
return settings;
|
||||
return Objects.requireNonNull(settings);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -143,24 +159,24 @@ public class AcidIsland extends GameModeAddon {
|
|||
WorldCreator wc = WorldCreator.name(worldName2).type(WorldType.FLAT).environment(env);
|
||||
World w = settings.isUseOwnGenerator() ? wc.createWorld() : wc.generator(chunkGenerator2).createWorld();
|
||||
// Set spawn rates
|
||||
if (w != null) {
|
||||
if (w != null && getSettings() != null) {
|
||||
if (getSettings().getSpawnLimitMonsters() > 0) {
|
||||
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
|
||||
w.setSpawnLimit(SpawnCategory.MONSTER, getSettings().getSpawnLimitMonsters());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAmbient() > 0) {
|
||||
w.setAmbientSpawnLimit(getSettings().getSpawnLimitAmbient());
|
||||
w.setSpawnLimit(SpawnCategory.AMBIENT, getSettings().getSpawnLimitAmbient());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAnimals() > 0) {
|
||||
w.setAnimalSpawnLimit(getSettings().getSpawnLimitAnimals());
|
||||
w.setSpawnLimit(SpawnCategory.ANIMAL, getSettings().getSpawnLimitAnimals());
|
||||
}
|
||||
if (getSettings().getSpawnLimitWaterAnimals() > 0) {
|
||||
w.setWaterAnimalSpawnLimit(getSettings().getSpawnLimitWaterAnimals());
|
||||
w.setSpawnLimit(SpawnCategory.WATER_ANIMAL, getSettings().getSpawnLimitWaterAnimals());
|
||||
}
|
||||
if (getSettings().getTicksPerAnimalSpawns() > 0) {
|
||||
w.setTicksPerAnimalSpawns(getSettings().getTicksPerAnimalSpawns());
|
||||
w.setTicksPerSpawns(SpawnCategory.ANIMAL, getSettings().getTicksPerAnimalSpawns());
|
||||
}
|
||||
if (getSettings().getTicksPerMonsterSpawns() > 0) {
|
||||
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
|
||||
w.setTicksPerSpawns(SpawnCategory.MONSTER, getSettings().getTicksPerMonsterSpawns());
|
||||
}
|
||||
}
|
||||
return w;
|
||||
|
@ -196,8 +212,11 @@ public class AcidIsland extends GameModeAddon {
|
|||
*/
|
||||
@Override
|
||||
public void allLoaded() {
|
||||
// Reload settings and save them. This will occur after all addons have loaded
|
||||
this.loadSettings();
|
||||
// Save settings. This will occur after all addons have loaded
|
||||
this.saveWorldSettings();
|
||||
}
|
||||
|
||||
public BiomeProvider getBiomeProvider() {
|
||||
return this.biomeProvider;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package world.bentobox.acidisland;
|
||||
|
||||
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
import world.bentobox.bentobox.api.addons.Pladdon;
|
||||
|
||||
public class AcidIslandPladdon extends Pladdon {
|
||||
|
||||
@Override
|
||||
public Addon getAddon() {
|
||||
return new AcidIsland();
|
||||
}
|
||||
}
|
|
@ -5,7 +5,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;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +14,6 @@ import org.bukkit.potion.PotionEffectType;
|
|||
*
|
||||
*/
|
||||
public abstract class AbstractAcidEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player player;
|
||||
private final double protection;
|
||||
|
@ -28,9 +26,9 @@ public abstract class AbstractAcidEvent extends Event implements Cancellable {
|
|||
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param rainDamage
|
||||
* @param protection
|
||||
* @param player player
|
||||
* @param protection protection value
|
||||
* @param potionEffects the potion effects applied
|
||||
*/
|
||||
protected AbstractAcidEvent(Player player, double protection, List<PotionEffectType> potionEffects) {
|
||||
this.player = player;
|
||||
|
@ -78,15 +76,6 @@ public abstract class AbstractAcidEvent extends Event implements Cancellable {
|
|||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
|
|
|
@ -3,6 +3,7 @@ package world.bentobox.acidisland.events;
|
|||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +15,16 @@ import org.bukkit.potion.PotionEffectType;
|
|||
public class AcidEvent extends AbstractAcidEvent {
|
||||
|
||||
private double totalDamage;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player - player
|
||||
|
|
|
@ -3,6 +3,7 @@ package world.bentobox.acidisland.events;
|
|||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +13,18 @@ import org.bukkit.potion.PotionEffectType;
|
|||
*
|
||||
*/
|
||||
public class AcidRainEvent extends AbstractAcidEvent {
|
||||
|
||||
private double rainDamage;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player - player
|
||||
|
|
|
@ -1,24 +1,35 @@
|
|||
package world.bentobox.acidisland.events;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when an entity (items excluded) receives damage from acid
|
||||
* @author Poslovitch
|
||||
* @author Poslovitch, tastybento
|
||||
* @since 1.0
|
||||
*/
|
||||
public class EntityDamageByAcidEvent extends IslandBaseEvent {
|
||||
public class EntityDamageByAcidEvent extends Event implements Cancellable {
|
||||
|
||||
private final Entity entity;
|
||||
private double damage;
|
||||
|
||||
public enum Acid { RAIN, WATER }
|
||||
private final Acid cause;
|
||||
private boolean cancelled;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public EntityDamageByAcidEvent(Island island, Entity entity, double damage, Acid cause) {
|
||||
super(island);
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public EntityDamageByAcidEvent(Entity entity, double damage, Acid cause) {
|
||||
this.entity = entity;
|
||||
this.damage = damage;
|
||||
this.cause = cause;
|
||||
|
@ -55,4 +66,15 @@ public class EntityDamageByAcidEvent extends IslandBaseEvent {
|
|||
public Acid getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
package world.bentobox.acidisland.events;
|
||||
|
||||
import org.bukkit.entity.Item;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when an item (on the ground) gets destroyed by acid
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
*/
|
||||
public class ItemDestroyByAcidEvent extends IslandBaseEvent {
|
||||
private final Item item;
|
||||
public class ItemDestroyByAcidEvent extends Event {
|
||||
|
||||
public ItemDestroyByAcidEvent(Island island, Item item) {
|
||||
super(island);
|
||||
private final Item item;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public ItemDestroyByAcidEvent(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package world.bentobox.acidisland.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
|
@ -10,10 +11,23 @@ import world.bentobox.bentobox.database.objects.Island;
|
|||
* Fired when an ItemStack (water bottle or bucket) is filled with acid
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
* @deprecated never used
|
||||
*/
|
||||
@Deprecated
|
||||
public class ItemFillWithAcidEvent extends IslandBaseEvent {
|
||||
|
||||
private final Player player;
|
||||
private final ItemStack item;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public ItemFillWithAcidEvent(Island island, Player player, ItemStack item) {
|
||||
super(island);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package world.bentobox.acidisland.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
@ -9,9 +10,22 @@ import world.bentobox.bentobox.database.objects.Island;
|
|||
* Fired when a player drinks acid and... DIES
|
||||
* @author Poslovitch
|
||||
* @since 1.0
|
||||
* @deprecated - never fired
|
||||
*/
|
||||
@Deprecated
|
||||
public class PlayerDrinkAcidEvent extends IslandBaseEvent {
|
||||
|
||||
private final Player player;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public PlayerDrinkAcidEvent(Island island, Player player) {
|
||||
super(island);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
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;
|
||||
|
@ -36,6 +35,8 @@ 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.events.EntityDamageByAcidEvent;
|
||||
import world.bentobox.acidisland.events.EntityDamageByAcidEvent.Acid;
|
||||
import world.bentobox.acidisland.world.AcidTask;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
@ -54,23 +55,31 @@ public class AcidEffect implements Listener {
|
|||
private boolean essentialsCheck;
|
||||
private static final List<PotionEffectType> EFFECTS;
|
||||
static {
|
||||
List<PotionEffectType> pe = Arrays.asList(
|
||||
PotionEffectType.BLINDNESS,
|
||||
PotionEffectType.CONFUSION,
|
||||
PotionEffectType.HUNGER,
|
||||
PotionEffectType.SLOW,
|
||||
PotionEffectType.SLOW_DIGGING,
|
||||
PotionEffectType.WEAKNESS,
|
||||
PotionEffectType.POISON);
|
||||
EFFECTS = Collections.unmodifiableList(pe);
|
||||
if (!inTest()) {
|
||||
EFFECTS = List.of(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HUNGER,
|
||||
PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS,
|
||||
PotionEffectType.POISON);
|
||||
} else {
|
||||
EFFECTS = List.of();
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<PotionEffectType> IMMUNE_EFFECTS;
|
||||
static {
|
||||
List<PotionEffectType> im = Arrays.asList(
|
||||
PotionEffectType.WATER_BREATHING,
|
||||
PotionEffectType.CONDUIT_POWER);
|
||||
IMMUNE_EFFECTS = Collections.unmodifiableList(im);
|
||||
if (!inTest()) {
|
||||
IMMUNE_EFFECTS = List.of(PotionEffectType.WATER_BREATHING, PotionEffectType.CONDUIT_POWER);
|
||||
} else {
|
||||
IMMUNE_EFFECTS = List.of();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks the stack trace for @Test to determine if a test is calling the code and skips.
|
||||
* TODO: when we find a way to mock Enchantment, remove this.
|
||||
* @return true if it's a test.
|
||||
*/
|
||||
private static boolean inTest() {
|
||||
return Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(e -> e.getClassName().endsWith("Test"));
|
||||
}
|
||||
|
||||
public AcidEffect(AcidIsland addon) {
|
||||
|
@ -91,7 +100,8 @@ public class AcidEffect implements Listener {
|
|||
public void onSeaBounce(PlayerMoveEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)
|
||||
&& player.getWorld().equals(addon.getOverWorld()) && player.getLocation().getBlockY() < 1) {
|
||||
&& player.getWorld().equals(addon.getOverWorld())
|
||||
&& player.getLocation().getBlockY() < player.getWorld().getMinHeight()) {
|
||||
player.setVelocity(new Vector(player.getVelocity().getX(), 1D, player.getVelocity().getZ()));
|
||||
}
|
||||
}
|
||||
|
@ -101,8 +111,7 @@ public class AcidEffect implements Listener {
|
|||
Player player = e.getPlayer();
|
||||
// Fast checks
|
||||
if ((addon.getSettings().getAcidRainDamage() == 0 && addon.getSettings().getAcidDamage() == 0)
|
||||
|| player.isDead()
|
||||
|| player.getGameMode().equals(GameMode.CREATIVE)
|
||||
|| player.isDead() || player.getGameMode().equals(GameMode.CREATIVE)
|
||||
|| player.getGameMode().equals(GameMode.SPECTATOR)
|
||||
|| addon.getPlayers().isInTeleport(player.getUniqueId())
|
||||
|| !Util.sameWorld(addon.getOverWorld(), player.getWorld())
|
||||
|
@ -135,7 +144,6 @@ public class AcidEffect implements Listener {
|
|||
}.runTaskTimer(addon.getPlugin(), 0L, 20L);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// If they are already burning in acid then return
|
||||
if (burningPlayers.containsKey(player) || isSafeFromAcid(player)) {
|
||||
|
@ -157,22 +165,35 @@ public class AcidEffect implements Listener {
|
|||
}.runTaskTimer(addon.getPlugin(), 0L, 20L);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if it is still raining or player is safe or dead or there is no damage
|
||||
* @param player player
|
||||
* @return true if the acid raid damage should stop
|
||||
*/
|
||||
protected boolean checkForRain(Player player) {
|
||||
if (!addon.getOverWorld().hasStorm() || player.isDead() || isSafeFromRain(player) || addon.getSettings().getAcidRainDamage() <= 0D) {
|
||||
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);
|
||||
AcidRainEvent event = new AcidRainEvent(player, totalDamage, protection,
|
||||
addon.getSettings().getAcidRainEffects());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
event.getPotionEffects().stream().filter(EFFECTS::contains).forEach(t -> player.addPotionEffect(new PotionEffect(t, addon.getSettings().getRainEffectDuation() * 20, 1)));
|
||||
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);
|
||||
EntityDamageByAcidEvent e = new EntityDamageByAcidEvent(player, event.getRainDamage(), Acid.RAIN);
|
||||
// Fire event
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
if (!e.isCancelled()) {
|
||||
player.damage(event.getRainDamage());
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 3F, 3F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,11 +210,17 @@ public class AcidEffect implements Listener {
|
|||
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)));
|
||||
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);
|
||||
if (event.getTotalDamage() > 0D) {
|
||||
EntityDamageByAcidEvent e = new EntityDamageByAcidEvent(player, event.getTotalDamage(), Acid.WATER);
|
||||
// Fire event
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
if (!e.isCancelled()) {
|
||||
player.damage(event.getTotalDamage());
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 3F, 3F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,22 +233,25 @@ public class AcidEffect implements Listener {
|
|||
* @return true if they are safe
|
||||
*/
|
||||
private boolean isSafeFromRain(Player player) {
|
||||
if (isEssentialsGodMode(player)
|
||||
|| player.getWorld().getEnvironment().equals(Environment.NETHER)
|
||||
if (isEssentialsGodMode(player) || player.getWorld().getEnvironment().equals(Environment.NETHER)
|
||||
|| player.getGameMode() != GameMode.SURVIVAL
|
||||
|| player.getWorld().getEnvironment().equals(Environment.THE_END)
|
||||
|| (addon.getSettings().isHelmetProtection() && (player.getInventory().getHelmet() != null && player.getInventory().getHelmet().getType().name().contains("HELMET")))
|
||||
|| (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))
|
||||
|| (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)))
|
||||
) {
|
||||
&& !addon.getIslands().userIsOnIsland(player.getWorld(), User.getInstance(player)))) {
|
||||
return true;
|
||||
}
|
||||
// Check if all air above player
|
||||
for (int y = player.getLocation().getBlockY() + 2; y < player.getLocation().getWorld().getMaxHeight(); y++) {
|
||||
if (!player.getLocation().getWorld().getBlockAt(player.getLocation().getBlockX(), y, player.getLocation().getBlockZ()).getType().equals(Material.AIR)) {
|
||||
if (!player.getLocation().getWorld()
|
||||
.getBlockAt(player.getLocation().getBlockX(), y, player.getLocation().getBlockZ()).getType()
|
||||
.equals(Material.AIR)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -233,30 +263,31 @@ public class AcidEffect implements Listener {
|
|||
* @param player - player
|
||||
* @return true if player is safe
|
||||
*/
|
||||
private boolean isSafeFromAcid(Player player) {
|
||||
boolean isSafeFromAcid(Player player) {
|
||||
// Check for GodMode
|
||||
if (isEssentialsGodMode(player)
|
||||
if (isEssentialsGodMode(player) || player.getGameMode() != GameMode.SURVIVAL
|
||||
// Protect visitors
|
||||
|| (addon.getPlugin().getIWM().getIvSettings(player.getWorld()).contains(DamageCause.CUSTOM.name())
|
||||
&& !addon.getIslands().userIsOnIsland(player.getWorld(), User.getInstance(player)))
|
||||
) {
|
||||
&& !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)
|
||||
&& (!player.getLocation().getBlock().getType().equals(Material.SNOW) || !addon.getSettings().isAcidDamageSnow())
|
||||
&& (!player.getLocation().getBlock().getType().equals(Material.SNOW)
|
||||
|| !addon.getSettings().isAcidDamageSnow())
|
||||
&& !player.getLocation().getBlock().getRelative(BlockFace.UP).getType().equals(Material.WATER)) {
|
||||
return true;
|
||||
}
|
||||
// Check if player is on a boat
|
||||
if (player.getVehicle() != null && player.getVehicle().getType().equals(EntityType.BOAT)) {
|
||||
if (player.getVehicle() != null && (player.getVehicle().getType().equals(EntityType.BOAT)
|
||||
|| player.getVehicle().getType().equals(EntityType.CHEST_BOAT))) {
|
||||
// I'M ON A BOAT! I'M ON A BOAT! A %^&&* BOAT! SNL Sketch. https://youtu.be/avaSdC0QOUM.
|
||||
return true;
|
||||
}
|
||||
// Check if full armor protects
|
||||
if (addon.getSettings().isFullArmorProtection()
|
||||
&& Arrays.stream(player.getInventory().getArmorContents()).allMatch(i -> i != null && !i.getType().equals(Material.AIR))) {
|
||||
if (addon.getSettings().isFullArmorProtection() && Arrays.stream(player.getInventory().getArmorContents())
|
||||
.allMatch(i -> i != null && !i.getType().equals(Material.AIR))) {
|
||||
return true;
|
||||
}
|
||||
// Check if player has an active water potion or not
|
||||
|
@ -270,7 +301,7 @@ public class AcidEffect implements Listener {
|
|||
*/
|
||||
private boolean isEssentialsGodMode(Player player) {
|
||||
if (!essentialsCheck && essentials == null) {
|
||||
essentials = (Essentials)Bukkit.getPluginManager().getPlugin("Essentials");
|
||||
essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
|
||||
essentialsCheck = true;
|
||||
}
|
||||
return essentials != null && essentials.getUser(player).isGodModeEnabled();
|
||||
|
@ -292,7 +323,7 @@ public class AcidEffect implements Listener {
|
|||
ItemStack chest = inv.getChestplate();
|
||||
ItemStack pants = inv.getLeggings();
|
||||
// Damage if helmet
|
||||
if (helmet != null&& helmet.getType().name().contains("HELMET") && damage(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);
|
||||
}
|
||||
|
@ -316,10 +347,9 @@ public class AcidEffect implements Listener {
|
|||
private static boolean damage(ItemStack item) {
|
||||
ItemMeta im = item.getItemMeta();
|
||||
|
||||
if (im instanceof Damageable) {
|
||||
Damageable d = (Damageable)im;
|
||||
if (im instanceof Damageable d && !im.isUnbreakable()) {
|
||||
d.setDamage(d.getDamage() + 1);
|
||||
item.setItemMeta((ItemMeta) d);
|
||||
item.setItemMeta(d);
|
||||
return d.getDamage() >= item.getType().getMaxDurability();
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package world.bentobox.acidisland.world;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
|
||||
import world.bentobox.acidisland.AcidIsland;
|
||||
|
||||
/**
|
||||
* Biome provider for AcidIsland
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class AcidBiomeProvider extends BiomeProvider {
|
||||
|
||||
private final AcidIsland addon;
|
||||
|
||||
/**
|
||||
* @param addon Addon
|
||||
*/
|
||||
public AcidBiomeProvider(AcidIsland addon) {
|
||||
this.addon = addon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(WorldInfo worldInfo, int x, int y, int z) {
|
||||
return switch(worldInfo.getEnvironment()) {
|
||||
case NETHER -> addon.getSettings().getDefaultNetherBiome();
|
||||
case THE_END -> addon.getSettings().getDefaultEndBiome();
|
||||
default -> addon.getSettings().getDefaultBiome();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Biome> getBiomes(WorldInfo worldInfo) {
|
||||
return List.of(this.getBiome(worldInfo, 0, 0, 0));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package world.bentobox.acidisland.world;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -20,12 +21,25 @@ import org.bukkit.entity.Monster;
|
|||
import org.bukkit.entity.WaterMob;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.google.common.base.Enums;
|
||||
|
||||
import world.bentobox.acidisland.AcidIsland;
|
||||
import world.bentobox.acidisland.events.EntityDamageByAcidEvent;
|
||||
import world.bentobox.acidisland.events.EntityDamageByAcidEvent.Acid;
|
||||
import world.bentobox.acidisland.events.ItemDestroyByAcidEvent;
|
||||
import world.bentobox.acidisland.listeners.AcidEffect;
|
||||
|
||||
public class AcidTask {
|
||||
private final AcidIsland addon;
|
||||
private static final List<EntityType> IMMUNE = Arrays.asList(EntityType.TURTLE, EntityType.POLAR_BEAR, EntityType.DROWNED);
|
||||
private static final List<EntityType> IMMUNE;
|
||||
static {
|
||||
List<EntityType> i = new ArrayList<>();
|
||||
i.add(EntityType.POLAR_BEAR);
|
||||
i.add(EntityType.TURTLE);
|
||||
i.add(EntityType.DROWNED);
|
||||
Enums.getIfPresent(EntityType.class, "AXOLOTL").toJavaUtil().ifPresent(i::add);
|
||||
IMMUNE = Collections.unmodifiableList(i);
|
||||
}
|
||||
private Map<Entity, Long> itemsInWater = new ConcurrentHashMap<>();
|
||||
private final BukkitTask findMobsTask;
|
||||
|
||||
|
@ -35,7 +49,7 @@ public class AcidTask {
|
|||
*/
|
||||
public AcidTask(AcidIsland addon) {
|
||||
this.addon = addon;
|
||||
findMobsTask = Bukkit.getScheduler().runTaskTimerAsynchronously(addon.getPlugin(), this::findEntities, 0L, 20L);
|
||||
findMobsTask = Bukkit.getScheduler().runTaskTimer(addon.getPlugin(), this::findEntities, 0L, 20L);
|
||||
}
|
||||
|
||||
void findEntities() {
|
||||
|
@ -71,8 +85,14 @@ public class AcidTask {
|
|||
|
||||
void applyDamage(Entity e, long damage) {
|
||||
if (e instanceof LivingEntity) {
|
||||
((LivingEntity)e).damage(Math.max(0, damage - damage * AcidEffect.getDamageReduced((LivingEntity)e)));
|
||||
} else if (addon.getSettings().getAcidDestroyItemTime() > 0){
|
||||
double actualDamage = Math.max(0, damage - damage * AcidEffect.getDamageReduced((LivingEntity)e));
|
||||
EntityDamageByAcidEvent event = new EntityDamageByAcidEvent(e, actualDamage, Acid.WATER);
|
||||
// Fire event
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
((LivingEntity)e).damage(actualDamage);
|
||||
}
|
||||
} else if (addon.getSettings().getAcidDestroyItemTime() > 0 && e instanceof Item){
|
||||
// Item
|
||||
if (e.getLocation().getBlock().getType().equals(Material.WATER)) {
|
||||
itemsInWater.putIfAbsent(e, damage + addon.getSettings().getAcidDestroyItemTime() * 1000);
|
||||
|
@ -80,6 +100,8 @@ public class AcidTask {
|
|||
e.getWorld().playSound(e.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 3F, 3F);
|
||||
e.remove();
|
||||
itemsInWater.remove(e);
|
||||
// Fire event
|
||||
Bukkit.getPluginManager().callEvent(new ItemDestroyByAcidEvent((Item)e));
|
||||
}
|
||||
} else {
|
||||
itemsInWater.remove(e);
|
||||
|
@ -94,10 +116,10 @@ public class AcidTask {
|
|||
List<Entity> entityStream = new ArrayList<>(addon.getOverWorld().getEntities());
|
||||
// Nether and end
|
||||
if (addon.getSettings().isNetherGenerate() && addon.getSettings().isNetherIslands()) {
|
||||
entityStream.addAll(addon.getNetherWorld().getEntities());
|
||||
entityStream.addAll(Objects.requireNonNull(addon.getNetherWorld()).getEntities());
|
||||
}
|
||||
if (addon.getSettings().isEndGenerate() && addon.getSettings().isEndIslands()) {
|
||||
entityStream.addAll(addon.getEndWorld().getEntities());
|
||||
entityStream.addAll(Objects.requireNonNull(addon.getEndWorld()).getEntities());
|
||||
}
|
||||
return entityStream;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,13 @@ import java.util.Random;
|
|||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.bukkit.util.noise.PerlinOctaveGenerator;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.acidisland.AcidIsland;
|
||||
|
||||
|
@ -25,10 +27,20 @@ import world.bentobox.acidisland.AcidIsland;
|
|||
*/
|
||||
public class ChunkGeneratorWorld extends ChunkGenerator {
|
||||
|
||||
private record FloorMats(Material base, Material top) {
|
||||
}
|
||||
|
||||
private final AcidIsland addon;
|
||||
private final Random rand = new Random();
|
||||
private final Map<Environment, Integer> seaHeight = new EnumMap<>(Environment.class);
|
||||
private final Map<Environment, WorldConfig> seaHeight = new EnumMap<>(Environment.class);
|
||||
private final Map<Vector, Material> roofChunk = new HashMap<>();
|
||||
private static final Map<Environment, FloorMats> floorMats = Map.of(Environment.NETHER,
|
||||
new FloorMats(Material.NETHERRACK, Material.SOUL_SAND), Environment.NORMAL,
|
||||
new FloorMats(Material.SANDSTONE, Material.SAND), Environment.THE_END,
|
||||
new FloorMats(Material.END_STONE, Material.END_STONE));
|
||||
private PerlinOctaveGenerator gen;
|
||||
|
||||
private record WorldConfig(int seaHeight, Material waterBlock) {}
|
||||
|
||||
/**
|
||||
* @param addon - addon
|
||||
|
@ -36,40 +48,74 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
|||
public ChunkGeneratorWorld(AcidIsland addon) {
|
||||
super();
|
||||
this.addon = addon;
|
||||
seaHeight.put(Environment.NORMAL, addon.getSettings().getSeaHeight());
|
||||
seaHeight.put(Environment.NETHER, addon.getSettings().getNetherSeaHeight());
|
||||
seaHeight.put(Environment.THE_END, addon.getSettings().getEndSeaHeight());
|
||||
seaHeight.put(Environment.NORMAL, new WorldConfig(addon.getSettings().getSeaHeight(), addon.getSettings().getWaterBlock()));
|
||||
seaHeight.put(Environment.NETHER, new WorldConfig(addon.getSettings().getNetherSeaHeight(), addon.getSettings().getNetherWaterBlock()));
|
||||
seaHeight.put(Environment.THE_END, new WorldConfig(addon.getSettings().getEndSeaHeight(), addon.getSettings().getEndWaterBlock()));
|
||||
rand.setSeed(System.currentTimeMillis());
|
||||
gen = new PerlinOctaveGenerator((long) (rand.nextLong() * rand.nextGaussian()), 8);
|
||||
gen.setScale(1.0/30.0);
|
||||
makeNetherRoof();
|
||||
}
|
||||
|
||||
public ChunkData generateChunks(World world) {
|
||||
ChunkData result = createChunkData(world);
|
||||
int sh = seaHeight.getOrDefault(world.getEnvironment(), 0);
|
||||
if (sh > 0) {
|
||||
result.setRegion(0, 0, 0, 16, sh + 1, 16, Material.WATER);
|
||||
@Override
|
||||
public void generateNoise(@NonNull WorldInfo worldInfo, @NonNull Random random, int chunkX, int chunkZ, @NonNull ChunkData chunkData) {
|
||||
WorldConfig wc = seaHeight.get(worldInfo.getEnvironment());
|
||||
int sh = wc.seaHeight();
|
||||
if (sh > worldInfo.getMinHeight()) {
|
||||
chunkData.setRegion(0, worldInfo.getMinHeight() + 1, 0, 16, sh + 1, 16, wc.waterBlock());
|
||||
// Add some noise
|
||||
if (addon.getSettings().isOceanFloor()) {
|
||||
chunkData.setRegion(0, worldInfo.getMinHeight(), 0, 16, worldInfo.getMinHeight() + 1, 16, Material.BEDROCK);
|
||||
addNoise(worldInfo, chunkX, chunkZ, chunkData);
|
||||
}
|
||||
}
|
||||
if (world.getEnvironment().equals(Environment.NETHER) && addon.getSettings().isNetherRoof()) {
|
||||
roofChunk.forEach((k,v) -> result.setBlock(k.getBlockX(), world.getMaxHeight() + k.getBlockY(), k.getBlockZ(), v));
|
||||
if (worldInfo.getEnvironment().equals(Environment.NETHER) && addon.getSettings().isNetherRoof()) {
|
||||
roofChunk.forEach((k,v) -> chunkData.setBlock(k.getBlockX(), worldInfo.getMaxHeight() + k.getBlockY(), k.getBlockZ(), v));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addNoise(@NonNull WorldInfo worldInfo, int chunkX, int chunkZ, @NonNull ChunkData chunkData) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int n = (int)(25 * gen.noise((chunkX << 4) + (double)x, (chunkZ << 4) + (double)z, 0.5, 0.5, true));
|
||||
for (int y = worldInfo.getMinHeight(); y < 25 + n; y++) {
|
||||
chunkData.setBlock(x, y, z, rand.nextBoolean() ? floorMats.get(worldInfo.getEnvironment()).top()
|
||||
: floorMats.get(worldInfo.getEnvironment()).base());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Make an solid base so sand doesn't fall into the void
|
||||
chunkData.setRegion(0, worldInfo.getMinHeight(), 0, 16, worldInfo.getMinHeight() + 1 , 16, Material.BEDROCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomeGrid) {
|
||||
setBiome(world, biomeGrid);
|
||||
return generateChunks(world);
|
||||
public boolean shouldGenerateNoise() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldGenerateSurface() {
|
||||
return addon.getSettings().isOceanFloor();
|
||||
}
|
||||
@Override
|
||||
public boolean shouldGenerateCaves() {
|
||||
return addon.getSettings().isMakeCaves();
|
||||
}
|
||||
@Override
|
||||
public boolean shouldGenerateDecorations() {
|
||||
return addon.getSettings().isMakeDecorations();
|
||||
}
|
||||
@Override
|
||||
public boolean shouldGenerateMobs() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldGenerateStructures() {
|
||||
return addon.getSettings().isMakeStructures();
|
||||
}
|
||||
|
||||
private void setBiome(World world, BiomeGrid biomeGrid) {
|
||||
Biome biome = world.getEnvironment() == Environment.NORMAL ? addon.getSettings().getDefaultBiome() :
|
||||
world.getEnvironment() == Environment.NETHER ? addon.getSettings().getDefaultNetherBiome() : addon.getSettings().getDefaultEndBiome();
|
||||
for (int x = 0; x < 16; x+=4) {
|
||||
for (int z = 0; z < 16; z+=4) {
|
||||
for (int y = 0; y < world.getMaxHeight(); y+=4) {
|
||||
biomeGrid.setBiome(x, y, z, biome);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public BiomeProvider getDefaultBiomeProvider(WorldInfo worldInfo) {
|
||||
return addon.getBiomeProvider();
|
||||
}
|
||||
|
||||
// This needs to be set to return true to override minecraft's default
|
||||
|
@ -88,8 +134,6 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
|||
* Nether Section
|
||||
*/
|
||||
private void makeNetherRoof() {
|
||||
rand.setSeed(System.currentTimeMillis());
|
||||
PerlinOctaveGenerator gen = new PerlinOctaveGenerator((long) (rand.nextLong() * rand.nextGaussian()), 8);
|
||||
|
||||
// Make the roof - common across the world
|
||||
for (int x = 0; x < 16; x++) {
|
||||
|
@ -158,4 +202,5 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
|||
private void setBlock(int x, int y, int z, Material m) {
|
||||
roofChunk.put(new Vector(x, y, z), m);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: AcidIsland
|
||||
main: world.bentobox.acidisland.AcidIsland
|
||||
version: ${version}${build.number}
|
||||
api-version: 1.14
|
||||
api-version: 1.22.1
|
||||
metrics: true
|
||||
repository: "BentoBoxWorld/AcidIsland"
|
||||
icon: "OAK_BOAT"
|
||||
|
@ -9,147 +9,332 @@ icon: "OAK_BOAT"
|
|||
authors: tastybento
|
||||
|
||||
permissions:
|
||||
acidisland.admin.clearresetall:
|
||||
default: op
|
||||
description: "Allow clearing of island reset limit of all players"
|
||||
acidisland.admin.delete:
|
||||
default: op
|
||||
description: "Let a player completely remove a player (including island)"
|
||||
acidisland.admin.noban:
|
||||
default: op
|
||||
description: "Player cannot be banned from an island"
|
||||
acidisland.admin.noexpel:
|
||||
default: op
|
||||
description: "Player cannot be expelled from an island"
|
||||
acidisland.admin.register:
|
||||
default: op
|
||||
description: "Let a player register the nearest island to another player."
|
||||
acidisland.admin.reload:
|
||||
default: op
|
||||
description: "Reload the config.yml"
|
||||
acidisland.admin.setlanguage:
|
||||
default: op
|
||||
description: "Resets all player languages and sets the default language"
|
||||
acidisland.admin.setrange:
|
||||
default: op
|
||||
description: "Allows setting of island protection range"
|
||||
acidisland.admin.setspawn:
|
||||
default: op
|
||||
description: "Allows use of spawn tools"
|
||||
acidisland.admin.settingsreset:
|
||||
default: op
|
||||
description: "Resets all the islands to default protection settings"
|
||||
acidisland.admin.tp:
|
||||
default: op
|
||||
description: "Allows teleport to an island"
|
||||
acidisland.admin.unregister:
|
||||
default: op
|
||||
description: "Removes a player from an island without deleting the island blocks."
|
||||
acidisland.island:
|
||||
# Non-command permissions
|
||||
acidisland.island.lock:
|
||||
description: Allows island locking in settings
|
||||
default: true
|
||||
description: "Allow island command usage"
|
||||
acidisland.island.ban:
|
||||
acidisland.settings.*:
|
||||
description: Allow use of settings on island
|
||||
default: true
|
||||
description: "Allows banning of visitors"
|
||||
acidisland.island.create:
|
||||
default: true
|
||||
description: "Allow island creation"
|
||||
acidisland.island.expel:
|
||||
default: true
|
||||
description: "Allows expelling of visitors"
|
||||
acidisland.island.home:
|
||||
default: true
|
||||
description: "Allow teleporting to player island"
|
||||
acidisland.island.info:
|
||||
default: true
|
||||
description: "Let the player check other players info"
|
||||
acidisland.island.language:
|
||||
default: true
|
||||
description: "Player can select a language"
|
||||
acidisland.island.lock:
|
||||
default: true
|
||||
description: "Allows island locking"
|
||||
acidisland.island.name:
|
||||
default: true
|
||||
description: "Player can set the name of their island"
|
||||
acidisland.island.near:
|
||||
default: true
|
||||
description: "Players can see nearby island names"
|
||||
acidisland.island.reset:
|
||||
default: true
|
||||
description: "Player can use the island reset or restart command"
|
||||
acidisland.island.sethome:
|
||||
default: true
|
||||
description: "Let the player use the sethome command"
|
||||
acidisland.island.settings:
|
||||
default: true
|
||||
description: "Player can see server settings"
|
||||
acidisland.island.spawn:
|
||||
default: true
|
||||
description: "Player can use the island spawn command if spawn exists"
|
||||
acidisland.island.team:
|
||||
default: true
|
||||
description: "Let a player use team command"
|
||||
acidisland.island.team.accept:
|
||||
default: true
|
||||
description: "Let a player accept invitations"
|
||||
acidisland.island.team.coop:
|
||||
default: true
|
||||
description: "Let a player use team coop commands"
|
||||
acidisland.island.team.invite:
|
||||
default: true
|
||||
description: "Let a player invite others"
|
||||
acidisland.island.team.kick:
|
||||
default: true
|
||||
description: "Let a player kick team members"
|
||||
acidisland.island.team.leave:
|
||||
default: true
|
||||
description: "Let a player leave the team"
|
||||
acidisland.island.team.promote:
|
||||
default: true
|
||||
description: "Let a player use promote commands"
|
||||
acidisland.island.team.reject:
|
||||
default: true
|
||||
description: "Let a player reject invites"
|
||||
acidisland.island.team.setowner:
|
||||
default: true
|
||||
description: "Let a player change the team owner"
|
||||
acidisland.island.team.trust:
|
||||
default: true
|
||||
description: "Let a player use team trust commands"
|
||||
acidisland.mod.bypassban:
|
||||
default: op
|
||||
description: "Bypasses island ban"
|
||||
acidisland.mod.bypasscooldowns:
|
||||
default: op
|
||||
description: "Allow moderator to bypass cooldowns"
|
||||
acidisland.mod.bypassdelays:
|
||||
default: op
|
||||
description: "Allow moderator to bypass delays"
|
||||
acidisland.mod.bypassexpel:
|
||||
default: op
|
||||
description: "Allow moderator to bypass island expulsion"
|
||||
acidisland.mod.bypasslock:
|
||||
default: op
|
||||
description: "Bypasses an island lock"
|
||||
acidisland.mod.bypassprotect:
|
||||
default: op
|
||||
description: "Allow moderator to bypass island protection"
|
||||
acidisland.mod.clearreset:
|
||||
acidisland.mod.clearreset:
|
||||
description: Allow clearing of island reset limit
|
||||
default: false
|
||||
description: "Allow clearing of island reset limit"
|
||||
acidisland.mod.info:
|
||||
acidisland.mod.bypasscooldowns:
|
||||
description: Allow moderator to bypass cooldowns
|
||||
default: op
|
||||
description: "Let a moderator see info on a player"
|
||||
acidisland.mod.lock:
|
||||
acidisland.mod.bypassdelays:
|
||||
description: Allow moderator to bypass delays
|
||||
default: op
|
||||
acidisland.mod.bypassprotect:
|
||||
description: Allow moderator to bypass island protection
|
||||
default: op
|
||||
acidisland.mod.bypassexpel:
|
||||
description: Allow moderator to bypass island expulsion
|
||||
default: op
|
||||
acidisland.mod.lock:
|
||||
description: Allows lock or unlock of an island
|
||||
default: op
|
||||
acidisland.mod.bypasslock:
|
||||
description: Bypasses an island lock
|
||||
default: op
|
||||
acidisland.mod.bypassban:
|
||||
description: Bypasses island ban
|
||||
default: op
|
||||
description: "Locks or unlocks an island"
|
||||
acidisland.mod.noburn:
|
||||
default: op
|
||||
description: "Give mod acid protection"
|
||||
acidisland.mod.team:
|
||||
default: false
|
||||
description: "Enables modification of teams via kick and add commands"
|
||||
acidisland.settings.*:
|
||||
default: true
|
||||
description: "Allow use of settings on island"
|
||||
acidisland.admin.noban:
|
||||
description: Player cannot be banned from an island
|
||||
default: op
|
||||
acidisland.admin.noexpel:
|
||||
description: Player cannot be expelled from an island
|
||||
default: op
|
||||
# Command permissions
|
||||
acidisland.island:
|
||||
description: Allow use of '/ai' command - the main island command
|
||||
default: TRUE
|
||||
acidisland.island.home:
|
||||
description: Allow use of '/ai go' command - teleport you to your island
|
||||
default: TRUE
|
||||
acidisland.island.spawn:
|
||||
description: Allow use of '/ai spawn' command - teleport you to the spawn
|
||||
default: TRUE
|
||||
acidisland.island.create:
|
||||
description: Allow use of '/ai create' command - create an island, using optional blueprint (requires permission)
|
||||
default: TRUE
|
||||
acidisland.island.reset:
|
||||
description: Allow use of '/ai reset' command - restart your island and remove the old one
|
||||
default: TRUE
|
||||
acidisland.island.info:
|
||||
description: Allow use of '/ai info' command - display info about your island or the player's island
|
||||
default: TRUE
|
||||
acidisland.island.settings:
|
||||
description: Allow use of '/ai settings' command - display island settings
|
||||
default: TRUE
|
||||
acidisland.island.name:
|
||||
description: Allow use of '/ai setname' command - set a name for your island
|
||||
default: TRUE
|
||||
acidisland.island.name:
|
||||
description: Allow use of '/ai resetname' command - reset your island name
|
||||
default: TRUE
|
||||
acidisland.island.language:
|
||||
description: Allow use of '/ai language' command - select language
|
||||
default: TRUE
|
||||
acidisland.island.ban:
|
||||
description: Allow use of '/ai ban' command - ban a player from your island
|
||||
default: TRUE
|
||||
acidisland.island.ban:
|
||||
description: Allow use of '/ai unban' command - unban a player from your island
|
||||
default: TRUE
|
||||
acidisland.island.ban:
|
||||
description: Allow use of '/ai banlist' command - list banned players
|
||||
default: TRUE
|
||||
acidisland.island.expel:
|
||||
description: Allow use of '/ai expel' command - expel a player from your island
|
||||
default: TRUE
|
||||
acidisland.island.near:
|
||||
description: Allow use of '/ai near' command - show the name of neighboring islands around you
|
||||
default: TRUE
|
||||
acidisland.island.team:
|
||||
description: Allow use of '/ai team' command - manage your team
|
||||
default: TRUE
|
||||
acidisland.island.team.invite:
|
||||
description: Allow use of '/ai team invite' command - invite a player to join your island
|
||||
default: TRUE
|
||||
acidisland.island.team.leave:
|
||||
description: Allow use of '/ai team leave' command - leave your island
|
||||
default: TRUE
|
||||
acidisland.island.team.setowner:
|
||||
description: Allow use of '/ai team setowner' command - transfer your island ownership to a member
|
||||
default: TRUE
|
||||
acidisland.island.team.kick:
|
||||
description: Allow use of '/ai team kick' command - remove a member from your island
|
||||
default: TRUE
|
||||
acidisland.island.team.accept:
|
||||
description: Allow use of '/ai team accept' command - accept an invitation
|
||||
default: TRUE
|
||||
acidisland.island.team.reject:
|
||||
description: Allow use of '/ai team reject' command - reject an invitation
|
||||
default: TRUE
|
||||
acidisland.island.team.coop:
|
||||
description: Allow use of '/ai team coop' command - make a player coop rank on your island
|
||||
default: TRUE
|
||||
acidisland.island.team.coop:
|
||||
description: Allow use of '/ai team uncoop' command - remove a coop rank from player
|
||||
default: TRUE
|
||||
acidisland.island.team.trust:
|
||||
description: Allow use of '/ai team trust' command - give a player trusted rank on your island
|
||||
default: TRUE
|
||||
acidisland.island.team.trust:
|
||||
description: Allow use of '/ai team untrust' command - remove trusted player rank from player
|
||||
default: TRUE
|
||||
acidisland.island.team.promote:
|
||||
description: Allow use of '/ai team promote' command - promote a player on your island up a rank
|
||||
default: TRUE
|
||||
acidisland.island.team.promote:
|
||||
description: Allow use of '/ai team demote' command - demote a player on your island down a rank
|
||||
default: TRUE
|
||||
acidisland.island.sethome:
|
||||
description: Allow use of '/ai sethome' command - set your home teleport point
|
||||
default: TRUE
|
||||
acidisland.island.deletehome:
|
||||
description: Allow use of '/ai deletehome' command - delete a home location
|
||||
default: OP
|
||||
acidisland.island.renamehome:
|
||||
description: Allow use of '/ai renamehome' command - rename a home location
|
||||
default: OP
|
||||
acidisland.island.homes:
|
||||
description: Allow use of '/ai homes' command - list your homes
|
||||
default: OP
|
||||
acidisland.admin:
|
||||
description: Allow use of '/acid' command - admin command
|
||||
default: OP
|
||||
acidisland.admin.version:
|
||||
description: Allow use of '/acid version' command - display BentoBox and addons versions
|
||||
default: OP
|
||||
acidisland.admin.tp:
|
||||
description: Allow use of '/acid tp' command - teleport to a player's island
|
||||
default: OP
|
||||
acidisland.admin.tp:
|
||||
description: Allow use of '/acid tpnether' command - teleport to a player's island
|
||||
default: OP
|
||||
acidisland.admin.tp:
|
||||
description: Allow use of '/acid tpend' command - teleport to a player's island
|
||||
default: OP
|
||||
acidisland.admin.getrank:
|
||||
description: Allow use of '/acid getrank' command - get a player's rank on their island or the island of the owner
|
||||
default: OP
|
||||
acidisland.admin.setrank:
|
||||
description: Allow use of '/acid setrank' command - set a player's rank on their island or the island of the owner
|
||||
default: OP
|
||||
acidisland.mod.info:
|
||||
description: Allow use of '/acid info' command - get info on where you are or player's island
|
||||
default: OP
|
||||
acidisland.mod.team:
|
||||
description: Allow use of '/acid team' command - manage teams
|
||||
default: FALSE
|
||||
acidisland.mod.team.add:
|
||||
description: Allow use of '/acid team add' command - add player to owner's team
|
||||
default: OP
|
||||
acidisland.mod.team.disband:
|
||||
description: Allow use of '/acid team disband' command - disband owner's team
|
||||
default: OP
|
||||
acidisland.mod.team.fix:
|
||||
description: Allow use of '/acid team fix' command - scans and fixes cross island membership in database
|
||||
default: OP
|
||||
acidisland.mod.team.kick:
|
||||
description: Allow use of '/acid team kick' command - kick a player from a team
|
||||
default: OP
|
||||
acidisland.mod.team.setowner:
|
||||
description: Allow use of '/acid team setowner' command - transfers island ownership to the player
|
||||
default: OP
|
||||
acidisland.mod.team.add:
|
||||
description: Allow use of '/acid add' command - add player to owner's team
|
||||
default: OP
|
||||
acidisland.mod.team.kick:
|
||||
description: Allow use of '/acid kick' command - kick a player from a team
|
||||
default: OP
|
||||
acidisland.mod.team.disband:
|
||||
description: Allow use of '/acid disband' command - disband owner's team
|
||||
default: OP
|
||||
acidisland.mod.team.setowner:
|
||||
description: Allow use of '/acid setowner' command - transfers island ownership to the player
|
||||
default: OP
|
||||
acidisland.mod.team.fix:
|
||||
description: Allow use of '/acid fix' command - scans and fixes cross island membership in database
|
||||
default: OP
|
||||
acidisland.admin.blueprint:
|
||||
description: Allow use of '/acid blueprint' command - manipulate blueprints
|
||||
default: OP
|
||||
acidisland.admin.blueprint.load:
|
||||
description: Allow use of '/acid blueprint load' command - load blueprint into the clipboard
|
||||
default: OP
|
||||
acidisland.admin.blueprint.paste:
|
||||
description: Allow use of '/acid blueprint paste' command - paste the clipboard to your location
|
||||
default: OP
|
||||
acidisland.admin.blueprint.origin:
|
||||
description: Allow use of '/acid blueprint origin' command - set the blueprint's origin to your position
|
||||
default: OP
|
||||
acidisland.admin.blueprint.copy:
|
||||
description: Allow use of '/acid blueprint copy' command - copy the clipboard set by pos1 and pos2 and optionally the air blocks
|
||||
default: OP
|
||||
acidisland.admin.blueprint.save:
|
||||
description: Allow use of '/acid blueprint save' command - save the copied clipboard
|
||||
default: OP
|
||||
acidisland.admin.blueprint.rename:
|
||||
description: Allow use of '/acid blueprint rename' command - rename a blueprint
|
||||
default: OP
|
||||
acidisland.admin.blueprint.delete:
|
||||
description: Allow use of '/acid blueprint delete' command - delete the blueprint
|
||||
default: OP
|
||||
acidisland.admin.blueprint.pos1:
|
||||
description: Allow use of '/acid blueprint pos1' command - set 1st corner of cuboid clipboard
|
||||
default: OP
|
||||
acidisland.admin.blueprint.pos2:
|
||||
description: Allow use of '/acid blueprint pos2' command - set 2nd corner of cuboid clipboard
|
||||
default: OP
|
||||
acidisland.admin.blueprint.list:
|
||||
description: Allow use of '/acid blueprint list' command - list available blueprints
|
||||
default: OP
|
||||
acidisland.admin.register:
|
||||
description: Allow use of '/acid register' command - register player to unowned island you are on
|
||||
default: OP
|
||||
acidisland.admin.unregister:
|
||||
description: Allow use of '/acid unregister' command - unregister owner from island, but keep island blocks
|
||||
default: OP
|
||||
acidisland.admin.range:
|
||||
description: Allow use of '/acid range' command - admin island range command
|
||||
default: OP
|
||||
acidisland.admin.range.display:
|
||||
description: Allow use of '/acid range display' command - show/hide island range indicators
|
||||
default: OP
|
||||
acidisland.admin.range.set:
|
||||
description: Allow use of '/acid range set' command - sets the island protected range
|
||||
default: OP
|
||||
acidisland.admin.range.reset:
|
||||
description: Allow use of '/acid range reset' command - resets the island protected range to the world default
|
||||
default: OP
|
||||
acidisland.admin.range.add:
|
||||
description: Allow use of '/acid range add' command - increases the island protected range
|
||||
default: OP
|
||||
acidisland.admin.range.remove:
|
||||
description: Allow use of '/acid range remove' command - decreases the island protected range
|
||||
default: OP
|
||||
acidisland.admin.resets:
|
||||
description: Allow use of '/acid resets' command - edit player reset values
|
||||
default: OP
|
||||
acidisland.admin.resets.set:
|
||||
description: Allow use of '/acid resets set' command - sets how many times this player has reset his island
|
||||
default: OP
|
||||
acidisland.admin.resets.remove:
|
||||
description: Allow use of '/acid resets reset' command - sets the player's island reset count to 0
|
||||
default: OP
|
||||
acidisland.admin.resets.add:
|
||||
description: Allow use of '/acid resets add' command - adds this player's island reset count
|
||||
default: OP
|
||||
acidisland.admin.resets.remove:
|
||||
description: Allow use of '/acid resets remove' command - reduces the player's island reset count
|
||||
default: OP
|
||||
acidisland.admin.delete:
|
||||
description: Allow use of '/acid delete' command - deletes a player's island
|
||||
default: OP
|
||||
acidisland.admin.why:
|
||||
description: Allow use of '/acid why' command - toggle console protection debug reporting
|
||||
default: OP
|
||||
acidisland.admin.deaths:
|
||||
description: Allow use of '/acid deaths' command - edit deaths of players
|
||||
default: OP
|
||||
acidisland.admin.deaths.reset:
|
||||
description: Allow use of '/acid deaths reset' command - resets deaths of the player
|
||||
default: OP
|
||||
acidisland.admin.deaths.set:
|
||||
description: Allow use of '/acid deaths set' command - sets deaths of the player
|
||||
default: OP
|
||||
acidisland.admin.deaths.add:
|
||||
description: Allow use of '/acid deaths add' command - adds deaths to the player
|
||||
default: OP
|
||||
acidisland.admin.deaths.remove:
|
||||
description: Allow use of '/acid deaths remove' command - removes deaths to the player
|
||||
default: OP
|
||||
acidisland.admin.reload:
|
||||
description: Allow use of '/acid reload' command - reload
|
||||
default: OP
|
||||
acidisland.admin.setspawn:
|
||||
description: Allow use of '/acid setspawn' command - set an island as spawn for this gamemode
|
||||
default: OP
|
||||
acidisland.admin.setspawnpoint:
|
||||
description: Allow use of '/acid setspawnpoint' command - set current location as spawn point for this island
|
||||
default: OP
|
||||
acidisland.admin.resetflags:
|
||||
description: Allow use of '/acid resetflags' command - Reset all islands to default flag settings in config.yml
|
||||
default: OP
|
||||
acidisland.mod.switch:
|
||||
description: Allow use of '/acid switch' command - switch on/off protection bypass
|
||||
default: OP
|
||||
acidisland.admin.purge:
|
||||
description: Allow use of '/acid purge' command - purge islands abandoned for more than [days]
|
||||
default: OP
|
||||
acidisland.admin.purge.status:
|
||||
description: Allow use of '/acid purge status' command - displays the status of the purge
|
||||
default: OP
|
||||
acidisland.admin.purge.stop:
|
||||
description: Allow use of '/acid purge stop' command - stop a purge in progress
|
||||
default: OP
|
||||
acidisland.admin.purge.unowned:
|
||||
description: Allow use of '/acid purge unowned' command - purge unowned islands
|
||||
default: OP
|
||||
acidisland.admin.purge.protect:
|
||||
description: Allow use of '/acid purge protect' command - toggle island purge protection
|
||||
default: OP
|
||||
acidisland.admin.settings:
|
||||
description: Allow use of '/acid settings' command - open settings GUI or set settings
|
||||
default: OP
|
||||
acidisland.admin.setprotectionlocation:
|
||||
description: Allow use of '/acid setprotectionlocation' command - set current location or [x y z] as center of island's protection area
|
||||
default: OP
|
||||
acidisland.mod.deletehomes:
|
||||
description: Allow use of '/acid deletehomes' command - deletes all named homes from an island
|
||||
default: OP
|
||||
acidisland.mod.resetname:
|
||||
description: Allow use of '/acid resetname' command - reset player island name
|
||||
default: OP
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -106,7 +106,7 @@ world:
|
|||
# It is the same for every dimension : Overworld, Nether and End.
|
||||
# This value cannot be changed mid-game and the plugin will not start if it is different.
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
distance-between-islands: 64
|
||||
distance-between-islands: 400
|
||||
# Default protection range radius in blocks. Cannot be larger than distance.
|
||||
# Admins can change protection sizes for players individually using /acid range set <player> <new range>
|
||||
# or set this permission: acidisland.island.range.<number>
|
||||
|
@ -124,14 +124,33 @@ world:
|
|||
offset-z: 0
|
||||
# Island height - Lowest is 5.
|
||||
# It is the y coordinate of the bedrock block in the schem.
|
||||
island-height: 50
|
||||
island-height: 60
|
||||
# Use your own world generator for this world.
|
||||
# In this case, the plugin will not generate anything.
|
||||
# /!\ This feature is experimental and might not work as expected or might not work at all.
|
||||
use-own-generator: false
|
||||
# Sea height (don't changes this mid-game unless you delete the world)
|
||||
# Minimum is 0, which means you are playing Skyblock!
|
||||
sea-height: 54
|
||||
sea-height: 64
|
||||
# Water block. This should usually stay as WATER, but may be LAVA for fun
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
water-block: WATER
|
||||
# Ocean Floor
|
||||
# This creates an ocean floor environment, with vanilla elements.
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
ocean-floor: true
|
||||
# Structures
|
||||
# This creates an vanilla structures in the worlds.
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
make-structures: false
|
||||
# Caves
|
||||
# This creates an vanilla caves in the worlds.
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
make-caves: false
|
||||
# Decorations
|
||||
# This creates an vanilla decorations in the worlds.
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
make-decorations: true
|
||||
# Maximum number of islands in the world. Set to -1 or 0 for unlimited.
|
||||
# If the number of islands is greater than this number, no new island will be created.
|
||||
max-islands: 0
|
||||
|
@ -162,6 +181,9 @@ world:
|
|||
# Changing mid-game will cause problems!
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
sea-height: 54
|
||||
# Water block. This should usually stay as WATER, but may be LAVA for fun
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
water-block: WATER
|
||||
# Make the nether roof, if false, there is nothing up there
|
||||
# Change to false if lag is a problem from the generation
|
||||
# Only applies to islands Nether
|
||||
|
@ -171,6 +193,11 @@ world:
|
|||
# Minimum is 0 (not recommended), maximum is 100. Default is 25.
|
||||
# Only applies to vanilla nether
|
||||
spawn-radius: 25
|
||||
# This option indicates if nether portals should be linked via dimensions.
|
||||
# Option will simulate vanilla portal mechanics that links portals together
|
||||
# or creates a new portal, if there is not a portal in that dimension.
|
||||
# Added since 1.14.6.
|
||||
create-and-link-portals: false
|
||||
end:
|
||||
# End Nether - if this is false, the end world will not be made and access to
|
||||
# the end will not occur. Other plugins may still enable portal usage.
|
||||
|
@ -182,6 +209,13 @@ world:
|
|||
# Changing mid-game will cause problems!
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
sea-height: 54
|
||||
# Water block. This should usually stay as WATER, but may be LAVA for fun
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
water-block: WATER
|
||||
# This option indicates if obsidian platform in the end should be generated
|
||||
# when player enters the end world.
|
||||
# Added since 1.14.6.
|
||||
create-obsidian-platform: false
|
||||
# /!\ This feature is experimental and might not work as expected or might not work at all.
|
||||
dragon-spawn: false
|
||||
# Removing mobs - this kills all monsters in the vicinity. Benefit is that it helps
|
||||
|
@ -191,8 +225,8 @@ world:
|
|||
remove-mobs-whitelist:
|
||||
- ZOMBIE_VILLAGER
|
||||
- WITHER
|
||||
- ENDERMAN
|
||||
- ZOMBIFIED_PIGLIN
|
||||
- ENDERMAN
|
||||
# World flags. These are boolean settings for various flags for this world
|
||||
flags:
|
||||
CREEPER_DAMAGE: true
|
||||
|
@ -207,17 +241,21 @@ world:
|
|||
NATURAL_SPAWNING_OUTSIDE_RANGE: true
|
||||
ENTER_EXIT_MESSAGES: true
|
||||
ENDERMAN_DEATH_DROP: true
|
||||
LIQUIDS_FLOWING_OUT: false
|
||||
OFFLINE_REDSTONE: true
|
||||
REMOVE_END_EXIT_ISLAND: true
|
||||
OFFLINE_GROWTH: true
|
||||
REMOVE_MOBS: true
|
||||
ENDER_CHEST: false
|
||||
ITEM_FRAME_DAMAGE: false
|
||||
TREES_GROWING_OUTSIDE_RANGE: false
|
||||
BOAT: true
|
||||
# These are the default protection settings for new islands.
|
||||
# The value is the minimum island rank required allowed to do the action
|
||||
# Ranks are: Visitor = 0, Member = 900, Owner = 1000
|
||||
default-island-flags:
|
||||
HURT_ANIMALS: 500
|
||||
LOOM: 500
|
||||
DRAGON_EGG: 500
|
||||
REDSTONE: 500
|
||||
BUCKET: 500
|
||||
|
@ -229,9 +267,12 @@ world:
|
|||
ANVIL: 500
|
||||
MINECART: 500
|
||||
FISH_SCOOPING: 500
|
||||
TRAPPED_CHEST: 500
|
||||
END_PORTAL: 500
|
||||
BREEDING: 500
|
||||
HURT_VILLAGERS: 500
|
||||
BOOKSHELF: 500
|
||||
HARVEST: 500
|
||||
TURTLE_EGGS: 500
|
||||
FROST_WALKER: 500
|
||||
COLLECT_LAVA: 500
|
||||
|
@ -243,38 +284,53 @@ world:
|
|||
RIDING: 500
|
||||
NAME_TAG: 500
|
||||
ARMOR_STAND: 500
|
||||
CHANGE_SETTINGS: 1000
|
||||
SIGN_EDITING: 500
|
||||
TRADING: 0
|
||||
EGGS: 500
|
||||
ITEM_DROP: 0
|
||||
CHEST: 500
|
||||
NOTE_BLOCK: 0
|
||||
FLINT_AND_STEEL: 500
|
||||
NETHER_PORTAL: 500
|
||||
SCULK_SENSOR: 500
|
||||
LECTERN: 500
|
||||
SHULKER_BOX: 500
|
||||
GRINDSTONE: 500
|
||||
ITEM_PICKUP: 0
|
||||
CROP_TRAMPLE: 500
|
||||
DROPPER: 500
|
||||
BREWING: 500
|
||||
TNT_PRIMING: 500
|
||||
COLLECT_WATER: 500
|
||||
AXOLOTL_SCOOPING: 500
|
||||
BUTTON: 500
|
||||
COMPOSTER: 500
|
||||
STONECUTTING: 500
|
||||
FIRE_EXTINGUISH: 500
|
||||
COMMAND_RANKS: 500
|
||||
BEACON: 500
|
||||
ALLAY: 500
|
||||
TRAPDOOR: 500
|
||||
PRESSURE_PLATE: 0
|
||||
EXPERIENCE_BOTTLE_THROWING: 500
|
||||
DYE: 500
|
||||
HIVE: 500
|
||||
ITEM_FRAME: 500
|
||||
PLACE_BLOCKS: 500
|
||||
CROP_PLANTING: 500
|
||||
CRAFTING: 0
|
||||
SHEARING: 500
|
||||
ENCHANTING: 0
|
||||
FLOWER_POT: 500
|
||||
BOAT: 500
|
||||
BED: 500
|
||||
SPAWN_EGGS: 500
|
||||
MILKING: 0
|
||||
DISPENSER: 500
|
||||
SCULK_SHRIEKER: 500
|
||||
GATE: 0
|
||||
SMITHING: 500
|
||||
EXPERIENCE_PICKUP: 500
|
||||
HOPPER: 500
|
||||
LEASH: 500
|
||||
|
@ -284,20 +340,26 @@ world:
|
|||
CONTAINER: 500
|
||||
JUKEBOX: 500
|
||||
POTION_THROWING: 500
|
||||
BARREL: 500
|
||||
COLLECT_POWDERED_SNOW: 500
|
||||
CARTOGRAPHY: 500
|
||||
# These are the default settings for new islands
|
||||
default-island-settings:
|
||||
PVP_END: false
|
||||
PVP_NETHER: false
|
||||
LEAF_DECAY: true
|
||||
MONSTER_SPAWNERS_SPAWN: true
|
||||
TNT_DAMAGE: true
|
||||
ENDERMAN_TELEPORT: true
|
||||
ANIMAL_NATURAL_SPAWN: true
|
||||
MONSTER_NATURAL_SPAWN: true
|
||||
FIRE_IGNITE: true
|
||||
SHULKER_TELEPORT: true
|
||||
FIRE_SPREAD: true
|
||||
FIRE_BURNING: true
|
||||
ANIMAL_SPAWNERS_SPAWN: true
|
||||
PVP_OVERWORLD: false
|
||||
MONSTER_SPAWNERS_SPAWN: true
|
||||
TNT_DAMAGE: true
|
||||
FIRE_IGNITE: true
|
||||
ANIMAL_SPAWNERS_SPAWN: true
|
||||
BLOCK_EXPLODE_DAMAGE: true
|
||||
# These settings/flags are hidden from users
|
||||
# Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings
|
||||
hidden-flags: []
|
||||
|
@ -445,6 +507,20 @@ island:
|
|||
#
|
||||
# Note that player-executed commands might not work, as these commands can be run with said player being offline.
|
||||
on-leave: []
|
||||
# List of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.
|
||||
# These commands are run by the console, unless otherwise stated using the [SUDO] prefix,
|
||||
# in which case they are executed by the player.
|
||||
#
|
||||
# Available placeholders for the commands are the following:
|
||||
# * [name]: name of the player
|
||||
#
|
||||
# Here are some examples of valid commands to execute:
|
||||
# * '[SUDO] bbox version'
|
||||
# * 'bsbadmin deaths set [player] 0'
|
||||
#
|
||||
# Note that player-executed commands might not work, as these commands can be run with said player being offline.
|
||||
# Added since 1.14.0.
|
||||
on-respawn: []
|
||||
sethome:
|
||||
nether:
|
||||
# Allow setting home in the nether. Only available on nether islands, not vanilla nether.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
acidisland:
|
||||
sign:
|
||||
line0: "&1AcidIsland"
|
||||
line1: "[name]"
|
||||
line2: L'eau est acide!
|
||||
line3: Faites attention! &c<3
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
acidisland:
|
||||
sign:
|
||||
line0: "&1AcidIsland"
|
||||
line1: "[name]"
|
||||
line2: Airnya Asam!
|
||||
line3: Hati-hati! &c<3
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
acidisland:
|
||||
sign:
|
||||
line0: "&1AcidIsland"
|
||||
line1: "[name]"
|
||||
line2: 물은 산성 입니다!
|
||||
line3: 조심하세요! &c<3
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
acidisland:
|
||||
sign:
|
||||
line0: "&1InsulaAcida"
|
||||
line1: "[name]"
|
||||
line2: Apa este acida!
|
||||
line3: Ai grija! &c<3
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
acidisland:
|
||||
sign:
|
||||
line0: "&1AcidIsland"
|
||||
line1: "[name]"
|
||||
line2: Выживание в море!
|
||||
line3: Удачной игры! &c<3
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
acidisland:
|
||||
sign:
|
||||
line0: "& 1AsitAdası"
|
||||
line1: "[isim]"
|
||||
line2: Dikkat et!
|
||||
line3: Su asitli!
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
acidisland:
|
||||
sign:
|
||||
line0: "&1Кислотний острів"
|
||||
line1: "[name]"
|
||||
line2: Вода кислотна!
|
||||
line3: Будь обережний! &c<3
|
|
@ -0,0 +1,9 @@
|
|||
name: BentoBox-AcidIsland
|
||||
main: world.bentobox.acidisland.AcidIslandPladdon
|
||||
version: ${project.version}${build.number}
|
||||
api-version: "1.19"
|
||||
|
||||
authors: [tastybento]
|
||||
contributors: ["The BentoBoxWorld Community"]
|
||||
website: https://bentobox.world
|
||||
description: ${project.description}
|
|
@ -14,6 +14,7 @@ import org.bukkit.entity.EntityType;
|
|||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import world.bentobox.bentobox.lists.Flags;
|
||||
|
@ -140,22 +141,6 @@ public class AISettingsTest {
|
|||
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()}.
|
||||
*/
|
||||
|
@ -193,7 +178,7 @@ public class AISettingsTest {
|
|||
*/
|
||||
@Test
|
||||
public void testGetIslandDistance() {
|
||||
assertEquals(192, s.getIslandDistance());
|
||||
assertEquals(64, s.getIslandDistance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,7 +194,7 @@ public class AISettingsTest {
|
|||
*/
|
||||
@Test
|
||||
public void testGetIslandProtectionRange() {
|
||||
assertEquals(100, s.getIslandProtectionRange());
|
||||
assertEquals(50, s.getIslandProtectionRange());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -675,6 +660,7 @@ public class AISettingsTest {
|
|||
* Test method for {@link world.bentobox.acidisland.AISettings#setAcidEffects(java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
public void testSetAcidEffects() {
|
||||
List<PotionEffectType> list = Collections.singletonList(PotionEffectType.ABSORPTION);
|
||||
s.setAcidEffects(list);
|
||||
|
@ -736,7 +722,7 @@ public class AISettingsTest {
|
|||
@Test
|
||||
public void testSetCustomRanks() {
|
||||
s.setCustomRanks(Collections.singletonMap("string", 10));
|
||||
assertEquals(10, (int)s.getCustomRanks().get("string"));
|
||||
assertEquals(10, (int) s.getCustomRanks().get("string"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -778,21 +764,21 @@ public class AISettingsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.AISettings#setDefaultIslandFlags(java.util.Map)}.
|
||||
* Test method for {@link world.bentobox.acidisland.AISettings#setDefaultIslandFlagNames(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));
|
||||
s.setDefaultIslandFlagNames(Collections.singletonMap(Flags.ANIMAL_NATURAL_SPAWN.getID(), 10));
|
||||
assertEquals(10, (int) s.getDefaultIslandFlagNames().get(Flags.ANIMAL_NATURAL_SPAWN.getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.AISettings#setDefaultIslandSettings(java.util.Map)}.
|
||||
* Test method for {@link world.bentobox.acidisland.AISettings#setDefaultIslandSettingNames(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));
|
||||
s.setDefaultIslandSettingNames(Collections.singletonMap(Flags.ANIMAL_NATURAL_SPAWN.getID(), 10));
|
||||
assertEquals(10, (int) s.getDefaultIslandSettingNames().get(Flags.ANIMAL_NATURAL_SPAWN.getID()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1060,7 +1046,7 @@ public class AISettingsTest {
|
|||
@Test
|
||||
public void testSetNetherSpawnRadius() {
|
||||
s.setNetherSpawnRadius(99);
|
||||
assertEquals(99,s.getNetherSpawnRadius());
|
||||
assertEquals(99, s.getNetherSpawnRadius());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1535,6 +1521,7 @@ public class AISettingsTest {
|
|||
* Test method for {@link world.bentobox.acidisland.AISettings#setAcidRainEffects(java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
@Ignore("Bukkit made this so we can't test")
|
||||
public void testSetAcidRainEffects() {
|
||||
s.setAcidRainEffects(Collections.singletonList(PotionEffectType.BAD_OMEN));
|
||||
assertEquals(PotionEffectType.BAD_OMEN, s.getAcidRainEffects().get(0));
|
||||
|
|
|
@ -1,27 +1,30 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.beans.IntrospectionException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
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.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.logging.Logger;
|
||||
|
@ -32,6 +35,7 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.plugin.PluginManager;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
@ -48,222 +52,255 @@ 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.AbstractDatabaseHandler;
|
||||
import world.bentobox.bentobox.database.DatabaseSetup;
|
||||
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;
|
||||
import world.bentobox.bentobox.managers.RanksManager;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Config.class })
|
||||
@PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Config.class, DatabaseSetup.class, RanksManager.class })
|
||||
public class AcidIslandTest {
|
||||
|
||||
/**
|
||||
* Class under test
|
||||
*/
|
||||
private AcidIsland addon;
|
||||
/**
|
||||
* 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;
|
||||
@Mock
|
||||
private User user;
|
||||
@Mock
|
||||
private IslandsManager im;
|
||||
@Mock
|
||||
private Island island;
|
||||
@Mock
|
||||
private BentoBox plugin;
|
||||
@Mock
|
||||
private FlagsManager fm;
|
||||
@Mock
|
||||
private Settings settings;
|
||||
private RanksManager rm;
|
||||
|
||||
/**
|
||||
* @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);
|
||||
private static AbstractDatabaseHandler<Object> h;
|
||||
|
||||
// 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);
|
||||
@SuppressWarnings("unchecked")
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws IllegalAccessException, InvocationTargetException, IntrospectionException {
|
||||
// This has to be done beforeClass otherwise the tests will interfere with each
|
||||
// other
|
||||
h = mock(AbstractDatabaseHandler.class);
|
||||
// Database
|
||||
PowerMockito.mockStatic(DatabaseSetup.class);
|
||||
DatabaseSetup dbSetup = mock(DatabaseSetup.class);
|
||||
when(DatabaseSetup.getDatabase()).thenReturn(dbSetup);
|
||||
when(dbSetup.getHandler(any())).thenReturn(h);
|
||||
when(h.saveObject(any())).thenReturn(CompletableFuture.completedFuture(true));
|
||||
}
|
||||
|
||||
// Island World Manager
|
||||
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
@After
|
||||
public void tearDown() throws IOException {
|
||||
User.clearUsers();
|
||||
Mockito.framework().clearInlineMocks();
|
||||
deleteAll(new File("database"));
|
||||
deleteAll(new File("database_backup"));
|
||||
deleteAll(new File("addon.jar"));
|
||||
deleteAll(new File("config.yml"));
|
||||
deleteAll(new File("addons"));
|
||||
|
||||
}
|
||||
|
||||
// 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);
|
||||
private void deleteAll(File file) throws IOException {
|
||||
if (file.exists()) {
|
||||
Files.walk(file.toPath()).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
|
||||
}
|
||||
|
||||
// Locales
|
||||
// Return the reference (USE THIS IN THE FUTURE)
|
||||
when(user.getTranslation(Mockito.anyString())).thenAnswer((Answer<String>) 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);
|
||||
/**
|
||||
* @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());
|
||||
|
||||
// Addon
|
||||
addon = new AcidIsland();
|
||||
File jFile = new File("addon.jar");
|
||||
List<String> 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())) {
|
||||
Whitebox.setInternalState(RanksManager.class, "instance", rm);
|
||||
// Command manager
|
||||
CommandsManager cm = mock(CommandsManager.class);
|
||||
when(plugin.getCommandsManager()).thenReturn(cm);
|
||||
|
||||
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);
|
||||
// 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);
|
||||
|
||||
// Flags manager
|
||||
when(plugin.getFlagsManager()).thenReturn(fm);
|
||||
when(fm.getFlags()).thenReturn(Collections.emptyList());
|
||||
// Island World Manager
|
||||
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
||||
// Settings
|
||||
when(plugin.getSettings()).thenReturn(settings);
|
||||
// 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<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
// 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);
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
// Addon
|
||||
addon = new AcidIsland();
|
||||
File jFile = new File("addon.jar");
|
||||
List<String> 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())) {
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.AcidIsland#onEnable()}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnEnable() {
|
||||
testOnLoad();
|
||||
addon.onEnable();
|
||||
assertTrue(addon.getPlayerCommand().isPresent());
|
||||
assertTrue(addon.getAdminCommand().isPresent());
|
||||
}
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
// Flags manager
|
||||
when(plugin.getFlagsManager()).thenReturn(fm);
|
||||
when(fm.getFlags()).thenReturn(Collections.emptyList());
|
||||
|
||||
/**
|
||||
* 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...");
|
||||
}
|
||||
// Settings
|
||||
when(plugin.getSettings()).thenReturn(settings);
|
||||
|
||||
/**
|
||||
* 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#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#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#onEnable()}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnEnable() {
|
||||
testOnLoad();
|
||||
addon.onEnable();
|
||||
assertTrue(addon.getPlayerCommand().isPresent());
|
||||
assertTrue(addon.getAdminCommand().isPresent());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.AcidIsland#allLoaded()}.
|
||||
*/
|
||||
@Test
|
||||
public void testAllLoaded() {
|
||||
addon.allLoaded();
|
||||
}
|
||||
/**
|
||||
* 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#saveWorldSettings()}.
|
||||
*/
|
||||
@Test
|
||||
public void testSaveWorldSettings() {
|
||||
addon.saveWorldSettings();
|
||||
}
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import static org.junit.Assert.assertTrue;
|
|||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -15,8 +14,11 @@ import org.bukkit.potion.PotionEffectType;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class AcidEventTest {
|
||||
|
||||
@Mock
|
||||
|
@ -25,7 +27,7 @@ public class AcidEventTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
List<PotionEffectType> effects = Arrays.asList(PotionEffectType.values());
|
||||
List<PotionEffectType> effects = List.of();
|
||||
e = new AcidEvent(player, 10, 5, effects);
|
||||
}
|
||||
|
||||
|
@ -64,7 +66,7 @@ public class AcidEventTest {
|
|||
|
||||
@Test
|
||||
public void testGetPotionEffects() {
|
||||
Assert.assertArrayEquals(PotionEffectType.values(), e.getPotionEffects().toArray());
|
||||
Assert.assertEquals(0, e.getPotionEffects().toArray().length);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -6,17 +6,19 @@ import static org.junit.Assert.assertNotNull;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class AcidRainEventTest {
|
||||
|
||||
@Mock
|
||||
|
@ -25,7 +27,7 @@ public class AcidRainEventTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
List<PotionEffectType> effects = Arrays.asList(PotionEffectType.values());
|
||||
List<PotionEffectType> effects = List.of();
|
||||
e = new AcidRainEvent(player, 10, 5, effects);
|
||||
}
|
||||
|
||||
|
@ -64,7 +66,7 @@ public class AcidRainEventTest {
|
|||
|
||||
@Test
|
||||
public void testGetPotionEffects() {
|
||||
Assert.assertArrayEquals(PotionEffectType.values(), e.getPotionEffects().toArray());
|
||||
Assert.assertEquals(0, e.getPotionEffects().toArray().length);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package world.bentobox.acidisland.listeners;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
|
@ -18,6 +19,7 @@ import org.bukkit.Bukkit;
|
|||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
|
@ -42,6 +44,7 @@ import org.bukkit.scheduler.BukkitScheduler;
|
|||
import org.bukkit.util.Vector;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
@ -67,9 +70,9 @@ import world.bentobox.bentobox.util.Util;
|
|||
*
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({Bukkit.class, Util.class})
|
||||
@PrepareForTest({ Bukkit.class, Util.class })
|
||||
public class AcidEffectTest {
|
||||
|
||||
|
||||
@Mock
|
||||
private AcidIsland addon;
|
||||
@Mock
|
||||
|
@ -112,7 +115,8 @@ public class AcidEffectTest {
|
|||
private IslandWorldManager iwm;
|
||||
@Mock
|
||||
private IslandsManager im;
|
||||
|
||||
@Mock
|
||||
private Server server;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -122,26 +126,26 @@ public class AcidEffectTest {
|
|||
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);
|
||||
when(player.getLocation()).thenReturn(location);
|
||||
when(player.getVelocity()).thenReturn(new Vector(0,0,0));
|
||||
when(player.getVelocity()).thenReturn(new Vector(0, 0, 0));
|
||||
when(player.getInventory()).thenReturn(inv);
|
||||
ItemStack[] armor = { new ItemStack(Material.CHAINMAIL_HELMET) };
|
||||
when(inv.getArmorContents()).thenReturn(armor);
|
||||
|
||||
|
||||
// Location
|
||||
when(location.getBlockY()).thenReturn(0);
|
||||
when(location.getBlockY()).thenReturn(-66);
|
||||
when(location.getWorld()).thenReturn(world);
|
||||
when(location.getBlock()).thenReturn(block);
|
||||
|
||||
|
||||
// Blocks
|
||||
when(block.getType()).thenReturn(Material.WATER);
|
||||
when(block.getTemperature()).thenReturn(0.5D);
|
||||
|
@ -149,41 +153,42 @@ public class AcidEffectTest {
|
|||
when(block.getRelative(any())).thenReturn(block);
|
||||
when(airBlock.getType()).thenReturn(Material.AIR);
|
||||
when(solidBlock.getType()).thenReturn(Material.CHISELED_RED_SANDSTONE);
|
||||
|
||||
|
||||
// Settings
|
||||
when(settings.getAcidDestroyItemTime()).thenReturn(0L);
|
||||
when(settings.getAcidRainDamage()).thenReturn(10);
|
||||
when(settings.getAcidDamage()).thenReturn(10);
|
||||
when(settings.getAcidDamageDelay()).thenReturn(60L);
|
||||
|
||||
|
||||
// Players Manager
|
||||
when(addon.getPlayers()).thenReturn(pm);
|
||||
|
||||
|
||||
// Mock item factory (for itemstacks)
|
||||
ItemFactory itemFactory = mock(ItemFactory.class);
|
||||
when(Bukkit.getItemFactory()).thenReturn(itemFactory);
|
||||
when(itemFactory.getItemMeta(any())).thenReturn(itemMeta);
|
||||
|
||||
|
||||
// Util
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.sameWorld(any(), any())).thenReturn(true);
|
||||
|
||||
|
||||
// World
|
||||
when(world.hasStorm()).thenReturn(true);
|
||||
when(world.getBlockAt(anyInt(), anyInt(), anyInt())).thenReturn(airBlock);
|
||||
when(world.getMaxHeight()).thenReturn(5);
|
||||
when(world.getMinHeight()).thenReturn(-65);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -214,7 +219,7 @@ public class AcidEffectTest {
|
|||
verify(player).setVelocity(argument.capture());
|
||||
assertTrue(argument.getValue().getBlockY() == 1D);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onSeaBounce(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -225,7 +230,7 @@ public class AcidEffectTest {
|
|||
ae.onSeaBounce(e);
|
||||
verify(player, never()).setVelocity(any());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onSeaBounce(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -236,7 +241,7 @@ public class AcidEffectTest {
|
|||
ae.onSeaBounce(e);
|
||||
verify(player, never()).setVelocity(any());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onSeaBounce(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -247,7 +252,7 @@ public class AcidEffectTest {
|
|||
ae.onSeaBounce(e);
|
||||
verify(player, never()).setVelocity(any());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onSeaBounce(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -268,7 +273,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, times(2)).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -279,7 +284,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -291,7 +296,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, times(2)).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -302,7 +307,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -313,7 +318,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -325,7 +330,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, times(2)).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -337,7 +342,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -350,7 +355,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -363,7 +368,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, times(2)).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -374,7 +379,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -382,15 +387,15 @@ public class AcidEffectTest {
|
|||
public void testOnPlayerMoveAcidRainWrongWorld() {
|
||||
World nether = mock(World.class);
|
||||
when(nether.getName()).thenReturn("world_nether");
|
||||
when(nether.getEnvironment()).thenReturn(Environment.NETHER);
|
||||
when(nether.getEnvironment()).thenReturn(Environment.NETHER);
|
||||
when(player.getWorld()).thenReturn(nether);
|
||||
|
||||
|
||||
PlayerMoveEvent e = new PlayerMoveEvent(player, from, to);
|
||||
ae.onPlayerMove(e);
|
||||
// 3 times only
|
||||
verify(addon, times(3)).getPlugin();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -398,15 +403,15 @@ public class AcidEffectTest {
|
|||
public void testOnPlayerMoveAcidRainWrongWorldEnd() {
|
||||
World end = mock(World.class);
|
||||
when(end.getName()).thenReturn("world_end");
|
||||
when(end.getEnvironment()).thenReturn(Environment.THE_END);
|
||||
when(end.getEnvironment()).thenReturn(Environment.THE_END);
|
||||
when(player.getWorld()).thenReturn(end);
|
||||
|
||||
|
||||
PlayerMoveEvent e = new PlayerMoveEvent(player, from, to);
|
||||
ae.onPlayerMove(e);
|
||||
// 3 times only
|
||||
verify(addon, times(3)).getPlugin();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -417,7 +422,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -429,7 +434,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -441,7 +446,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -454,7 +459,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -467,7 +472,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -481,7 +486,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -507,7 +512,7 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
|
@ -521,11 +526,12 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
@Test
|
||||
@Ignore("Cannot be tested because of the PotionEffectType issue")
|
||||
public void testOnPlayerMoveActivePotions() {
|
||||
Collection<PotionEffect> potions = new ArrayList<>();
|
||||
potions.add(new PotionEffect(PotionEffectType.WATER_BREATHING, 0, 0, false, false, false));
|
||||
|
@ -534,11 +540,12 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
@Test
|
||||
@Ignore("Cannot be tested because of the PotionEffectType issue")
|
||||
public void testOnPlayerMoveActivePotionsConduit() {
|
||||
Collection<PotionEffect> potions = new ArrayList<>();
|
||||
potions.add(new PotionEffect(PotionEffectType.CONDUIT_POWER, 0, 0, false, false, false));
|
||||
|
@ -547,11 +554,12 @@ public class AcidEffectTest {
|
|||
ae.onPlayerMove(e);
|
||||
verify(settings, never()).getAcidDamageDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#onPlayerMove(org.bukkit.event.player.PlayerMoveEvent)}.
|
||||
*/
|
||||
@Test
|
||||
@Ignore("Cannot be tested because of the PotionEffectType issue")
|
||||
public void testOnPlayerMoveActivePotionsBadOmen() {
|
||||
Collection<PotionEffect> potions = new ArrayList<>();
|
||||
potions.add(new PotionEffect(PotionEffectType.BAD_OMEN, 0, 0, false, false, false));
|
||||
|
@ -578,7 +586,119 @@ public class AcidEffectTest {
|
|||
when(player.getEquipment()).thenReturn(equip);
|
||||
double a = AcidEffect.getDamageReduced(player);
|
||||
assertTrue(a == 0.8);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#checkForRain(Player)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCheckForRain() {
|
||||
when(world.hasStorm()).thenReturn(true);
|
||||
when(player.isDead()).thenReturn(false);
|
||||
when(settings.getAcidRainDamage()).thenReturn(10);
|
||||
when(world.getEnvironment()).thenReturn(Environment.NORMAL);
|
||||
assertFalse(ae.checkForRain(player));
|
||||
when(world.hasStorm()).thenReturn(false);
|
||||
when(player.isDead()).thenReturn(false);
|
||||
when(settings.getAcidRainDamage()).thenReturn(10);
|
||||
when(world.getEnvironment()).thenReturn(Environment.NORMAL);
|
||||
assertTrue(ae.checkForRain(player));
|
||||
when(world.hasStorm()).thenReturn(true);
|
||||
when(player.isDead()).thenReturn(true);
|
||||
when(settings.getAcidRainDamage()).thenReturn(10);
|
||||
when(world.getEnvironment()).thenReturn(Environment.NORMAL);
|
||||
assertTrue(ae.checkForRain(player));
|
||||
when(world.hasStorm()).thenReturn(true);
|
||||
when(player.isDead()).thenReturn(false);
|
||||
when(settings.getAcidRainDamage()).thenReturn(0);
|
||||
when(world.getEnvironment()).thenReturn(Environment.NORMAL);
|
||||
assertTrue(ae.checkForRain(player));
|
||||
when(world.hasStorm()).thenReturn(true);
|
||||
when(player.isDead()).thenReturn(false);
|
||||
when(settings.getAcidRainDamage()).thenReturn(10);
|
||||
when(world.getEnvironment()).thenReturn(Environment.NETHER);
|
||||
assertTrue(ae.checkForRain(player));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#checkForRain(Player)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCheckForRainWetPlayer() {
|
||||
AttributeInstance value = mock(AttributeInstance.class);
|
||||
when(value.getValue()).thenReturn(20D);
|
||||
// Diamond armor
|
||||
when(player.getAttribute(eq(Attribute.GENERIC_ARMOR))).thenReturn(value);
|
||||
EntityEquipment equip = mock(EntityEquipment.class);
|
||||
when(equip.getBoots()).thenReturn(new ItemStack(Material.DIAMOND_BOOTS));
|
||||
when(equip.getHelmet()).thenReturn(new ItemStack(Material.DIAMOND_HELMET));
|
||||
when(equip.getLeggings()).thenReturn(new ItemStack(Material.DIAMOND_LEGGINGS));
|
||||
when(equip.getChestplate()).thenReturn(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
||||
when(player.getEquipment()).thenReturn(equip);
|
||||
|
||||
when(settings.getAcidDamageDelay()).thenReturn(0L);
|
||||
when(world.hasStorm()).thenReturn(true);
|
||||
when(player.isDead()).thenReturn(false);
|
||||
when(settings.getAcidRainDamage()).thenReturn(10);
|
||||
when(world.getEnvironment()).thenReturn(Environment.NORMAL);
|
||||
testOnPlayerMoveAcidAndRainDamage();
|
||||
|
||||
assertFalse(ae.checkForRain(player));
|
||||
verify(player).damage(2.0d); // Reduced due to armor
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#isSafeFromAcid(Player)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSafeFromAcid() {
|
||||
assertFalse(ae.isSafeFromAcid(player));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#isSafeFromAcid(Player)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSafeFromAcidEssentialGodMode() {
|
||||
when(essentialsUser.isGodModeEnabled()).thenReturn(true);
|
||||
assertTrue(ae.isSafeFromAcid(player));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#isSafeFromAcid(Player)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSafeFromAcidBoat() {
|
||||
when(player.isInsideVehicle()).thenReturn(true);
|
||||
Entity boat = mock(Entity.class);
|
||||
when(boat.getType()).thenReturn(EntityType.BOAT);
|
||||
when(player.getVehicle()).thenReturn(boat);
|
||||
assertTrue(ae.isSafeFromAcid(player));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#isSafeFromAcid(Player)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSafeFromAcidChestBoat() {
|
||||
when(player.isInsideVehicle()).thenReturn(true);
|
||||
Entity boat = mock(Entity.class);
|
||||
when(boat.getType()).thenReturn(EntityType.CHEST_BOAT);
|
||||
when(player.getVehicle()).thenReturn(boat);
|
||||
assertTrue(ae.isSafeFromAcid(player));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.acidisland.listeners.AcidEffect#isSafeFromAcid(Player)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSafeFromAcidFullArmor() {
|
||||
when(settings.isFullArmorProtection()).thenReturn(true);
|
||||
ItemStack[] armor = { new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET) };
|
||||
when(inv.getArmorContents()).thenReturn(armor);
|
||||
when(player.getInventory()).thenReturn(inv);
|
||||
assertTrue(ae.isSafeFromAcid(player));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public class AcidTaskTest {
|
|||
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);
|
||||
when(scheduler.runTaskTimer(any(), any(Runnable.class), anyLong(), anyLong())).thenReturn(task);
|
||||
|
||||
when(addon.getOverWorld()).thenReturn(world);
|
||||
when(addon.getNetherWorld()).thenReturn(nether);
|
||||
|
@ -148,7 +148,7 @@ public class AcidTaskTest {
|
|||
*/
|
||||
@Test
|
||||
public void testAcidTask() {
|
||||
verify(scheduler).runTaskTimerAsynchronously(eq(null), any(Runnable.class), eq(0L), eq(20L));
|
||||
verify(scheduler).runTaskTimer(eq(null), any(Runnable.class), eq(0L), eq(20L));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,7 +190,7 @@ public class AcidTaskTest {
|
|||
Item e = mock(Item.class);
|
||||
at.applyDamage(e, 0);
|
||||
|
||||
verify(world, never()).playSound(any(), any(Sound.class), anyFloat(), anyFloat());
|
||||
verify(world, never()).playSound(any(Location.class), any(Sound.class), anyFloat(), anyFloat());
|
||||
verify(e, never()).remove();
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class AcidTaskTest {
|
|||
at.setItemsInWater(map);
|
||||
at.applyDamage(e, 0);
|
||||
|
||||
verify(world, never()).playSound(any(), any(Sound.class), anyFloat(), anyFloat());
|
||||
verify(world, never()).playSound(any(Location.class), any(Sound.class), anyFloat(), anyFloat());
|
||||
verify(e, never()).remove();
|
||||
assertTrue(map.isEmpty());
|
||||
}
|
||||
|
|
|
@ -1,26 +1,14 @@
|
|||
package world.bentobox.acidisland.world;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.atLeast;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -29,8 +17,8 @@ import org.powermock.api.mockito.PowerMockito;
|
|||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import world.bentobox.acidisland.AcidIsland;
|
||||
import world.bentobox.acidisland.AISettings;
|
||||
import world.bentobox.acidisland.AcidIsland;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
|
@ -45,10 +33,6 @@ public class ChunkGeneratorWorldTest {
|
|||
private ChunkGeneratorWorld cg;
|
||||
@Mock
|
||||
private World world;
|
||||
private final Random random = new Random();
|
||||
@Mock
|
||||
private BiomeGrid biomeGrid;
|
||||
@Mock
|
||||
private AISettings settings;
|
||||
@Mock
|
||||
private ChunkData data;
|
||||
|
@ -66,114 +50,8 @@ public class ChunkGeneratorWorldTest {
|
|||
when(world.getEnvironment()).thenReturn(World.Environment.NORMAL);
|
||||
when(world.getMaxHeight()).thenReturn(256);
|
||||
// Settings
|
||||
settings = new AISettings();
|
||||
when(addon.getSettings()).thenReturn(settings);
|
||||
when(settings.getSeaHeight()).thenReturn(0);
|
||||
when(settings.isNetherRoof()).thenReturn(true);
|
||||
|
||||
// Instance
|
||||
cg = new ChunkGeneratorWorld(addon);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGenerateChunkDataWorldRandomIntIntBiomeGridOverworldVoid() {
|
||||
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
|
||||
assertEquals(data, cd);
|
||||
// Verifications
|
||||
// Default biome
|
||||
verify(settings).getDefaultBiome();
|
||||
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
|
||||
// Sea height
|
||||
verify(settings).getSeaHeight();
|
||||
// Void
|
||||
verify(cd, never()).setRegion(anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), any(Material.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGenerateChunkDataWorldRandomIntIntBiomeGridOverworldSea() {
|
||||
// Set sea height
|
||||
when(settings.getSeaHeight()).thenReturn(10);
|
||||
// new instance
|
||||
cg = new ChunkGeneratorWorld(addon);
|
||||
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
|
||||
assertEquals(data, cd);
|
||||
// Verifications
|
||||
// Default biome
|
||||
verify(settings).getDefaultBiome();
|
||||
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
|
||||
// Sea height
|
||||
verify(settings, times(2)).getSeaHeight();
|
||||
// Water. Blocks = 16 x 16 x 11 because block 0
|
||||
verify(cd).setRegion(0, 0, 0, 16, 11, 16, Material.WATER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGenerateChunkDataWorldRandomIntIntBiomeGridEnd() {
|
||||
when(world.getEnvironment()).thenReturn(World.Environment.THE_END);
|
||||
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
|
||||
assertEquals(data, cd);
|
||||
// Verifications
|
||||
// Default biome
|
||||
verify(settings).getDefaultEndBiome();
|
||||
// Set biome in end
|
||||
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
|
||||
// Sea height
|
||||
verify(settings).getSeaHeight();
|
||||
// Void
|
||||
verify(cd, never()).setRegion(anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), any(Material.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGenerateChunkDataWorldRandomIntIntBiomeGridNetherWithRoof() {
|
||||
when(world.getEnvironment()).thenReturn(World.Environment.NETHER);
|
||||
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
|
||||
assertEquals(data, cd);
|
||||
// Verifications
|
||||
// Default biome
|
||||
verify(settings).getDefaultNetherBiome();
|
||||
// Nether roof check
|
||||
verify(settings).isNetherRoof();
|
||||
// Never set biome in nether
|
||||
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
|
||||
// Nether roof - at least bedrock layer
|
||||
verify(cd, atLeast(16 * 16)).setBlock(anyInt(), anyInt(), anyInt(), eq(Material.BEDROCK));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGenerateChunkDataWorldRandomIntIntBiomeGridNetherNoRoof() {
|
||||
when(settings.isNetherRoof()).thenReturn(false);
|
||||
when(world.getEnvironment()).thenReturn(World.Environment.NETHER);
|
||||
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
|
||||
assertEquals(data, cd);
|
||||
// Verifications
|
||||
// Nether roof check
|
||||
verify(settings).isNetherRoof();
|
||||
// Nether roof check
|
||||
verify(settings).isNetherRoof();
|
||||
// Never set biome in nether
|
||||
verify(biomeGrid, times(1024)).setBiome(anyInt(), anyInt(), anyInt(), any());
|
||||
// Nether roof - at least bedrock layer
|
||||
verify(cd, never()).setBlock(anyInt(), anyInt(), anyInt(), any(Material.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,6 +59,8 @@ public class ChunkGeneratorWorldTest {
|
|||
*/
|
||||
@Test
|
||||
public void testCanSpawnWorldIntInt() {
|
||||
// Instance
|
||||
cg = new ChunkGeneratorWorld(addon);
|
||||
assertTrue(cg.canSpawn(mock(World.class), 0, 1));
|
||||
}
|
||||
|
||||
|
@ -189,6 +69,8 @@ public class ChunkGeneratorWorldTest {
|
|||
*/
|
||||
@Test
|
||||
public void testGetDefaultPopulatorsWorld() {
|
||||
// Instance
|
||||
cg = new ChunkGeneratorWorld(addon);
|
||||
assertTrue(cg.getDefaultPopulators(mock(World.class)).isEmpty());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue