mirror of
https://github.com/BentoBoxWorld/BSkyBlock.git
synced 2024-11-21 11:35:13 +01:00
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>
This commit is contained in:
parent
844996fe3a
commit
9599935527
1
.github/.gitignore
vendored
Normal file
1
.github/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.DS_Store
|
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@ -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 17
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
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
15
.github/workflows/modrinth.yml
vendored
Normal 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 }}
|
11
pom.xml
11
pom.xml
@ -58,8 +58,8 @@
|
||||
<!-- Non-minecraft related dependencies -->
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.19.4-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>1.23.0</bentobox.version>
|
||||
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>2.0.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. -->
|
||||
@ -227,7 +227,8 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<version>3.1.2</version>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<configuration>
|
||||
<argLine>
|
||||
${argLine}
|
||||
@ -312,13 +313,15 @@
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.7</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>
|
||||
|
@ -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;
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -8,88 +8,14 @@ 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.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
|
||||
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
|
||||
@ -105,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
|
||||
@ -153,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
|
||||
|
Binary file not shown.
Binary file not shown.
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user