Compare commits

...

95 Commits

Author SHA1 Message Date
tastybento d272873410 Enable team members to have islands - requires Bentobox 2.3.0 2024-04-06 09:32:06 -07:00
tastybento 706178d3d5 Fix for L-Shaped island mis-naming 2024-01-20 17:11:25 -08:00
tastybento 72274c0174 Version 1.17.1 2024-01-20 17:11:09 -08:00
tastybento e532e5fad5 Version 1.17.0 2024-01-20 08:32:06 -08:00
tastybento 935884c94d Merge branch 'develop' 2024-01-20 08:31:21 -08:00
tastybento afa1ae028f
Release 1.17.0 (#510)
* Translate fr.yml via GitLocalize (#501)

Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>

* Update Github Action build script

* Added distribution required for Github Action

* Update perms list

* Fix deprecation code for setting world settings

* Fix duplicate permission listing

* Fix typo

* Updated POM version numbers

* Update Jacoco

* Update pom.xml

* Add Modrinth publish workflow for GitHub Actions

* Fix syntax

* Syntax

* GitHub Action test

* More Action

* Update to BentoBox 2.0.0 API

* Updated island blueprints to 1.20.4

Grass was missing.

* Fix tests

---------

Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
2024-01-20 08:26:59 -08:00
tastybento 9599935527
Release 1.17.0 (#509)
* Translate fr.yml via GitLocalize (#501)

Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>

* Update Github Action build script

* Added distribution required for Github Action

* Update perms list

* Fix deprecation code for setting world settings

* Fix duplicate permission listing

* Fix typo

* Updated POM version numbers

* Update Jacoco

* Update pom.xml

* Add Modrinth publish workflow for GitHub Actions

* Fix syntax

* Syntax

* GitHub Action test

* More Action

* Update to BentoBox 2.0.0 API

* Updated island blueprints to 1.20.4

Grass was missing.

* Fix tests

---------

Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
2024-01-20 08:21:35 -08:00
tastybento bc19f352e5 Fix tests 2024-01-13 08:05:30 -08:00
tastybento 32251d4e48 Updated island blueprints to 1.20.4
Grass was missing.
2023-12-10 09:52:42 -08:00
tastybento 25fba16138 Update to BentoBox 2.0.0 API 2023-11-12 12:35:38 -08:00
tastybento 246a4d4185 More Action 2023-08-06 12:26:19 -07:00
tastybento d066e58b32 GitHub Action test 2023-08-06 12:23:49 -07:00
tastybento 24b963fa9c Syntax 2023-08-06 12:20:48 -07:00
tastybento d47493c906 Fix syntax 2023-08-06 12:17:53 -07:00
tastybento 5cde5b624b Merge branch 'develop' of https://github.com/BentoBoxWorld/BSkyBlock.git into develop 2023-08-06 12:14:22 -07:00
tastybento 01e6f9263b Add Modrinth publish workflow for GitHub Actions 2023-08-06 12:14:14 -07:00
tastybento 44d8e1ce39
Update pom.xml 2023-07-10 21:35:51 -07:00
tastybento 0e0c0b24f2 Update Jacoco 2023-07-10 21:21:52 -07:00
tastybento 6cbf4eee77 Updated POM version numbers 2023-07-04 17:10:52 -07:00
tastybento 6c91835e8f Fix typo 2023-07-04 17:06:38 -07:00
tastybento ffd5e9fcd5 Fix duplicate permission listing 2023-07-04 17:06:15 -07:00
tastybento 7a67d2b7f6 Fix deprecation code for setting world settings 2023-07-04 17:05:44 -07:00
tastybento 98d3a55c50 Merge branch 'develop' of https://github.com/BentoBoxWorld/BSkyBlock.git into develop 2023-07-03 08:38:25 -07:00
tastybento cefefefa93 Update perms list 2023-07-03 08:38:15 -07:00
tastybento 48967eff87 Added distribution required for Github Action 2023-06-24 13:55:14 -07:00
tastybento 27e67fb123 Merge branch 'develop' of https://github.com/BentoBoxWorld/BSkyBlock.git into develop 2023-06-24 13:01:04 -07:00
tastybento 8a97bca2a0 Update Github Action build script 2023-06-24 13:00:57 -07:00
gitlocalize-app[bot] 036d7934d8
Translate fr.yml via GitLocalize (#501)
Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
2023-05-29 09:47:35 -07:00
BONNe 844996fe3a Downgrade to 1.16.1 2023-04-15 23:31:59 +03:00
BONNe f44c6fa2a8 Merge branch 'develop' into master 2023-04-15 23:31:26 +03:00
tastybento e88ee17d1c Updated dependencies 2023-04-15 11:30:36 -07:00
BONNe 41414ccb26
Merge pull request #498 from BentoBoxWorld/return-to-plugin
Return to plugin.yml
2023-04-08 19:04:24 +03:00
BONNe 0efc1af21f
Update BSkyBlockPladdon.java 2023-04-08 19:04:16 +03:00
BONNe 92b7366159
Update pom.xml 2023-04-08 19:04:01 +03:00
BONNe f341e05ba4
Create plugin.yml 2023-04-08 19:03:31 +03:00
tastybento 55e7732b82
Update README.md 2023-03-25 18:28:20 -07:00
tastybento dee662b4b6
Update README.md
Update flags from SonarCloud
2023-03-25 18:24:59 -07:00
tastybento 12092cb89f Remove dependency 2023-03-25 09:53:30 -07:00
tastybento 9d4d671168 Switch to use annotations for plugin.yml 2023-03-25 09:46:28 -07:00
tastybento 7e7512549c Updated plugin.yml to have name of addon to make it unique 2023-03-25 09:12:35 -07:00
blombergs5 11201c7758
Update README.md (#493)
added link to releases page
2023-02-12 10:37:16 -08:00
tastybento 86d6eb1da6 Update script to Java 17 2023-02-09 17:02:42 -08:00
tastybento 300a80b3e3 Update compiler maven plugin version 2023-02-09 16:59:59 -08:00
tastybento 352ec8d5b2 Fix Jacoco POM entry to enable code scanning 2023-02-09 16:55:44 -08:00
tastybento 20e2ee1e22
Add ${argLine} to get jacoco coverage 2023-02-09 15:08:31 -08:00
BONNe e1a7ed4e77
Merge pull request #487 from BentoBoxWorld/gitlocalize-21678
Update FR
2022-10-31 08:44:13 +02:00
gitlocalize-app[bot] 9c4e4bd15e
Translate fr.yml via GitLocalize 2022-10-31 06:44:04 +00:00
BONNe c2e1fcc91b
Merge pull request #484 from BentoBoxWorld/gitlocalize-21660
Update DE
2022-10-31 08:27:39 +02:00
BONNe 49b81ef81a
Merge pull request #485 from BentoBoxWorld/gitlocalize-21661
Update FR
2022-10-31 08:27:33 +02:00
BONNe 0cdc9c5b65
Merge pull request #486 from BentoBoxWorld/gitlocalize-21662
Update RU
2022-10-31 08:27:27 +02:00
Andrew 04cfa79452 Translate ru.yml via GitLocalize 2022-10-31 06:13:37 +00:00
gitlocalize-app[bot] 5cfbc8f046
Translate fr.yml via GitLocalize 2022-10-31 06:13:23 +00:00
DahliaSR 2238e04709 Translate de.yml via GitLocalize 2022-10-31 06:13:03 +00:00
BONNe fe780a94cd Fix failing unit-test 2022-10-04 15:00:40 +03:00
BONNe 66a37da076 Init next BSkyBlock version 2022-10-04 14:59:54 +03:00
BONNe e20fc256da Update workflow to Java 17 2022-10-04 14:55:05 +03:00
BONNe 44bf473803 Merge remote-tracking branch 'origin/develop' into master
# Conflicts:
#	pom.xml
#	src/main/resources/addon.yml
2022-10-04 14:54:19 +03:00
BONNe c79f7e209b Update to BentoBox 1.21 2022-10-04 14:52:40 +03:00
BONNe 03ff0e9cbd
Update ro.yml (#465)
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1930
2022-02-11 18:07:45 -08:00
gitlocalize-app[bot] 21eacb025d
Translate tr.yml via GitLocalize (#459)
Co-authored-by: trafoziya <omerziyaakay@gmail.com>
2022-01-01 16:54:32 -08:00
gitlocalize-app[bot] 5b73578dee
Romanian translation (#458)
* Translate ro.yml via GitLocalize

* Translate ro.yml via GitLocalize

Co-authored-by: Adi <hlobaadrian@gmail.com>
Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
2022-01-01 16:54:16 -08:00
gitlocalize-app[bot] d666179f15
Vietnamese translation (#457)
* Translate vi.yml via GitLocalize

* Translate vi.yml via GitLocalize

Co-authored-by: Nguyen Minh An <minh.annguyen264@gmail.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
2022-01-01 16:54:07 -08:00
gitlocalize-app[bot] 048232cf5d
German Translation (#456)
* Translate de.yml via GitLocalize

* Translate de.yml via GitLocalize

Co-authored-by: SrAcosta <gerardo.gomez.acosta@gmail.com>
Co-authored-by: mt-gitlocalize <mt@gitlocalize.com>
2022-01-01 16:53:50 -08:00
gitlocalize-app[bot] 4ebc7a255c
Translate zh-CN.yml via GitLocalize (#455)
Co-authored-by: MinghuaChiyuan <tianxianshe@outlook.com>
2022-01-01 16:53:40 -08:00
gitlocalize-app[bot] 10a5d137ae
Translate pt.yml via GitLocalize (#454)
Co-authored-by: Ricardo Borsato <ricardoborrb@gmail.com>
2022-01-01 16:53:18 -08:00
gitlocalize-app[bot] 2bc72df3d4
Translate fr.yml via GitLocalize (#453)
Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
2022-01-01 16:52:54 -08:00
tastybento 2794465a9d Back support for BentoBox 1.16.5. 2021-10-04 23:01:43 -07:00
tastybento 58966eade8 Build against BentoBox 1.18 API 2021-10-01 17:46:05 -07:00
tastybento 6d3aab0762
Release 1.15.2 (#441)
* Version 1.15.1

* Remove unused comments.

* Reference correct BentoBox API

* Remove sonar plugin. Now use Github actions.

* Change plugin name to Pladdon

* Add informative messages to the options. (#440)

`create-and-link-portals` works only if allow-nether is enabled.
`create-obsidian-platform` works only if allow-end is enabled.

* Allow BentoBox 1.16.5 version

* Version 1.15.2

Co-authored-by: BONNe <bonne@bonne.id.lv>
2021-09-17 07:44:20 -07:00
tastybento b81342ef5e
Merge branch 'master' into develop 2021-09-17 07:43:17 -07:00
tastybento 113ee71736 Version 1.15.2 2021-09-17 07:40:26 -07:00
tastybento 0296fe2301 Merge branch 'develop' of https://github.com/BentoBoxWorld/BSkyBlock.git into develop 2021-09-17 07:38:08 -07:00
tastybento 4243416ca6 Allow BentoBox 1.16.5 version 2021-09-17 07:37:57 -07:00
BONNe 46c38d9b5b
Add informative messages to the options. (#440)
`create-and-link-portals` works only if allow-nether is enabled.
`create-obsidian-platform` works only if allow-end is enabled.
2021-08-19 15:45:26 -07:00
tastybento d1bfbe5e78 Change plugin name to Pladdon 2021-08-12 18:37:52 -07:00
tastybento e8047b5868
Release 1.15.1 (#437)
* Version 1.15.1

* Remove unused comments.

* Reference correct BentoBox API

* Remove sonar plugin. Now use Github actions.
2021-07-25 10:53:23 -07:00
tastybento e95255b190 Remove sonar plugin. Now use Github actions. 2021-07-25 10:22:13 -07:00
tastybento c5316c70c5 Reference correct BentoBox API 2021-07-25 10:21:26 -07:00
tastybento 2586013b9a Remove unused comments. 2021-07-25 10:21:17 -07:00
tastybento 48e731d7db Version 1.15.1 2021-07-03 15:34:37 -07:00
tastybento 52e1ee4c78 Use BentoBox 1.17.0 2021-06-27 17:08:25 -07:00
tastybento 02633a2b60 Fix icon for L-shaped island blueprint 2021-06-20 17:28:44 -07:00
tastybento 55f27390a9
Java 16 (#428)
* Java 16 update

* Updated maven versions

* Java 11

* Java 16 build
2021-06-20 10:28:28 -07:00
tastybento 9707d98eb8 Make variables final. 2021-05-31 16:08:23 -07:00
tastybento 33a34aab44 Rename pladdon class 2021-05-31 16:06:52 -07:00
tastybento a388f806cb Version 1.15.0 2021-05-31 15:27:34 -07:00
BONNe 045d81aac6
Fix 2 warnings for Pladdon loading. (#421) 2021-05-31 08:26:07 -07:00
tastybento 4dac6515f2 Pladdon version 2021-05-30 18:43:15 -07:00
tastybento c06c089429 Register with BentoBox as an Addon 2021-05-30 08:53:59 -07:00
tastybento 2c299b4a88 New flags were not being included in the config.
https://github.com/BentoBoxWorld/BSkyBlock/issues/401
2021-04-25 11:09:36 -07:00
tastybento e1b150934f Merge branch 'develop' of https://github.com/BentoBoxWorld/BSkyBlock.git into develop 2021-04-25 10:13:15 -07:00
tastybento 316d5eb33e Updated README 2021-04-25 10:13:05 -07:00
Dark_Ville c16ed5089f
Created Dutch (Nederlands) Local File (#413)
* Created Dutch (Nederlands) Local Files

* Rename nl to nl.yml
2021-04-24 10:11:48 -07:00
tastybento 6a0ace8a1a Add permission bskyblock.island.homes for new homes command. 2021-04-07 21:36:14 -07:00
tastybento 32ccd0cbb5 Version 1.14.5 2021-03-21 16:17:51 -07:00
31 changed files with 808 additions and 479 deletions

1
.github/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.DS_Store

View File

@ -11,21 +11,22 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

15
.github/workflows/modrinth.yml vendored Normal file
View File

@ -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 }}

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/target/
/.classpath
/.DS_Store
/.project
/addon-bskyblock.iml

View File

@ -1,22 +1,25 @@
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)
[![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)
[![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)
[![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)
[![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)
# BSkyBlock
# NOTE
BSkyBlock requires BentoBox, so to run BSkyBlock, you must have BentoBox installed and place BSkyBlock in BentoBox's addon folder.
[![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=BentoBoxWorld_BSkyBlock&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
[![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=BentoBoxWorld_BSkyBlock&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
[![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=BentoBoxWorld_BSkyBlock&metric=bugs)](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
<img width="509" alt="BSkyBlock" src="https://user-images.githubusercontent.com/4407265/227750292-5617537d-c99a-4a7e-864e-5de990b8c195.png">
## About
BSkyBlock provides a skyblock-type Minecraft game for players that supports a default set of 3 islands (overworld, nether and end), protection of islands, team and coop play and other features. Please 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
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.
4. The addon will create worlds and a data folder and inside the folder will be a config.yml.
5. Stop the server .
@ -24,17 +27,6 @@ BSkyBlock provides a skyblock-type Minecraft game for players that supports a de
7. Delete any worlds that were created by default if you made changes that would affect them.
8. Restart the server.
## Config.yml
The config.yml is similar to ASkyBlock but *not the same*. Note that distance between islands and protection range are **radius values** so the island size will be twice these values in blocks! Also, the distance between islands will be set automatically to a chunk boundary (a multiple of 16 blocks).
### Other Add-ons
BSkyBlock is an add-on that uses the BentoBox API. Here are some other ones that you may be interested in:
* [**Addons**](https://github.com/BentoBoxWorld/BentoBox/blob/develop/ADDON.md)
Bugs and Feature requests
=========================
File bug and feature requests here: https://github.com/BentoBoxWorld/BSkyBlock/issues

97
pom.xml
View File

@ -54,18 +54,18 @@
<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.2</powermock.version>
<powermock.version>2.0.9</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.16.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.16.1</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.4</build.version>
<build.version>1.18.0</build.version>
<!-- Sonar Cloud -->
<sonar.projectKey>BentoBoxWorld_BSkyBlock</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
@ -112,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>tastybento-github</sonar.organization>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.1.1168</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
@ -165,7 +141,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>
@ -243,16 +219,48 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.8.1</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.1.2</version>
<!--suppress MavenModelInspection -->
<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>
@ -262,15 +270,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.0</version>
<configuration>
<show>public</show>
<failOnError>false</failOnError>
<additionalJOption>-Xdoclint:none</additionalJOption>
<!-- To compile with Java 11, this tag may be required -->
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
@ -303,31 +313,38 @@
<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>

View File

@ -2,6 +2,7 @@ package world.bentobox.bskyblock;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.entity.SpawnCategory;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.event.Listener;
@ -29,7 +30,7 @@ public class BSkyBlock extends GameModeAddon implements Listener {
// Settings
private Settings settings;
private ChunkGeneratorWorld chunkGenerator;
private Config<Settings> configObject = new Config<>(this, Settings.class);
private final Config<Settings> configObject = new Config<>(this, Settings.class);
@Override
public void onLoad() {
@ -129,24 +130,25 @@ public class BSkyBlock extends GameModeAddon implements Listener {
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) {
// Set spawn rates
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;
@ -175,8 +177,7 @@ public class BSkyBlock extends GameModeAddon implements Listener {
*/
@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();
}

View File

@ -0,0 +1,14 @@
package world.bentobox.bskyblock;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.addons.Pladdon;
public class BSkyBlockPladdon extends Pladdon {
@Override
public Addon getAddon() {
return new BSkyBlock();
}
}

View File

@ -1,44 +0,0 @@
package world.bentobox.bskyblock;
import java.io.File;
import java.io.IOException;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.io.Files;
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
public class CopyToBentoBox extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onBentoBoxReady(BentoBoxReadyEvent e) {
getLogger().severe("BSkyBlock.jar must be in the BentoBox/addons folder! Trying to move it there...");
File addons = new File(getFile().getParent(), "BentoBox/addons");
if (addons.exists()) {
File to = new File(addons, getFile().getName());
if (!to.exists()) {
try {
Files.move(getFile(), to);
getLogger().severe(getFile().getName() + " moved successfully. Restart server now to activate!");
} catch (IOException ex) {
getLogger().severe("Failed to move it. " + ex.getMessage());
getLogger().severe("Move " + getFile().getName() + " manually into the BentoBox/addons folder. Then restart server.");
}
}
} else {
getLogger().severe("BentoBox folders do not exist! " + addons.getAbsolutePath());
}
}
}

View File

@ -1,11 +1,6 @@
package world.bentobox.bskyblock;
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;
@ -21,8 +16,7 @@ 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.FlagBooleanSerializer;
/**
* All the plugin settings are here
@ -122,6 +116,10 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "world.island-height")
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("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.")
@ -191,6 +189,7 @@ public class Settings implements WorldSettings {
@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.")
@ConfigComment("This option requires `allow-nether=true` in server.properties.")
@ConfigEntry(path = "world.nether.create-and-link-portals", since = "1.14.4")
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("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")
private boolean makeEndPortals = false;
@ -230,13 +230,12 @@ public class Settings implements WorldSettings {
@ConfigComment(" SUB-OWNER = 900")
@ConfigComment(" 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")
@ -688,22 +687,57 @@ public class Settings implements WorldSettings {
return worldFlags;
}
/**
* @return the defaultIslandFlags
* @deprecated since 1.21
*/
@Override
public Map<Flag, Integer> getDefaultIslandFlags() {
return defaultIslandFlags;
public Map<Flag, Integer> getDefaultIslandFlags()
{
return Collections.emptyMap();
}
/**
* @return the defaultIslandSettings
* @deprecated since 1.21
*/
@Override
public Map<Flag, Integer> getDefaultIslandSettings() {
return defaultIslandSettings;
public Map<Flag, Integer> getDefaultIslandSettings()
{
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
*/
@ -1095,20 +1129,29 @@ public class Settings implements WorldSettings {
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) {
this.defaultIslandSettings = defaultIslandSettings;
public void setDefaultIslandFlagNames(Map<String, Integer> defaultIslandFlagNames)
{
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
*/
@ -1777,4 +1820,18 @@ public class Settings implements WorldSettings {
public void setMakeEndPortals(boolean 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;
}
}

View File

@ -23,7 +23,7 @@ public class IslandAboutCommand extends CompositeCommand {
@Override
public boolean execute(User user, String label, List<String> args) {
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("for license information.");
return true;

View File

@ -25,7 +25,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
private final BSkyBlock addon;
private final Random rand = new Random();
private Map<Vector, Material> roofChunk = new HashMap<>();
private final Map<Vector, Material> roofChunk = new HashMap<>();
/**
* @param addon - addon
@ -39,7 +39,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
public ChunkData generateChunks(World world) {
ChunkData result = createChunkData(world);
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()) {
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();
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) {
for (int y = world.getMinHeight(); y < world.getMaxHeight(); y+=4) {
biomeGrid.setBiome(x, y, z, biome);
}
}
@ -122,7 +122,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
}
break;
case 2:
// Stalatite
// Stalactite
for (int i = 0; i < rand.nextInt(10); i++) {
setBlock(x, - 8 - i, z, Material.GLOWSTONE);
}

View File

@ -1,92 +1,21 @@
name: BSkyBlock
main: world.bentobox.bskyblock.BSkyBlock
version: ${version}${build.number}
api-version: 1.14
api-version: 1.21.0
metrics: true
icon: "OAK_SAPLING"
repository: "BentoBoxWorld/BSkyBlock"
authors: tastybento
permissions:
bskyblock.island:
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.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
permissions:
# Non-command permissions
bskyblock.island.lock:
description: Allows island locking
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
description: Allows island locking in settings
default: true
bskyblock.settings.*:
description: Allow use of settings on island
default: true
bskyblock.mod.info:
description: Let a moderator see info on a player
default: op
bskyblock.mod.clearreset:
description: Allow clearing of island reset limit
default: false
@ -102,47 +31,14 @@ permissions:
bskyblock.mod.bypassexpel:
description: Allow moderator to bypass island expulsion
default: op
bskyblock.mod.switch:
description: Allows moderator to switch bypass protection on and off
default: op
bskyblock.mod.lock:
description: Locks or unlocks an island
description: Allows lock or unlock of an island
default: op
bskyblock.mod.bypasslock:
description: Bypasses an island lock
default: op
bskyblock.mod.bypassban:
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
bskyblock.admin.noban:
description: Player cannot be banned from an island
@ -150,13 +46,250 @@ permissions:
bskyblock.admin.noexpel:
description: Player cannot be expelled from an island
default: op
bskyblock.admin.setlanguage:
description: Resets all player languages and sets the default language
default: op
# Command permissions
bskyblock.island:
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:
description: Get a player's rank
default: op
description: Allow use of '/bsbadmin getrank' command - get a player's rank on their island or the island of the owner
default: OP
bskyblock.admin.setrank:
description: Set a player's rank
default: op
description: Allow use of '/bsbadmin setrank' command - set a player's rank on their island or the island of the owner
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

View File

@ -1,6 +1,6 @@
{
"uniqueId": "classic-island",
"icon": "GRASS_PATH",
"icon": "DIRT_PATH",
"displayName": "&bClassic L Island",
"description": [
"&2The Classic &6L-Shaped",
@ -9,7 +9,7 @@
],
"requirePermission": false,
"blueprints": {
"NORMAL": "classic-lshape",
"NORMAL": "l-shaped",
"NETHER": "nether-island",
"THE_END": "end-island"
},

Binary file not shown.

View File

@ -69,7 +69,7 @@ world:
offset-z: 0
# Island height - Lowest is 5.
# It is the y coordinate of the bedrock block in the schem.
island-height: 120
island-height: 80
# Use your own world generator for this world.
# In this case, the plugin will not generate anything.
# If used, you must specify the world name and generator in the bukkit.yml file.
@ -117,8 +117,10 @@ world:
# 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 other dimension.
# Added since 1.14.4
# Option will simulate vanilla portal mechanics that links portals together
# 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.
create-and-link-portals: false
end:
# End Nether - if this is false, the end world will not be made and access to
@ -127,36 +129,47 @@ world:
# Islands in The End. Change to false for standard vanilla end.
# /!\ 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.
islands: true
# This option indicates if obsidian platform in the end should be generated when player enters the end world.
# Added since 1.14.4
# This option indicates if obsidian platform in the end should be generated
# when player enters the end world.
# This option requires `allow-end=true` in bukkit.yml.
# Added since 1.14.4.
create-obsidian-platform: false
# /!\ This feature is experimental and might not work as expected or might not work at all.
dragon-spawn: false
# Mob white list - these mobs will NOT be removed when logging in or doing /island
remove-mobs-whitelist:
- ZOMBIE_VILLAGER
- WITHER
- ZOMBIE_VILLAGER
- ENDERMAN
# World flags. These are boolean settings for various flags for this world
flags:
CREEPER_DAMAGE: true
OBSIDIAN_SCOOPING: true
PISTON_PUSH: false
ISLAND_RESPAWN: true
CREEPER_GRIEFING: false
PETS_STAY_AT_HOME: true
NATURAL_SPAWNING_OUTSIDE_RANGE: true
LIQUIDS_FLOWING_OUT: false
REMOVE_MOBS: false
ENDER_CHEST: false
TREES_GROWING_OUTSIDE_RANGE: false
WITHER_DAMAGE: false
BIOMES_WORLD_PROTECTION: true
PISTON_PUSH: false
COARSE_DIRT_TILLING: true
ENDERMAN_GRIEFING: true
CLEAN_SUPER_FLAT: false
CHEST_DAMAGE: false
CHALLENGES_WORLD_PROTECTION: true
PREVENT_TELEPORT_WHEN_FALLING: false
NATURAL_SPAWNING_OUTSIDE_RANGE: true
WORLD_TNT_DAMAGE: false
ENTER_EXIT_MESSAGES: true
ENDERMAN_DEATH_DROP: true
OFFLINE_REDSTONE: true
REMOVE_END_EXIT_ISLAND: true
REMOVE_MOBS: true
ENDER_CHEST: false
OFFLINE_GROWTH: true
ITEM_FRAME_DAMAGE: false
TREES_GROWING_OUTSIDE_RANGE: false
SPAWNER_SPAWN_EGGS: 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 the following:
@ -168,55 +181,69 @@ world:
# OWNER = 1000
default-island-flags:
HURT_ANIMALS: 500
DRAGON_EGG: 500
REDSTONE: 500
BUCKET: 500
LOCK: 0
ENDER_PEARL: 500
DOOR: 500
BREAK_HOPPERS: 500
FURNACE: 500
MINECART: 500
ANVIL: 500
FISH_SCOOPING: 500
END_PORTAL: 500
BREEDING: 500
HURT_VILLAGERS: 500
FROST_WALKER: 500
TURTLE_EGGS: 500
FROST_WALKER: 500
COLLECT_LAVA: 500
BREAK_SPAWNERS: 500
LEVER: 500
ELYTRA: 0
HURT_MONSTERS: 0
RIDING: 500
ARMOR_STAND: 500
CAKE: 500
NAME_TAG: 500
ARMOR_STAND: 500
TRADING: 0
EGGS: 500
ITEM_DROP: 0
NOTE_BLOCK: 0
FLINT_AND_STEEL: 500
NETHER_PORTAL: 500
LECTERN: 500
ITEM_PICKUP: 0
CROP_TRAMPLE: 500
BREWING: 500
DROPPER: 500
BREWING: 500
TNT_PRIMING: 500
COLLECT_WATER: 500
BUTTON: 500
FIRE_EXTINGUISH: 500
COMMAND_RANKS: 500
BEACON: 500
TRAPDOOR: 500
EXPERIENCE_BOTTLE_THROWING: 500
PRESSURE_PLATE: 0
HIVE: 500
DYE: 500
PLACE_BLOCKS: 500
ITEM_FRAME: 500
CRAFTING: 0
ENCHANTING: 0
SHEARING: 500
SPAWN_EGGS: 500
BOAT: 500
BED: 500
SPAWN_EGGS: 500
MILKING: 0
DISPENSER: 500
GATE: 0
EXPERIENCE_PICKUP: 500
HOPPER: 500
LEASH: 500
BREAK_BLOCKS: 500
MOUNT_INVENTORY: 500
BREAK_BLOCKS: 500
CHORUS_FRUIT: 500
CONTAINER: 500
POTION_THROWING: 500
@ -225,12 +252,44 @@ world:
default-island-settings:
PVP_END: false
PVP_NETHER: false
LEAF_DECAY: true
TNT_DAMAGE: true
MONSTER_SPAWNERS_SPAWN: true
ANIMAL_NATURAL_SPAWN: true
MONSTER_NATURAL_SPAWN: true
FIRE_IGNITE: true
FIRE_SPREAD: true
ANIMAL_SPAWNERS_SPAWN: true
FIRE_BURNING: true
PVP_OVERWORLD: false
# These settings/flags are hidden from users
# Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings
# Added since 1.4.1.
hidden-flags: []
hidden-flags:
- CHEST_DAMAGE
- HURT_MONSTERS
- BREAK_SPAWNERS
- DISPENSER
- DRAGON_EGG
- DROPPER
- EXPERIENCE_BOTTLE_THROWING
- HURT_VILLAGERS
- MOUNT_INVENTORY
- NOTE_BLOCK
- TURTLE_EGGS
- PVP_END
- FIRE_BURNING
- FIRE_IGNITE
- FIRE_SPREAD
- PVP_NETHER
- PVP_OVERWORLD
- TNT_DAMAGE
- MONSTER_NATURAL_SPAWN
- MONSTER_SPAWNERS_SPAWN
- ANIMAL_SPAWNERS_SPAWN
- ANIMAL_NATURAL_SPAWN
- LEAF_DECAY
- BREAK_HOPPERS
# Visitor banned commands - Visitors to islands cannot use these commands in this world
visitor-banned-commands:
- spawner
@ -386,17 +445,17 @@ island:
# Note that player-executed commands might not work, as these commands can be run with said player being offline.
# Added since 1.8.0.
on-leave: []
# Returns a list of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.
# 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: []

View File

@ -0,0 +1,7 @@
---
bskyblock:
sign:
line0: "&cBSkyBlock"
line1: Herzlich Willkommen!
line2: "[name]"
line3: Fall nicht runter! &c<3

View File

@ -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:
sign:
line0: "&cBSkyBlock"
line1: "Bienvenue!"
line1: Bienvenue!
line2: "[name]"
line3: "Ne tombez pas ! &c<3"
line3: Ne tombez pas ! &c<3
meta:
authors:
- x9nico

View File

@ -0,0 +1,11 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
bskyblock:
sign:
line0: "&cBSkyBlock"
line1: "Welkom!"
line2: "[name]"
line3: "Val niet! &c<3"

View File

@ -1,6 +1,7 @@
---
bskyblock:
sign:
line0: "&cBSkyBlock"
line1: Bem vindo(a)!
line2: "[name]"
line3: Não caia! &c<3
line1: Bem vinda!

View File

@ -0,0 +1,8 @@
---
bskyblock:
sign:
line0: "&cBSkyBlock"
line1: "Bine ai venit!"
line2: "[name]"
line3: "Sa nu cazi! &c<3"

View File

@ -0,0 +1,7 @@
---
bskyblock:
sign:
line0: "&cBSkyBlock"
line1: Добро пожаловать!
line2: "[name]"
line3: Не падай! &c <3

View File

@ -0,0 +1,7 @@
---
bskyblock:
sign:
line0: "&cBSkyBlock"
line1: Hoş Geldin!
line2: "[name]"
line3: Aşağı Düşme! &c<3

View File

@ -0,0 +1,7 @@
---
bskyblock:
sign:
line0: "&cBSkyBlock"
line1: Chào mừng!
line2: "[Tên]"
line3: Đừng ngã xuống! &c<3

View File

@ -1,6 +1,7 @@
---
bskyblock:
sign:
line0: "&c空岛生存"
line1: "欢迎你来到这里!"
line1: 欢迎你来到这里!
line2: "[name]"
line3: "千万不要掉下去! &c<3"
line3: 千万不要掉下去! &c<3

View File

@ -1,6 +1,9 @@
name: BSkyBlock
main: world.bentobox.bskyblock.CopyToBentoBox
version: ${version}
description: A SkyBlock Plugin
author: tastybento
depend: [BentoBox]
name: BentoBox-BSkyBlock
main: world.bentobox.bskyblock.BSkyBlockPladdon
version: ${project.version}${build.number}
api-version: "1.19"
authors: [tastybento]
contributors: ["The BentoBoxWorld Community"]
website: https://bentobox.world
description: ${project.description}

View File

@ -4,20 +4,26 @@ 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.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;
@ -28,6 +34,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;
@ -43,6 +50,8 @@ 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;
@ -56,189 +65,215 @@ import world.bentobox.bskyblock.generators.ChunkGeneratorWorld;
*
*/
@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 {
@Mock
private User user;
@Mock
private IslandsManager im;
@Mock
private Island island;
@Mock
private User user;
@Mock
private IslandsManager im;
@Mock
private Island island;
private BSkyBlock addon;
@Mock
private BentoBox plugin;
@Mock
private FlagsManager fm;
@Mock
private Settings settings;
private BSkyBlock addon;
@Mock
private BentoBox plugin;
@Mock
private FlagsManager fm;
@Mock
private Settings settings;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
// Set up plugin
Whitebox.setInternalState(BentoBox.class, "instance", plugin);
when(plugin.getLogger()).thenReturn(Logger.getAnonymousLogger());
// Command manager
CommandsManager cm = mock(CommandsManager.class);
when(plugin.getCommandsManager()).thenReturn(cm);
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);
Server server = mock(Server.class);
when(Bukkit.getServer()).thenReturn(server);
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
/**
* @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);
// Addon
addon = new BSkyBlock();
File jFile = new File("addon.jar");
List<String> lines = Arrays.asList("# BSkyBlock 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())) {
// 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);
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/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);
// Island World Manager
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(plugin.getIWM()).thenReturn(iwm);
// Flags manager
when(plugin.getFlagsManager()).thenReturn(fm);
when(fm.getFlags()).thenReturn(Collections.emptyList());
// 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);
// Settings
when(plugin.getSettings()).thenReturn(settings);
// 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);
Server server = mock(Server.class);
when(Bukkit.getServer()).thenReturn(server);
when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger());
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
new File("addon.jar").delete();
new File("config.yml").delete();
new File("addons/BSkyBlock","config.yml").delete();
new File("addons/BSkyBlock").delete();
new File("addons").delete();
}
// Addon
addon = new BSkyBlock();
File jFile = new File("addon.jar");
List<String> lines = Arrays.asList("# BSkyBlock 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.bskyblock.BSkyBlock#onLoad()}.
*/
@Test
public void testOnLoad() {
addon.onLoad();
// Check that config.yml file has been saved
File check = new File("addons/BSkyBlock","config.yml");
assertTrue(check.exists());
}
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/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);
/**
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onEnable()}.
*/
@Test
public void testOnEnable() {
testOnLoad();
addon.onEnable();
assertTrue(addon.getPlayerCommand().isPresent());
assertTrue(addon.getAdminCommand().isPresent());
}
// Flags manager
when(plugin.getFlagsManager()).thenReturn(fm);
when(fm.getFlags()).thenReturn(Collections.emptyList());
/**
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onReload()}.
*/
@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());
}
// Settings
when(plugin.getSettings()).thenReturn(settings);
/**
* 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#onLoad()}.
*/
@Test
public void testOnLoad() {
addon.onLoad();
// 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
public void testGetWorldSettings() {
addon.onLoad();
assertEquals(addon.getSettings(), addon.getWorldSettings());
}
/**
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onEnable()}.
*/
@Test
public void testOnEnable() {
testOnLoad();
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
public void testGetDefaultWorldGeneratorStringString() {
assertNull(addon.getDefaultWorldGenerator("", ""));
addon.onLoad();
addon.createWorlds();
assertNotNull(addon.getDefaultWorldGenerator("", ""));
assertTrue(addon.getDefaultWorldGenerator("", "") instanceof ChunkGeneratorWorld);
}
/**
* Test method for {@link world.bentobox.bskyblock.BSkyBlock#onReload()}.
*/
@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
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);
}
}

View File

@ -1,6 +1,3 @@
/**
*
*/
package world.bentobox.bskyblock;
import static org.junit.Assert.assertEquals;

View File

@ -33,7 +33,7 @@ public class IslandAboutCommandTest {
User user = mock(User.class);
c.execute(user, "", Collections.emptyList());
// 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:"));
}