Compare commits
80 Commits
Author | SHA1 | Date |
---|---|---|
gitlocalize-app[bot] | d24d965152 | |
tastybento | d272873410 | |
tastybento | 706178d3d5 | |
tastybento | 72274c0174 | |
tastybento | e532e5fad5 | |
tastybento | 935884c94d | |
tastybento | afa1ae028f | |
tastybento | 9599935527 | |
tastybento | bc19f352e5 | |
tastybento | 32251d4e48 | |
tastybento | 25fba16138 | |
tastybento | 246a4d4185 | |
tastybento | d066e58b32 | |
tastybento | 24b963fa9c | |
tastybento | d47493c906 | |
tastybento | 5cde5b624b | |
tastybento | 01e6f9263b | |
tastybento | 44d8e1ce39 | |
tastybento | 0e0c0b24f2 | |
tastybento | 6cbf4eee77 | |
tastybento | 6c91835e8f | |
tastybento | ffd5e9fcd5 | |
tastybento | 7a67d2b7f6 | |
tastybento | 98d3a55c50 | |
tastybento | cefefefa93 | |
tastybento | 48967eff87 | |
tastybento | 27e67fb123 | |
tastybento | 8a97bca2a0 | |
gitlocalize-app[bot] | 036d7934d8 | |
BONNe | 844996fe3a | |
BONNe | f44c6fa2a8 | |
tastybento | e88ee17d1c | |
BONNe | 41414ccb26 | |
BONNe | 0efc1af21f | |
BONNe | 92b7366159 | |
BONNe | f341e05ba4 | |
tastybento | 55e7732b82 | |
tastybento | dee662b4b6 | |
tastybento | 12092cb89f | |
tastybento | 9d4d671168 | |
tastybento | 7e7512549c | |
blombergs5 | 11201c7758 | |
tastybento | 86d6eb1da6 | |
tastybento | 300a80b3e3 | |
tastybento | 352ec8d5b2 | |
tastybento | 20e2ee1e22 | |
BONNe | e1a7ed4e77 | |
gitlocalize-app[bot] | 9c4e4bd15e | |
BONNe | c2e1fcc91b | |
BONNe | 49b81ef81a | |
BONNe | 0cdc9c5b65 | |
Andrew | 04cfa79452 | |
gitlocalize-app[bot] | 5cfbc8f046 | |
DahliaSR | 2238e04709 | |
BONNe | fe780a94cd | |
BONNe | 66a37da076 | |
BONNe | e20fc256da | |
BONNe | 44bf473803 | |
BONNe | c79f7e209b | |
BONNe | 03ff0e9cbd | |
gitlocalize-app[bot] | 21eacb025d | |
gitlocalize-app[bot] | 5b73578dee | |
gitlocalize-app[bot] | d666179f15 | |
gitlocalize-app[bot] | 048232cf5d | |
gitlocalize-app[bot] | 4ebc7a255c | |
gitlocalize-app[bot] | 10a5d137ae | |
gitlocalize-app[bot] | 2bc72df3d4 | |
tastybento | 2794465a9d | |
tastybento | 58966eade8 | |
tastybento | 6d3aab0762 | |
tastybento | b81342ef5e | |
tastybento | 113ee71736 | |
tastybento | 0296fe2301 | |
tastybento | 4243416ca6 | |
BONNe | 46c38d9b5b | |
tastybento | d1bfbe5e78 | |
tastybento | e95255b190 | |
tastybento | c5316c70c5 | |
tastybento | 2586013b9a | |
tastybento | 48e731d7db |
|
@ -0,0 +1 @@
|
||||||
|
.DS_Store
|
|
@ -11,21 +11,22 @@ jobs:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||||
- name: Set up JDK 16
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: 16
|
distribution: 'adopt'
|
||||||
|
java-version: 17
|
||||||
- name: Cache SonarCloud packages
|
- name: Cache SonarCloud packages
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.sonar/cache
|
path: ~/.sonar/cache
|
||||||
key: ${{ runner.os }}-sonar
|
key: ${{ runner.os }}-sonar
|
||||||
restore-keys: ${{ runner.os }}-sonar
|
restore-keys: ${{ runner.os }}-sonar
|
||||||
- name: Cache Maven packages
|
- name: Cache Maven packages
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.m2
|
path: ~/.m2
|
||||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
name: Modrinth-Release
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: mc-publish
|
||||||
|
uses: Kir-Antipov/mc-publish@v3.3
|
||||||
|
with:
|
||||||
|
# Publish on Modrinth.
|
||||||
|
modrinth-id: bskyblock
|
||||||
|
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
|
|
@ -0,0 +1,5 @@
|
||||||
|
/target/
|
||||||
|
/.classpath
|
||||||
|
/.DS_Store
|
||||||
|
/.project
|
||||||
|
/addon-bskyblock.iml
|
29
README.md
29
README.md
|
@ -1,26 +1,25 @@
|
||||||
BSkyBlock
|
# BSkyBlock
|
||||||
==========
|
|
||||||
[![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/BSkyBlock)](https://ci.codemc.org/job/BentoBoxWorld/job/BSkyBlock/)
|
[![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/BSkyBlock)](https://ci.codemc.org/job/BentoBoxWorld/job/BSkyBlock/)
|
||||||
[![Lines Of Code](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Abskyblock&metric=ncloc)](https://sonarcloud.io/component_measures?id=world.bentobox%3Abskyblock&metric=ncloc)
|
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BSkyBlock&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
|
||||||
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Abskyblock&metric=sqale_rating)](https://sonarcloud.io/component_measures?id=world.bentobox%3Abskyblock&metric=Maintainability)
|
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BSkyBlock&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
|
||||||
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Abskyblock&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=world.bentobox%3Abskyblock&metric=Reliability)
|
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BSkyBlock&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
|
||||||
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Abskyblock&metric=security_rating)](https://sonarcloud.io/component_measures?id=world.bentobox%3Abskyblock&metric=Security)
|
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BSkyBlock&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
|
||||||
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Abskyblock&metric=bugs)](https://sonarcloud.io/project/issues?id=world.bentobox%3Abskyblock&resolved=false&types=BUG)
|
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BSkyBlock&metric=bugs)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
|
||||||
|
|
||||||
# NOTE
|
<img width="509" alt="BSkyBlock" src="https://user-images.githubusercontent.com/4407265/227750292-5617537d-c99a-4a7e-864e-5de990b8c195.png">
|
||||||
BSkyBlock requires BentoBox, so to run BSkyBlock, you must have BentoBox installed and place BSkyBlock in BentoBox's addon folder.
|
|
||||||
|
|
||||||
# Documentation
|
|
||||||
|
|
||||||
Go to [docs.bentobox.world](https://docs.bentobox.world).
|
|
||||||
|
|
||||||
## About
|
## About
|
||||||
Play SkyBlock with your friends! Don't fall! See the config.yml for all the settings.
|
Play SkyBlock with your friends! Don't fall! See the config.yml for all the settings. This is an addon for BentoBox.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Go to [docs.bentobox.world](https://docs.bentobox.world).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Install BentoBox and run it on the server at least once to create its data folders.
|
1. Install BentoBox and run it on the server at least once to create its data folders.
|
||||||
2. Place this jar in the addons folder of the BentoBox plugin.
|
2. Place [this jar](https://github.com/BentoBoxWorld/BSkyBlock/releases) in the addons folder of the BentoBox plugin.
|
||||||
3. Restart the server.
|
3. Restart the server.
|
||||||
4. The addon will create worlds and a data folder and inside the folder will be a config.yml.
|
4. The addon will create worlds and a data folder and inside the folder will be a config.yml.
|
||||||
5. Stop the server .
|
5. Stop the server .
|
||||||
|
|
61
pom.xml
61
pom.xml
|
@ -54,18 +54,18 @@
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>16</java.version>
|
<java.version>17</java.version>
|
||||||
<!-- Non-minecraft related dependencies -->
|
<!-- Non-minecraft related dependencies -->
|
||||||
<powermock.version>2.0.9</powermock.version>
|
<powermock.version>2.0.9</powermock.version>
|
||||||
<!-- More visible way how to change dependency versions -->
|
<!-- More visible way how to change dependency versions -->
|
||||||
<spigot.version>1.17-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
|
||||||
<bentobox.version>1.17.0</bentobox.version>
|
<bentobox.version>2.3.0-SNAPSHOT</bentobox.version>
|
||||||
<!-- Revision variable removes warning about dynamic version -->
|
<!-- Revision variable removes warning about dynamic version -->
|
||||||
<revision>${build.version}-SNAPSHOT</revision>
|
<revision>${build.version}-SNAPSHOT</revision>
|
||||||
<!-- Do not change unless you want different name for local builds. -->
|
<!-- Do not change unless you want different name for local builds. -->
|
||||||
<build.number>-LOCAL</build.number>
|
<build.number>-LOCAL</build.number>
|
||||||
<!-- This allows to change between versions. -->
|
<!-- This allows to change between versions. -->
|
||||||
<build.version>1.15.1</build.version>
|
<build.version>1.18.0</build.version>
|
||||||
<!-- Sonar Cloud -->
|
<!-- Sonar Cloud -->
|
||||||
<sonar.projectKey>BentoBoxWorld_BSkyBlock</sonar.projectKey>
|
<sonar.projectKey>BentoBoxWorld_BSkyBlock</sonar.projectKey>
|
||||||
<sonar.organization>bentobox-world</sonar.organization>
|
<sonar.organization>bentobox-world</sonar.organization>
|
||||||
|
@ -219,7 +219,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<release>${java.version}</release>
|
<release>${java.version}</release>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -227,10 +227,38 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.0.0-M5</version>
|
<version>3.1.2</version>
|
||||||
|
<!--suppress MavenModelInspection -->
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>
|
<argLine>
|
||||||
--illegal-access=permit
|
${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>
|
</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -244,8 +272,6 @@
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.3.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>8</source>
|
|
||||||
<show>private</show>
|
|
||||||
<failOnError>false</failOnError>
|
<failOnError>false</failOnError>
|
||||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||||
<!-- To compile with Java 11, this tag may be required -->
|
<!-- To compile with Java 11, this tag may be required -->
|
||||||
|
@ -261,7 +287,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.1</version>
|
||||||
|
@ -287,31 +313,38 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.8.3</version>
|
<version>0.8.10</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<append>true</append>
|
<append>true</append>
|
||||||
<excludes>
|
<excludes>
|
||||||
<!-- This is required to prevent Jacoco from adding
|
<!-- This is required to prevent Jacoco from adding
|
||||||
synthetic fields to a JavaBean class (causes errors in testing) -->
|
synthetic fields to a JavaBean class (causes errors in testing) -->
|
||||||
<exclude>**/*Names*</exclude>
|
<exclude>**/*Names*</exclude>
|
||||||
|
<!-- Prevents the Material is too large to mock error -->
|
||||||
|
<exclude>org/bukkit/Material*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>pre-unit-test</id>
|
<id>prepare-agent</id>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>prepare-agent</goal>
|
<goal>prepare-agent</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
<id>post-unit-test</id>
|
<id>report</id>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>report</goal>
|
<goal>report</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<formats>
|
||||||
|
<format>XML</format>
|
||||||
|
</formats>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package world.bentobox.bskyblock;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.entity.SpawnCategory;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.WorldType;
|
import org.bukkit.WorldType;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -129,24 +130,25 @@ public class BSkyBlock extends GameModeAddon implements Listener {
|
||||||
WorldCreator wc = WorldCreator.name(worldName2).type(WorldType.FLAT).environment(env);
|
WorldCreator wc = WorldCreator.name(worldName2).type(WorldType.FLAT).environment(env);
|
||||||
World w = settings.isUseOwnGenerator() ? wc.createWorld() : wc.generator(chunkGenerator2).createWorld();
|
World w = settings.isUseOwnGenerator() ? wc.createWorld() : wc.generator(chunkGenerator2).createWorld();
|
||||||
// Set spawn rates
|
// Set spawn rates
|
||||||
if (w != null) {
|
// Set spawn rates
|
||||||
|
if (w != null && getSettings() != null) {
|
||||||
if (getSettings().getSpawnLimitMonsters() > 0) {
|
if (getSettings().getSpawnLimitMonsters() > 0) {
|
||||||
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
|
w.setSpawnLimit(SpawnCategory.MONSTER, getSettings().getSpawnLimitMonsters());
|
||||||
}
|
}
|
||||||
if (getSettings().getSpawnLimitAmbient() > 0) {
|
if (getSettings().getSpawnLimitAmbient() > 0) {
|
||||||
w.setAmbientSpawnLimit(getSettings().getSpawnLimitAmbient());
|
w.setSpawnLimit(SpawnCategory.AMBIENT, getSettings().getSpawnLimitAmbient());
|
||||||
}
|
}
|
||||||
if (getSettings().getSpawnLimitAnimals() > 0) {
|
if (getSettings().getSpawnLimitAnimals() > 0) {
|
||||||
w.setAnimalSpawnLimit(getSettings().getSpawnLimitAnimals());
|
w.setSpawnLimit(SpawnCategory.ANIMAL, getSettings().getSpawnLimitAnimals());
|
||||||
}
|
}
|
||||||
if (getSettings().getSpawnLimitWaterAnimals() > 0) {
|
if (getSettings().getSpawnLimitWaterAnimals() > 0) {
|
||||||
w.setWaterAnimalSpawnLimit(getSettings().getSpawnLimitWaterAnimals());
|
w.setSpawnLimit(SpawnCategory.WATER_ANIMAL, getSettings().getSpawnLimitWaterAnimals());
|
||||||
}
|
}
|
||||||
if (getSettings().getTicksPerAnimalSpawns() > 0) {
|
if (getSettings().getTicksPerAnimalSpawns() > 0) {
|
||||||
w.setTicksPerAnimalSpawns(getSettings().getTicksPerAnimalSpawns());
|
w.setTicksPerSpawns(SpawnCategory.ANIMAL, getSettings().getTicksPerAnimalSpawns());
|
||||||
}
|
}
|
||||||
if (getSettings().getTicksPerMonsterSpawns() > 0) {
|
if (getSettings().getTicksPerMonsterSpawns() > 0) {
|
||||||
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
|
w.setTicksPerSpawns(SpawnCategory.MONSTER, getSettings().getTicksPerMonsterSpawns());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return w;
|
return w;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package world.bentobox.bskyblock;
|
package world.bentobox.bskyblock;
|
||||||
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.addons.Addon;
|
import world.bentobox.bentobox.api.addons.Addon;
|
||||||
import world.bentobox.bentobox.api.addons.Pladdon;
|
import world.bentobox.bentobox.api.addons.Pladdon;
|
||||||
|
|
||||||
|
|
||||||
public class BSkyBlockPladdon extends Pladdon {
|
public class BSkyBlockPladdon extends Pladdon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
package world.bentobox.bskyblock;
|
package world.bentobox.bskyblock;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Difficulty;
|
import org.bukkit.Difficulty;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
@ -21,8 +16,7 @@ import world.bentobox.bentobox.api.configuration.StoreAt;
|
||||||
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
||||||
import world.bentobox.bentobox.api.flags.Flag;
|
import world.bentobox.bentobox.api.flags.Flag;
|
||||||
import world.bentobox.bentobox.database.objects.adapters.Adapter;
|
import world.bentobox.bentobox.database.objects.adapters.Adapter;
|
||||||
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer;
|
import world.bentobox.bentobox.database.objects.adapters.FlagBooleanSerializer;
|
||||||
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the plugin settings are here
|
* All the plugin settings are here
|
||||||
|
@ -122,6 +116,10 @@ public class Settings implements WorldSettings {
|
||||||
@ConfigEntry(path = "world.island-height")
|
@ConfigEntry(path = "world.island-height")
|
||||||
private int islandHeight = 120;
|
private int islandHeight = 120;
|
||||||
|
|
||||||
|
@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("Use your own world generator for this world.")
|
||||||
@ConfigComment("In this case, the plugin will not generate anything.")
|
@ConfigComment("In this case, the plugin will not generate anything.")
|
||||||
@ConfigComment("If used, you must specify the world name and generator in the bukkit.yml file.")
|
@ConfigComment("If used, you must specify the world name and generator in the bukkit.yml file.")
|
||||||
|
@ -191,6 +189,7 @@ public class Settings implements WorldSettings {
|
||||||
@ConfigComment("This option indicates if nether portals should be linked via dimensions.")
|
@ConfigComment("This option indicates if nether portals should be linked via dimensions.")
|
||||||
@ConfigComment("Option will simulate vanilla portal mechanics that links portals together")
|
@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.")
|
@ConfigComment("or creates a new portal, if there is not a portal in that dimension.")
|
||||||
|
@ConfigComment("This option requires `allow-nether=true` in server.properties.")
|
||||||
@ConfigEntry(path = "world.nether.create-and-link-portals", since = "1.14.4")
|
@ConfigEntry(path = "world.nether.create-and-link-portals", since = "1.14.4")
|
||||||
private boolean makeNetherPortals = false;
|
private boolean makeNetherPortals = false;
|
||||||
|
|
||||||
|
@ -206,6 +205,7 @@ public class Settings implements WorldSettings {
|
||||||
|
|
||||||
@ConfigComment("This option indicates if obsidian platform in the end should be generated")
|
@ConfigComment("This option indicates if obsidian platform in the end should be generated")
|
||||||
@ConfigComment("when player enters the end world.")
|
@ConfigComment("when player enters the end world.")
|
||||||
|
@ConfigComment("This option requires `allow-end=true` in bukkit.yml.")
|
||||||
@ConfigEntry(path = "world.end.create-obsidian-platform", since = "1.14.4")
|
@ConfigEntry(path = "world.end.create-obsidian-platform", since = "1.14.4")
|
||||||
private boolean makeEndPortals = false;
|
private boolean makeEndPortals = false;
|
||||||
|
|
||||||
|
@ -230,13 +230,12 @@ public class Settings implements WorldSettings {
|
||||||
@ConfigComment(" SUB-OWNER = 900")
|
@ConfigComment(" SUB-OWNER = 900")
|
||||||
@ConfigComment(" OWNER = 1000")
|
@ConfigComment(" OWNER = 1000")
|
||||||
@ConfigEntry(path = "world.default-island-flags")
|
@ConfigEntry(path = "world.default-island-flags")
|
||||||
@Adapter(FlagSerializer.class)
|
private Map<String, Integer> defaultIslandFlagNames = new HashMap<>();
|
||||||
private Map<Flag, Integer> defaultIslandFlags = new HashMap<>();
|
|
||||||
|
|
||||||
@ConfigComment("These are the default settings for new islands")
|
@ConfigComment("These are the default settings for new islands")
|
||||||
@ConfigEntry(path = "world.default-island-settings")
|
@ConfigEntry(path = "world.default-island-settings")
|
||||||
@Adapter(FlagSerializer2.class)
|
@Adapter(FlagBooleanSerializer.class)
|
||||||
private Map<Flag, Integer> defaultIslandSettings = new HashMap<>();
|
private Map<String, Integer> defaultIslandSettingNames = new HashMap<>();
|
||||||
|
|
||||||
@ConfigComment("These settings/flags are hidden from users")
|
@ConfigComment("These settings/flags are hidden from users")
|
||||||
@ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings")
|
@ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings")
|
||||||
|
@ -688,22 +687,57 @@ public class Settings implements WorldSettings {
|
||||||
return worldFlags;
|
return worldFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the defaultIslandFlags
|
* @return the defaultIslandFlags
|
||||||
|
* @deprecated since 1.21
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<Flag, Integer> getDefaultIslandFlags() {
|
public Map<Flag, Integer> getDefaultIslandFlags()
|
||||||
return defaultIslandFlags;
|
{
|
||||||
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the defaultIslandSettings
|
* @return the defaultIslandSettings
|
||||||
|
* @deprecated since 1.21
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<Flag, Integer> getDefaultIslandSettings() {
|
public Map<Flag, Integer> getDefaultIslandSettings()
|
||||||
return defaultIslandSettings;
|
{
|
||||||
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return map of flags ID's linked to default rank for new island.
|
||||||
|
* This is necessary so users could specify any flag names in settings file from other plugins and addons.
|
||||||
|
* Otherwise, Flag reader would mark flag as invalid and remove it.
|
||||||
|
* @since 1.21
|
||||||
|
* @return default rank settings for new islands.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> getDefaultIslandFlagNames()
|
||||||
|
{
|
||||||
|
return this.defaultIslandFlagNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return map of flags ID's linked to default settings for new island.
|
||||||
|
* This is necessary so users could specify any flag names in settings file from other plugins and addons.
|
||||||
|
* Otherwise, Flag reader would mark flag as invalid and remove it.
|
||||||
|
* @since 1.21
|
||||||
|
* @return default settings for new islands.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> getDefaultIslandSettingNames()
|
||||||
|
{
|
||||||
|
return this.defaultIslandSettingNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the hidden flags
|
* @return the hidden flags
|
||||||
*/
|
*/
|
||||||
|
@ -1095,20 +1129,29 @@ public class Settings implements WorldSettings {
|
||||||
this.worldFlags = worldFlags;
|
this.worldFlags = worldFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param defaultIslandFlags the defaultIslandFlags to set
|
|
||||||
*/
|
|
||||||
public void setDefaultIslandFlags(Map<Flag, Integer> defaultIslandFlags) {
|
|
||||||
this.defaultIslandFlags = defaultIslandFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param defaultIslandSettings the defaultIslandSettings to set
|
* Sets default island flag names.
|
||||||
|
*
|
||||||
|
* @param defaultIslandFlagNames the default island flag names
|
||||||
*/
|
*/
|
||||||
public void setDefaultIslandSettings(Map<Flag, Integer> defaultIslandSettings) {
|
public void setDefaultIslandFlagNames(Map<String, Integer> defaultIslandFlagNames)
|
||||||
this.defaultIslandSettings = defaultIslandSettings;
|
{
|
||||||
|
this.defaultIslandFlagNames = defaultIslandFlagNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets default island setting names.
|
||||||
|
*
|
||||||
|
* @param defaultIslandSettingNames the default island setting names
|
||||||
|
*/
|
||||||
|
public void setDefaultIslandSettingNames(Map<String, Integer> defaultIslandSettingNames)
|
||||||
|
{
|
||||||
|
this.defaultIslandSettingNames = defaultIslandSettingNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param hiddenFlags the hidden flags to set
|
* @param hiddenFlags the hidden flags to set
|
||||||
*/
|
*/
|
||||||
|
@ -1777,4 +1820,18 @@ public class Settings implements WorldSettings {
|
||||||
public void setMakeEndPortals(boolean makeEndPortals) {
|
public void setMakeEndPortals(boolean makeEndPortals) {
|
||||||
this.makeEndPortals = makeEndPortals;
|
this.makeEndPortals = makeEndPortals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the disallowTeamMemberIslands
|
||||||
|
*/
|
||||||
|
public boolean isDisallowTeamMemberIslands() {
|
||||||
|
return disallowTeamMemberIslands;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param disallowTeamMemberIslands the disallowTeamMemberIslands to set
|
||||||
|
*/
|
||||||
|
public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) {
|
||||||
|
this.disallowTeamMemberIslands = disallowTeamMemberIslands;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class IslandAboutCommand extends CompositeCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(User user, String label, List<String> args) {
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
user.sendRawMessage("About " + getAddon().getDescription().getName() + " " + getAddon().getDescription().getVersion() + ":");
|
user.sendRawMessage("About " + getAddon().getDescription().getName() + " " + getAddon().getDescription().getVersion() + ":");
|
||||||
user.sendRawMessage("Copyright (c) 2017 - 2020 tastybento, Poslovitch");
|
user.sendRawMessage("Copyright (c) 2017 - 2022 tastybento, Poslovitch");
|
||||||
user.sendRawMessage("See https://www.eclipse.org/legal/epl-2.0/");
|
user.sendRawMessage("See https://www.eclipse.org/legal/epl-2.0/");
|
||||||
user.sendRawMessage("for license information.");
|
user.sendRawMessage("for license information.");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
||||||
public ChunkData generateChunks(World world) {
|
public ChunkData generateChunks(World world) {
|
||||||
ChunkData result = createChunkData(world);
|
ChunkData result = createChunkData(world);
|
||||||
if (world.getEnvironment().equals(Environment.NORMAL) && addon.getSettings().getSeaHeight() > 0) {
|
if (world.getEnvironment().equals(Environment.NORMAL) && addon.getSettings().getSeaHeight() > 0) {
|
||||||
result.setRegion(0, 0, 0, 16, addon.getSettings().getSeaHeight() + 1, 16, Material.WATER);
|
result.setRegion(0, world.getMinHeight(), 0, 16, addon.getSettings().getSeaHeight() + 1, 16, Material.WATER);
|
||||||
}
|
}
|
||||||
if (world.getEnvironment().equals(Environment.NETHER) && addon.getSettings().isNetherRoof()) {
|
if (world.getEnvironment().equals(Environment.NETHER) && addon.getSettings().isNetherRoof()) {
|
||||||
roofChunk.forEach((k,v) -> result.setBlock(k.getBlockX(), world.getMaxHeight() + k.getBlockY(), k.getBlockZ(), v));
|
roofChunk.forEach((k,v) -> result.setBlock(k.getBlockX(), world.getMaxHeight() + k.getBlockY(), k.getBlockZ(), v));
|
||||||
|
@ -58,7 +58,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
||||||
world.getEnvironment() == Environment.NETHER ? addon.getSettings().getDefaultNetherBiome() : addon.getSettings().getDefaultEndBiome();
|
world.getEnvironment() == Environment.NETHER ? addon.getSettings().getDefaultNetherBiome() : addon.getSettings().getDefaultEndBiome();
|
||||||
for (int x = 0; x < 16; x+=4) {
|
for (int x = 0; x < 16; x+=4) {
|
||||||
for (int z = 0; z < 16; z+=4) {
|
for (int z = 0; z < 16; z+=4) {
|
||||||
for (int y = 0; y < world.getMaxHeight(); y+=4) {
|
for (int y = world.getMinHeight(); y < world.getMaxHeight(); y+=4) {
|
||||||
biomeGrid.setBiome(x, y, z, biome);
|
biomeGrid.setBiome(x, y, z, biome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// Stalatite
|
// Stalactite
|
||||||
for (int i = 0; i < rand.nextInt(10); i++) {
|
for (int i = 0; i < rand.nextInt(10); i++) {
|
||||||
setBlock(x, - 8 - i, z, Material.GLOWSTONE);
|
setBlock(x, - 8 - i, z, Material.GLOWSTONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,95 +1,21 @@
|
||||||
name: BSkyBlock
|
name: BSkyBlock
|
||||||
main: world.bentobox.bskyblock.BSkyBlock
|
main: world.bentobox.bskyblock.BSkyBlock
|
||||||
version: ${version}${build.number}
|
version: ${version}${build.number}
|
||||||
api-version: 1.17
|
api-version: 1.21.0
|
||||||
metrics: true
|
metrics: true
|
||||||
icon: "OAK_SAPLING"
|
icon: "OAK_SAPLING"
|
||||||
repository: "BentoBoxWorld/BSkyBlock"
|
repository: "BentoBoxWorld/BSkyBlock"
|
||||||
|
|
||||||
authors: tastybento
|
authors: tastybento
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
bskyblock.island:
|
# Non-command permissions
|
||||||
description: Allow island command usage
|
|
||||||
default: true
|
|
||||||
bskyblock.island.create:
|
|
||||||
description: Allow island creation
|
|
||||||
default: true
|
|
||||||
bskyblock.island.home:
|
|
||||||
description: Allow teleporting to player island
|
|
||||||
default: true
|
|
||||||
bskyblock.island.homes:
|
|
||||||
description: Allow use of the homes command
|
|
||||||
default: true
|
|
||||||
bskyblock.island.sethome:
|
|
||||||
description: Let the player use the sethome command
|
|
||||||
default: true
|
|
||||||
bskyblock.island.info:
|
|
||||||
description: Let the player use the island info command
|
|
||||||
default: true
|
|
||||||
bskyblock.island.lock:
|
bskyblock.island.lock:
|
||||||
description: Allows island locking
|
description: Allows island locking in settings
|
||||||
default: true
|
|
||||||
bskyblock.island.near:
|
|
||||||
description: Players can see nearby island names
|
|
||||||
default: true
|
|
||||||
bskyblock.island.expel:
|
|
||||||
description: Allows expelling of visitors
|
|
||||||
default: true
|
|
||||||
bskyblock.island.ban:
|
|
||||||
description: Allows banning of visitors
|
|
||||||
default: true
|
|
||||||
bskyblock.island.settings:
|
|
||||||
description: Player can see server settings
|
|
||||||
default: true
|
|
||||||
bskyblock.island.language:
|
|
||||||
description: Player can select a language
|
|
||||||
default: true
|
|
||||||
bskyblock.island.name:
|
|
||||||
description: Player can set the name of their island
|
|
||||||
default: true
|
|
||||||
bskyblock.island.spawn:
|
|
||||||
description: Player can use the island spawn command if spawn exists
|
|
||||||
default: true
|
|
||||||
bskyblock.island.reset:
|
|
||||||
description: Player can use the island reset or restart command
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team:
|
|
||||||
description: Let a player use team command
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.setowner:
|
|
||||||
description: Let a player change the team owner
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.invite:
|
|
||||||
description: Let a player invite others
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.reject:
|
|
||||||
description: Let a player reject invites
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.leave:
|
|
||||||
description: Let a player leave the team
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.kick:
|
|
||||||
description: Let a player kick team members
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.accept:
|
|
||||||
description: Let a player accept invitations
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.trust:
|
|
||||||
description: Let a player use team trust commands
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.coop:
|
|
||||||
description: Let a player use team coop commands
|
|
||||||
default: true
|
|
||||||
bskyblock.island.team.promote:
|
|
||||||
description: Let a player use promote commands
|
|
||||||
default: true
|
default: true
|
||||||
bskyblock.settings.*:
|
bskyblock.settings.*:
|
||||||
description: Allow use of settings on island
|
description: Allow use of settings on island
|
||||||
default: true
|
default: true
|
||||||
bskyblock.mod.info:
|
|
||||||
description: Let a moderator see info on a player
|
|
||||||
default: op
|
|
||||||
bskyblock.mod.clearreset:
|
bskyblock.mod.clearreset:
|
||||||
description: Allow clearing of island reset limit
|
description: Allow clearing of island reset limit
|
||||||
default: false
|
default: false
|
||||||
|
@ -105,47 +31,14 @@ permissions:
|
||||||
bskyblock.mod.bypassexpel:
|
bskyblock.mod.bypassexpel:
|
||||||
description: Allow moderator to bypass island expulsion
|
description: Allow moderator to bypass island expulsion
|
||||||
default: op
|
default: op
|
||||||
bskyblock.mod.switch:
|
|
||||||
description: Allows moderator to switch bypass protection on and off
|
|
||||||
default: op
|
|
||||||
bskyblock.mod.lock:
|
bskyblock.mod.lock:
|
||||||
description: Locks or unlocks an island
|
description: Allows lock or unlock of an island
|
||||||
default: op
|
default: op
|
||||||
bskyblock.mod.bypasslock:
|
bskyblock.mod.bypasslock:
|
||||||
description: Bypasses an island lock
|
description: Bypasses an island lock
|
||||||
default: op
|
default: op
|
||||||
bskyblock.mod.bypassban:
|
bskyblock.mod.bypassban:
|
||||||
description: Bypasses island ban
|
description: Bypasses island ban
|
||||||
default: op
|
|
||||||
bskyblock.mod.team:
|
|
||||||
description: Enables modification of teams via kick and add commands
|
|
||||||
default: false
|
|
||||||
bskyblock.admin.tp:
|
|
||||||
description: Allows teleport to an island
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.clearresetall:
|
|
||||||
description: Allow clearing of island reset limit of all players
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.reload:
|
|
||||||
description: Reload the config.yml
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.delete:
|
|
||||||
description: Let a player completely remove a player (including island)
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.register:
|
|
||||||
description: Let a player register the nearest island to another player.
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.unregister:
|
|
||||||
description: Removes a player from an island without deleting the island blocks.
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.setspawn:
|
|
||||||
description: Allows use of spawn tools
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.setrange:
|
|
||||||
description: Allows setting of island protection range
|
|
||||||
default: op
|
|
||||||
bskyblock.admin.settingsreset:
|
|
||||||
description: Resets all the islands to default protection settings
|
|
||||||
default: op
|
default: op
|
||||||
bskyblock.admin.noban:
|
bskyblock.admin.noban:
|
||||||
description: Player cannot be banned from an island
|
description: Player cannot be banned from an island
|
||||||
|
@ -153,13 +46,250 @@ permissions:
|
||||||
bskyblock.admin.noexpel:
|
bskyblock.admin.noexpel:
|
||||||
description: Player cannot be expelled from an island
|
description: Player cannot be expelled from an island
|
||||||
default: op
|
default: op
|
||||||
bskyblock.admin.setlanguage:
|
# Command permissions
|
||||||
description: Resets all player languages and sets the default language
|
bskyblock.island:
|
||||||
default: op
|
description: Allow use of '/island' command - the main island command
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.home:
|
||||||
|
description: Allow use of '/island go' command - teleport you to your island
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.spawn:
|
||||||
|
description: Allow use of '/island spawn' command - teleport you to the spawn
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.create:
|
||||||
|
description: Allow use of '/island create' command - create an island, using optional blueprint (requires permission)
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.reset:
|
||||||
|
description: Allow use of '/island reset' command - restart your island and remove the old one
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.info:
|
||||||
|
description: Allow use of '/island info' command - display info about your island or the player's island
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.settings:
|
||||||
|
description: Allow use of '/island settings' command - display island settings
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.name:
|
||||||
|
description: Allow use of '/island setname' or '/island resetname' command - your island name
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.language:
|
||||||
|
description: Allow use of '/island language' command - select language
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.ban:
|
||||||
|
description: Allow use of '/island ban' or '/island unban' or '/island banlist' command - banned players
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.expel:
|
||||||
|
description: Allow use of '/island expel' command - expel a player from your island
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.near:
|
||||||
|
description: Allow use of '/island near' command - show the name of neighboring islands around you
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team:
|
||||||
|
description: Allow use of '/island team' command - manage your team
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.invite:
|
||||||
|
description: Allow use of '/island team invite' command - invite a player to join your island
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.leave:
|
||||||
|
description: Allow use of '/island team leave' command - leave your island
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.setowner:
|
||||||
|
description: Allow use of '/island team setowner' command - transfer your island ownership to a member
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.kick:
|
||||||
|
description: Allow use of '/island team kick' command - remove a member from your island
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.accept:
|
||||||
|
description: Allow use of '/island team accept' command - accept an invitation
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.reject:
|
||||||
|
description: Allow use of '/island team reject' command - reject an invitation
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.coop:
|
||||||
|
description: Allow use of '/island team coop' or '/island team uncoop' command - coop rank from player
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.trust:
|
||||||
|
description: Allow use of '/island team trust' or '/island team untrust' command - trusted player rank for player
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.team.promote:
|
||||||
|
description: Allow use of '/island team promote' or '/island team demote' command - move a player's rank on your island
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.sethome:
|
||||||
|
description: Allow use of '/island sethome' command - set your home teleport point
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.island.deletehome:
|
||||||
|
description: Allow use of '/island deletehome' command - delete a home location
|
||||||
|
default: OP
|
||||||
|
bskyblock.island.renamehome:
|
||||||
|
description: Allow use of '/island renamehome' command - rename a home location
|
||||||
|
default: OP
|
||||||
|
bskyblock.island.homes:
|
||||||
|
description: Allow use of '/island homes' command - list your homes
|
||||||
|
default: TRUE
|
||||||
|
bskyblock.admin:
|
||||||
|
description: Allow use of '/bsbadmin' command - admin command
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.version:
|
||||||
|
description: Allow use of '/bsbadmin version' command - display BentoBox and addons versions
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.tp:
|
||||||
|
description: Allow use of '/bsbadmin tp/tpnether/tpend' command - teleport to a player's island
|
||||||
|
default: OP
|
||||||
bskyblock.admin.getrank:
|
bskyblock.admin.getrank:
|
||||||
description: Get a player's rank
|
description: Allow use of '/bsbadmin getrank' command - get a player's rank on their island or the island of the owner
|
||||||
default: op
|
default: OP
|
||||||
bskyblock.admin.setrank:
|
bskyblock.admin.setrank:
|
||||||
description: Set a player's rank
|
description: Allow use of '/bsbadmin setrank' command - set a player's rank on their island or the island of the owner
|
||||||
default: op
|
default: OP
|
||||||
|
bskyblock.mod.info:
|
||||||
|
description: Allow use of '/bsbadmin info' command - get info on where you are or player's island
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.team:
|
||||||
|
description: Allow use of '/bsbadmin team' command - manage teams
|
||||||
|
default: FALSE
|
||||||
|
bskyblock.mod.team.add:
|
||||||
|
description: Allow use of '/bsbadmin team add' command - add player to owner's team
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.team.disband:
|
||||||
|
description: Allow use of '/bsbadmin team disband' command - disband owner's team
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.team.fix:
|
||||||
|
description: Allow use of '/bsbadmin team fix' command - scans and fixes cross island membership in database
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.team.kick:
|
||||||
|
description: Allow use of '/bsbadmin team kick' command - kick a player from a team
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.team.setowner:
|
||||||
|
description: Allow use of '/bsbadmin team setowner' command - transfers island ownership to the player
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint:
|
||||||
|
description: Allow use of '/bsbadmin blueprint' command - manipulate blueprints
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.load:
|
||||||
|
description: Allow use of '/bsbadmin blueprint load' command - load blueprint into the clipboard
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.paste:
|
||||||
|
description: Allow use of '/bsbadmin blueprint paste' command - paste the clipboard to your location
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.origin:
|
||||||
|
description: Allow use of '/bsbadmin blueprint origin' command - set the blueprint's origin to your position
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.copy:
|
||||||
|
description: Allow use of '/bsbadmin blueprint copy' command - copy the clipboard set by pos1 and pos2 and optionally the air blocks
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.save:
|
||||||
|
description: Allow use of '/bsbadmin blueprint save' command - save the copied clipboard
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.rename:
|
||||||
|
description: Allow use of '/bsbadmin blueprint rename' command - rename a blueprint
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.delete:
|
||||||
|
description: Allow use of '/bsbadmin blueprint delete' command - delete the blueprint
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.pos1:
|
||||||
|
description: Allow use of '/bsbadmin blueprint pos1' command - set 1st corner of cuboid clipboard
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.pos2:
|
||||||
|
description: Allow use of '/bsbadmin blueprint pos2' command - set 2nd corner of cuboid clipboard
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.blueprint.list:
|
||||||
|
description: Allow use of '/bsbadmin blueprint list' command - list available blueprints
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.register:
|
||||||
|
description: Allow use of '/bsbadmin register' command - register player to unowned island you are on
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.unregister:
|
||||||
|
description: Allow use of '/bsbadmin unregister' command - unregister owner from island, but keep island blocks
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.range:
|
||||||
|
description: Allow use of '/bsbadmin range' command - admin island range command
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.range.display:
|
||||||
|
description: Allow use of '/bsbadmin range display' command - show/hide island range indicators
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.range.set:
|
||||||
|
description: Allow use of '/bsbadmin range set' command - sets the island protected range
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.range.reset:
|
||||||
|
description: Allow use of '/bsbadmin range reset' command - resets the island protected range to the world default
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.range.add:
|
||||||
|
description: Allow use of '/bsbadmin range add' command - increases the island protected range
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.range.remove:
|
||||||
|
description: Allow use of '/bsbadmin range remove' command - decreases the island protected range
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.resets:
|
||||||
|
description: Allow use of '/bsbadmin resets' command - edit player reset values
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.resets.set:
|
||||||
|
description: Allow use of '/bsbadmin resets set' command - sets how many times this player has reset his island
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.resets.add:
|
||||||
|
description: Allow use of '/bsbadmin resets add' command - adds this player's island reset count
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.resets.remove:
|
||||||
|
description: Allow use of '/bsbadmin resets remove' command - reduces the player's island reset count
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.delete:
|
||||||
|
description: Allow use of '/bsbadmin delete' command - deletes a player's island
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.why:
|
||||||
|
description: Allow use of '/bsbadmin why' command - toggle console protection debug reporting
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.deaths:
|
||||||
|
description: Allow use of '/bsbadmin deaths' command - edit deaths of players
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.deaths.reset:
|
||||||
|
description: Allow use of '/bsbadmin deaths reset' command - resets deaths of the player
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.deaths.set:
|
||||||
|
description: Allow use of '/bsbadmin deaths set' command - sets deaths of the player
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.deaths.add:
|
||||||
|
description: Allow use of '/bsbadmin deaths add' command - adds deaths to the player
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.deaths.remove:
|
||||||
|
description: Allow use of '/bsbadmin deaths remove' command - removes deaths to the player
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.reload:
|
||||||
|
description: Allow use of '/bsbadmin reload' command - reload
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.setspawn:
|
||||||
|
description: Allow use of '/bsbadmin setspawn' command - set an island as spawn for this gamemode
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.setspawnpoint:
|
||||||
|
description: Allow use of '/bsbadmin setspawnpoint' command - set current location as spawn point for this island
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.resetflags:
|
||||||
|
description: Allow use of '/bsbadmin resetflags' command - Reset all islands to default flag settings in config.yml
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.switch:
|
||||||
|
description: Allow use of '/bsbadmin switch' command - switch on/off protection bypass
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.purge:
|
||||||
|
description: Allow use of '/bsbadmin purge' command - purge islands abandoned for more than [days]
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.purge.status:
|
||||||
|
description: Allow use of '/bsbadmin purge status' command - displays the status of the purge
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.purge.stop:
|
||||||
|
description: Allow use of '/bsbadmin purge stop' command - stop a purge in progress
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.purge.unowned:
|
||||||
|
description: Allow use of '/bsbadmin purge unowned' command - purge unowned islands
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.purge.protect:
|
||||||
|
description: Allow use of '/bsbadmin purge protect' command - toggle island purge protection
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.settings:
|
||||||
|
description: Allow use of '/bsbadmin settings' command - open settings GUI or set settings
|
||||||
|
default: OP
|
||||||
|
bskyblock.admin.setprotectionlocation:
|
||||||
|
description: Allow use of '/bsbadmin setprotectionlocation' command - set current location or [x y z] as center of island's protection area
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.deletehomes:
|
||||||
|
description: Allow use of '/bsbadmin deletehomes' command - deletes all named homes from an island
|
||||||
|
default: OP
|
||||||
|
bskyblock.mod.resetname:
|
||||||
|
description: Allow use of '/bsbadmin resetname' command - reset player island name
|
||||||
|
default: OP
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
],
|
],
|
||||||
"requirePermission": false,
|
"requirePermission": false,
|
||||||
"blueprints": {
|
"blueprints": {
|
||||||
"NORMAL": "classic-lshape",
|
"NORMAL": "l-shaped",
|
||||||
"NETHER": "nether-island",
|
"NETHER": "nether-island",
|
||||||
"THE_END": "end-island"
|
"THE_END": "end-island"
|
||||||
},
|
},
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -119,6 +119,7 @@ world:
|
||||||
# This option indicates if nether portals should be linked via dimensions.
|
# This option indicates if nether portals should be linked via dimensions.
|
||||||
# Option will simulate vanilla portal mechanics that links portals together
|
# Option will simulate vanilla portal mechanics that links portals together
|
||||||
# or creates a new portal, if there is not a portal in that dimension.
|
# or creates a new portal, if there is not a portal in that dimension.
|
||||||
|
# This option requires `allow-nether=true` in server.properties.
|
||||||
# Added since 1.14.4.
|
# Added since 1.14.4.
|
||||||
create-and-link-portals: false
|
create-and-link-portals: false
|
||||||
end:
|
end:
|
||||||
|
@ -130,6 +131,7 @@ world:
|
||||||
islands: true
|
islands: true
|
||||||
# This option indicates if obsidian platform in the end should be generated
|
# This option indicates if obsidian platform in the end should be generated
|
||||||
# when player enters the end world.
|
# when player enters the end world.
|
||||||
|
# This option requires `allow-end=true` in bukkit.yml.
|
||||||
# Added since 1.14.4.
|
# Added since 1.14.4.
|
||||||
create-obsidian-platform: false
|
create-obsidian-platform: false
|
||||||
# /!\ This feature is experimental and might not work as expected or might not work at all.
|
# /!\ This feature is experimental and might not work as expected or might not work at all.
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
bskyblock:
|
||||||
|
sign:
|
||||||
|
line0: "&cBSkyBlock"
|
||||||
|
line1: Herzlich Willkommen!
|
||||||
|
line2: "[name]"
|
||||||
|
line3: Fall nicht runter! &c<3
|
|
@ -1,16 +1,10 @@
|
||||||
###########################################################################################
|
---
|
||||||
# Ceci est un fichier YAML. Soyez prudent lors de l'édition.Vérifiez vos changements dans #
|
|
||||||
# le vérificateur YAML suivant: http://yaml-online-parser.appspot.com #
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
meta:
|
|
||||||
authors:
|
|
||||||
- x9nico
|
|
||||||
|
|
||||||
bskyblock:
|
bskyblock:
|
||||||
sign:
|
sign:
|
||||||
line0: "&cBSkyBlock"
|
line0: "&cBSkyBlock"
|
||||||
line1: "Bienvenue!"
|
line1: Bienvenue!
|
||||||
line2: "[name]"
|
line2: "[name]"
|
||||||
line3: "Ne tombez pas ! &c<3"
|
line3: Ne tombez pas ! &c<3
|
||||||
|
meta:
|
||||||
|
authors:
|
||||||
|
- x9nico
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
---
|
||||||
bskyblock:
|
bskyblock:
|
||||||
sign:
|
sign:
|
||||||
line0: "&cBSkyBlock"
|
line0: "&cBSkyBlock"
|
||||||
|
line1: Bem vindo(a)!
|
||||||
line2: "[name]"
|
line2: "[name]"
|
||||||
line3: Não caia! &c<3
|
line3: Não caia! &c<3
|
||||||
line1: Bem vinda!
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
bskyblock:
|
||||||
|
sign:
|
||||||
|
line0: "&cBSkyBlock"
|
||||||
|
line1: "Bine ai venit!"
|
||||||
|
line2: "[name]"
|
||||||
|
line3: "Sa nu cazi! &c<3"
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
bskyblock:
|
||||||
|
sign:
|
||||||
|
line0: "&cBSkyBlock"
|
||||||
|
line1: Добро пожаловать!
|
||||||
|
line2: "[name]"
|
||||||
|
line3: Не падай! &c <3
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
bskyblock:
|
||||||
|
sign:
|
||||||
|
line0: "&cBSkyBlock"
|
||||||
|
line1: Hoş Geldin!
|
||||||
|
line2: "[name]"
|
||||||
|
line3: Aşağı Düşme! &c<3
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
bskyblock:
|
||||||
|
sign:
|
||||||
|
line0: "&cBSkyBlock"
|
||||||
|
line1: Chào mừng!
|
||||||
|
line2: "[Tên]"
|
||||||
|
line3: Đừng ngã xuống! &c<3
|
|
@ -1,6 +1,7 @@
|
||||||
|
---
|
||||||
bskyblock:
|
bskyblock:
|
||||||
sign:
|
sign:
|
||||||
line0: "&c空岛生存"
|
line0: "&c空岛生存"
|
||||||
line1: "欢迎你来到这里!"
|
line1: 欢迎你来到这里!
|
||||||
line2: "[name]"
|
line2: "[name]"
|
||||||
line3: "千万不要掉下去! &c<3"
|
line3: 千万不要掉下去! &c<3
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
name: BSkyBlock
|
name: BentoBox-BSkyBlock
|
||||||
main: world.bentobox.bskyblock.BSkyBlockPladdon
|
main: world.bentobox.bskyblock.BSkyBlockPladdon
|
||||||
version: ${version}
|
version: ${project.version}${build.number}
|
||||||
api-version: 1.17
|
api-version: "1.19"
|
||||||
description: A SkyBlock Plugin
|
|
||||||
author: tastybento
|
authors: [tastybento]
|
||||||
depend:
|
contributors: ["The BentoBoxWorld Community"]
|
||||||
- BentoBox
|
website: https://bentobox.world
|
||||||
|
description: ${project.description}
|
||||||
|
|
|
@ -4,20 +4,26 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import java.beans.IntrospectionException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarOutputStream;
|
import java.util.jar.JarOutputStream;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
@ -28,6 +34,7 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
|
@ -43,6 +50,8 @@ import world.bentobox.bentobox.Settings;
|
||||||
import world.bentobox.bentobox.api.addons.AddonDescription;
|
import world.bentobox.bentobox.api.addons.AddonDescription;
|
||||||
import world.bentobox.bentobox.api.configuration.Config;
|
import world.bentobox.bentobox.api.configuration.Config;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
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.database.objects.Island;
|
||||||
import world.bentobox.bentobox.managers.AddonsManager;
|
import world.bentobox.bentobox.managers.AddonsManager;
|
||||||
import world.bentobox.bentobox.managers.CommandsManager;
|
import world.bentobox.bentobox.managers.CommandsManager;
|
||||||
|
@ -56,189 +65,215 @@ import world.bentobox.bskyblock.generators.ChunkGeneratorWorld;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RunWith(PowerMockRunner.class)
|
@RunWith(PowerMockRunner.class)
|
||||||
@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Config.class })
|
@PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Config.class, DatabaseSetup.class })
|
||||||
public class BSkyBlockTest {
|
public class BSkyBlockTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private User user;
|
private User user;
|
||||||
@Mock
|
@Mock
|
||||||
private IslandsManager im;
|
private IslandsManager im;
|
||||||
@Mock
|
@Mock
|
||||||
private Island island;
|
private Island island;
|
||||||
|
|
||||||
private BSkyBlock addon;
|
private BSkyBlock addon;
|
||||||
@Mock
|
@Mock
|
||||||
private BentoBox plugin;
|
private BentoBox plugin;
|
||||||
@Mock
|
@Mock
|
||||||
private FlagsManager fm;
|
private FlagsManager fm;
|
||||||
@Mock
|
@Mock
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
|
|
||||||
/**
|
private static AbstractDatabaseHandler<Object> h;
|
||||||
* @throws java.lang.Exception
|
|
||||||
*/
|
|
||||||
@Before
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
// Set up plugin
|
|
||||||
Whitebox.setInternalState(BentoBox.class, "instance", plugin);
|
|
||||||
when(plugin.getLogger()).thenReturn(Logger.getAnonymousLogger());
|
|
||||||
// Command manager
|
|
||||||
CommandsManager cm = mock(CommandsManager.class);
|
|
||||||
when(plugin.getCommandsManager()).thenReturn(cm);
|
|
||||||
|
|
||||||
// Player
|
@SuppressWarnings("unchecked")
|
||||||
Player p = mock(Player.class);
|
@BeforeClass
|
||||||
// Sometimes use Mockito.withSettings().verboseLogging()
|
public static void beforeClass() throws IllegalAccessException, InvocationTargetException, IntrospectionException {
|
||||||
when(user.isOp()).thenReturn(false);
|
// This has to be done beforeClass otherwise the tests will interfere with each
|
||||||
UUID uuid = UUID.randomUUID();
|
// other
|
||||||
when(user.getUniqueId()).thenReturn(uuid);
|
h = mock(AbstractDatabaseHandler.class);
|
||||||
when(user.getPlayer()).thenReturn(p);
|
// Database
|
||||||
when(user.getName()).thenReturn("tastybento");
|
PowerMockito.mockStatic(DatabaseSetup.class);
|
||||||
User.setPlugin(plugin);
|
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
|
@After
|
||||||
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
public void tearDown() throws IOException {
|
||||||
when(plugin.getIWM()).thenReturn(iwm);
|
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
|
private void deleteAll(File file) throws IOException {
|
||||||
island = mock(Island.class);
|
if (file.exists()) {
|
||||||
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
|
Files.walk(file.toPath()).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
|
||||||
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));
|
|
||||||
|
|
||||||
// Server
|
/**
|
||||||
PowerMockito.mockStatic(Bukkit.class);
|
* @throws java.lang.Exception
|
||||||
Server server = mock(Server.class);
|
*/
|
||||||
when(Bukkit.getServer()).thenReturn(server);
|
@Before
|
||||||
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
|
public void setUp() throws Exception {
|
||||||
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
|
// 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);
|
||||||
|
|
||||||
// Addon
|
// Player
|
||||||
addon = new BSkyBlock();
|
Player p = mock(Player.class);
|
||||||
File jFile = new File("addon.jar");
|
// Sometimes use Mockito.withSettings().verboseLogging()
|
||||||
List<String> lines = Arrays.asList("# BSkyBlock Configuration", "uniqueId: config");
|
when(user.isOp()).thenReturn(false);
|
||||||
Path path = Paths.get("config.yml");
|
UUID uuid = UUID.randomUUID();
|
||||||
Files.write(path, lines, Charset.forName("UTF-8"));
|
when(user.getUniqueId()).thenReturn(uuid);
|
||||||
try (JarOutputStream tempJarOutputStream = new JarOutputStream(new FileOutputStream(jFile))) {
|
when(user.getPlayer()).thenReturn(p);
|
||||||
//Added the new files to the jar.
|
when(user.getName()).thenReturn("tastybento");
|
||||||
try (FileInputStream fis = new FileInputStream(path.toFile())) {
|
User.setPlugin(plugin);
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
// Island World Manager
|
||||||
int bytesRead = 0;
|
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
||||||
JarEntry entry = new JarEntry(path.toString());
|
when(plugin.getIWM()).thenReturn(iwm);
|
||||||
tempJarOutputStream.putNextEntry(entry);
|
|
||||||
while((bytesRead = fis.read(buffer)) != -1) {
|
|
||||||
tempJarOutputStream.write(buffer, 0, bytesRead);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File dataFolder = new File("addons/BSkyBlock");
|
|
||||||
addon.setDataFolder(dataFolder);
|
|
||||||
addon.setFile(jFile);
|
|
||||||
AddonDescription desc = new AddonDescription.Builder("bentobox", "bskyblock", "1.3").description("test").authors("tasty").build();
|
|
||||||
addon.setDescription(desc);
|
|
||||||
// Addons manager
|
|
||||||
AddonsManager am = mock(AddonsManager.class);
|
|
||||||
when(plugin.getAddonsManager()).thenReturn(am);
|
|
||||||
|
|
||||||
// Flags manager
|
// Player has island to begin with
|
||||||
when(plugin.getFlagsManager()).thenReturn(fm);
|
island = mock(Island.class);
|
||||||
when(fm.getFlags()).thenReturn(Collections.emptyList());
|
when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island);
|
||||||
|
when(plugin.getIslands()).thenReturn(im);
|
||||||
|
|
||||||
// Settings
|
// Locales
|
||||||
when(plugin.getSettings()).thenReturn(settings);
|
// 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);
|
||||||
|
Server server = mock(Server.class);
|
||||||
|
when(Bukkit.getServer()).thenReturn(server);
|
||||||
|
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
|
||||||
|
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
|
||||||
|
|
||||||
/**
|
// Addon
|
||||||
* @throws java.lang.Exception
|
addon = new BSkyBlock();
|
||||||
*/
|
File jFile = new File("addon.jar");
|
||||||
@After
|
List<String> lines = Arrays.asList("# BSkyBlock Configuration", "uniqueId: config");
|
||||||
public void tearDown() throws Exception {
|
Path path = Paths.get("config.yml");
|
||||||
new File("addon.jar").delete();
|
Files.write(path, lines, Charset.forName("UTF-8"));
|
||||||
new File("config.yml").delete();
|
try (JarOutputStream tempJarOutputStream = new JarOutputStream(new FileOutputStream(jFile))) {
|
||||||
new File("addons/BSkyBlock","config.yml").delete();
|
// Added the new files to the jar.
|
||||||
new File("addons/BSkyBlock").delete();
|
try (FileInputStream fis = new FileInputStream(path.toFile())) {
|
||||||
new File("addons").delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
byte[] buffer = new byte[1024];
|
||||||
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onLoad()}.
|
int bytesRead = 0;
|
||||||
*/
|
JarEntry entry = new JarEntry(path.toString());
|
||||||
@Test
|
tempJarOutputStream.putNextEntry(entry);
|
||||||
public void testOnLoad() {
|
while ((bytesRead = fis.read(buffer)) != -1) {
|
||||||
addon.onLoad();
|
tempJarOutputStream.write(buffer, 0, bytesRead);
|
||||||
// Check that config.yml file has been saved
|
}
|
||||||
File check = new File("addons/BSkyBlock","config.yml");
|
}
|
||||||
assertTrue(check.exists());
|
}
|
||||||
}
|
File dataFolder = new File("addons/BSkyBlock");
|
||||||
|
addon.setDataFolder(dataFolder);
|
||||||
|
addon.setFile(jFile);
|
||||||
|
AddonDescription desc = new AddonDescription.Builder("bentobox", "bskyblock", "1.3").description("test")
|
||||||
|
.authors("tasty").build();
|
||||||
|
addon.setDescription(desc);
|
||||||
|
// Addons manager
|
||||||
|
AddonsManager am = mock(AddonsManager.class);
|
||||||
|
when(plugin.getAddonsManager()).thenReturn(am);
|
||||||
|
|
||||||
/**
|
// Flags manager
|
||||||
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onEnable()}.
|
when(plugin.getFlagsManager()).thenReturn(fm);
|
||||||
*/
|
when(fm.getFlags()).thenReturn(Collections.emptyList());
|
||||||
@Test
|
|
||||||
public void testOnEnable() {
|
|
||||||
testOnLoad();
|
|
||||||
addon.onEnable();
|
|
||||||
assertTrue(addon.getPlayerCommand().isPresent());
|
|
||||||
assertTrue(addon.getAdminCommand().isPresent());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// Settings
|
||||||
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onReload()}.
|
when(plugin.getSettings()).thenReturn(settings);
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testOnReload() {
|
|
||||||
addon.onReload();
|
|
||||||
// Check that config.yml file has been saved
|
|
||||||
File check = new File("addons/BSkyBlock","config.yml");
|
|
||||||
assertTrue(check.exists());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
}
|
||||||
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#createWorlds()}.
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testCreateWorlds() {
|
|
||||||
addon.onLoad();
|
|
||||||
addon.createWorlds();
|
|
||||||
Mockito.verify(plugin).log("[bskyblock] Creating BSkyBlock world ...");
|
|
||||||
Mockito.verify(plugin).log("[bskyblock] Creating BSkyBlock's Nether...");
|
|
||||||
Mockito.verify(plugin).log("[bskyblock] Creating BSkyBlock's End World...");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#getSettings()}.
|
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onLoad()}.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetSettings() {
|
public void testOnLoad() {
|
||||||
addon.onLoad();
|
addon.onLoad();
|
||||||
assertNotNull(addon.getSettings());
|
// Check that config.yml file has been saved
|
||||||
}
|
File check = new File("addons/BSkyBlock", "config.yml");
|
||||||
|
assertTrue(check.exists());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#getWorldSettings()}.
|
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onEnable()}.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetWorldSettings() {
|
public void testOnEnable() {
|
||||||
addon.onLoad();
|
testOnLoad();
|
||||||
assertEquals(addon.getSettings(), addon.getWorldSettings());
|
addon.onEnable();
|
||||||
}
|
assertTrue(addon.getPlayerCommand().isPresent());
|
||||||
|
assertTrue(addon.getAdminCommand().isPresent());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#getDefaultWorldGenerator(java.lang.String, java.lang.String)}.
|
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onReload()}.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetDefaultWorldGeneratorStringString() {
|
public void testOnReload() {
|
||||||
assertNull(addon.getDefaultWorldGenerator("", ""));
|
addon.onReload();
|
||||||
addon.onLoad();
|
// Check that config.yml file has been saved
|
||||||
addon.createWorlds();
|
File check = new File("addons/BSkyBlock", "config.yml");
|
||||||
assertNotNull(addon.getDefaultWorldGenerator("", ""));
|
assertTrue(check.exists());
|
||||||
assertTrue(addon.getDefaultWorldGenerator("", "") instanceof ChunkGeneratorWorld);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#createWorlds()}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCreateWorlds() {
|
||||||
|
addon.onLoad();
|
||||||
|
addon.createWorlds();
|
||||||
|
Mockito.verify(plugin).log("[bskyblock] Creating BSkyBlock world ...");
|
||||||
|
Mockito.verify(plugin).log("[bskyblock] Creating BSkyBlock's Nether...");
|
||||||
|
Mockito.verify(plugin).log("[bskyblock] Creating BSkyBlock's End World...");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#getSettings()}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetSettings() {
|
||||||
|
addon.onLoad();
|
||||||
|
assertNotNull(addon.getSettings());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test method for
|
||||||
|
* {@link world.bentobox.bskyblock.BSkyBlock#getWorldSettings()}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetWorldSettings() {
|
||||||
|
addon.onLoad();
|
||||||
|
assertEquals(addon.getSettings(), addon.getWorldSettings());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test method for
|
||||||
|
* {@link world.bentobox.bskyblock.BSkyBlock#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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class IslandAboutCommandTest {
|
||||||
User user = mock(User.class);
|
User user = mock(User.class);
|
||||||
c.execute(user, "", Collections.emptyList());
|
c.execute(user, "", Collections.emptyList());
|
||||||
// Verify
|
// Verify
|
||||||
Mockito.verify(user).sendRawMessage(Mockito.eq("Copyright (c) 2017 - 2020 tastybento, Poslovitch"));
|
Mockito.verify(user).sendRawMessage(Mockito.eq("Copyright (c) 2017 - 2022 tastybento, Poslovitch"));
|
||||||
Mockito.verify(user).sendRawMessage(Mockito.eq("About BSkyBlock 1.2.3:"));
|
Mockito.verify(user).sendRawMessage(Mockito.eq("About BSkyBlock 1.2.3:"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue