Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ A: It's whatever you want it to be!

## Installation

0. Install BentoBox and run it on the server at least once to create its data folders.
1. Place this jar in the addons folder of the BentoBox plugin.
2. Restart the server.
3. The addon will create worlds and a data folder and inside the folder will be a config.yml and config files in phases folder.
4. Stop the server.
5. Edit config.yml and the .yml config files how you want.
6. Delete any worlds that were created by default if you made changes that would affect them.
7. Restart the server.
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.
3. Restart the server.
4. The addon will create worlds and a data folder and inside the folder will be a config.yml and config files in phases folder.
5. Stop the server.
6. Edit config.yml and the .yml config files how you want.
7. Delete any worlds that were created by default if you made changes that would affect them.
8. Restart the server.

## Phase config files

Expand Down
40 changes: 25 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>21</java.version>
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.9</powermock.version>
<junit.version>5.10.2</junit.version>
<mockito.version>5.11.0</mockito.version>
<mock-bukkit.version>v1.21-SNAPSHOT</mock-bukkit.version>
<!-- More visible way how to change dependency versions -->
<bentobox.version>2.7.1-SNAPSHOT</bentobox.version>
<items-adder.version>4.0.10</items-adder.version>
Expand Down Expand Up @@ -183,24 +185,32 @@
<scope>provided</scope>
</dependency>
<!-- Mockito (Unit testing) -->
<!-- Mockito (Unit testing) This goes at the top to ensure the dependencies are accurate. -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<!-- BentoBox -->
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
Expand Down Expand Up @@ -290,7 +300,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.5.4</version>
<configuration>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/world/bentobox/aoneblock/AOneBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import world.bentobox.aoneblock.generators.ChunkGeneratorWorld;
import world.bentobox.aoneblock.listeners.BlockListener;
import world.bentobox.aoneblock.listeners.BlockProtect;
import world.bentobox.aoneblock.listeners.BossBarListener;
import world.bentobox.aoneblock.listeners.HoloListener;
import world.bentobox.aoneblock.listeners.InfoListener;
import world.bentobox.aoneblock.listeners.ItemsAdderListener;
import world.bentobox.aoneblock.listeners.JoinLeaveListener;
import world.bentobox.aoneblock.listeners.BossBarListener;
import world.bentobox.aoneblock.listeners.NoBlockHandler;
import world.bentobox.aoneblock.listeners.StartSafetyListener;
import world.bentobox.aoneblock.oneblocks.OneBlockCustomBlockCreator;
Expand Down Expand Up @@ -79,7 +79,7 @@ public class AOneBlock extends GameModeAddon {
.defaultSetting(false)
.build();
/** The listener for the boss bar */
private BossBarListener bossBar = new BossBarListener(this);
private final BossBarListener bossBar = new BossBarListener(this);
/**
* Flag to enable or disable the OneBlock boss bar.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private Optional<Island> getUsersIsland(User user) {
.filter(is -> user.getUniqueId().equals(is.getOwner())).toList();
if (ownedIslands.size() == 1) {
// Replace with the owned island
i = ownedIslands.get(0); // pick one
i = ownedIslands.getFirst(); // pick one
}
// Return what we have found
return Optional.ofNullable(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public boolean canExecute(User user, String label, List<String> args) {
}
if (args.isEmpty()) return true;
// Check phase
Optional<OneBlockPhase> opPhase = addon.getOneBlockManager().getPhase(args.get(0).toUpperCase());
Optional<OneBlockPhase> opPhase = addon.getOneBlockManager().getPhase(args.getFirst().toUpperCase());
if (opPhase.isEmpty()) {
user.sendMessage("aoneblock.commands.admin.setchest.unknown-phase");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public boolean execute(User user, String label, List<String> args) {
// Get target player
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.getFirst());
return false;
}
// Get their island
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package world.bentobox.aoneblock.commands.island;

import java.util.List;
import java.util.Objects;

import org.bukkit.Bukkit;
import org.bukkit.Material;
Expand Down Expand Up @@ -67,14 +68,10 @@ public boolean canExecute(User user, String label, List<String> args)
public boolean execute(User user, String label, List<String> args)
{
Island island = this.getIslands().getIsland(this.getWorld(), user);

if (island == null)
{
// Hmm, lost island so fast. Well, no, just idea null-pointer check bypass.
user.sendMessage("general.errors.no-island");
}
else if (Material.BEDROCK.equals(island.getCenter().getBlock().getType()) ||
Material.AIR.equals(island.getCenter().getBlock().getType()))
Objects.requireNonNull(island);

if (island.getCenter().getBlock().getType() == Material.BEDROCK ||
island.getCenter().getBlock().getType() == Material.AIR)
{
// Trigger manual block break event.
Bukkit.getServer().getPluginManager().callEvent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public boolean execute(User user, String label, List<String> args) {
}
// Get value
// Get new range
if (!Util.isInteger(args.get(0), true) || Integer.parseInt(args.get(0)) < 0) {
user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.get(0));
if (!Util.isInteger(args.getFirst(), true) || Integer.parseInt(args.getFirst()) < 0) {
user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.getFirst());
return false;
}
int count = Integer.parseInt(args.get(0));
int count = Integer.parseInt(args.getFirst());
// Check the value is lower than played so far
@NonNull
OneBlockIslands i = addon.getBlockListener().getIsland(island);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ public void onPlayerInteract(PlayerInteractEvent e) {
return;
}

if (block != null && block.getBlockData() instanceof Brushable bb) {
if (block.getBlockData() instanceof Brushable bb) {
int dusted = bb.getDusted() + 1;
if (dusted > bb.getMaximumDusted()) {
/// === Brushing is FINISHED! ===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public BossBarListener(AOneBlock addon) {
this.addon = addon;
}

private AOneBlock addon;
private final AOneBlock addon;

// Store a boss bar for each player (using their UUID)
private final Map<Island, BossBar> islandBossBars = new HashMap<>();
Expand Down Expand Up @@ -99,7 +99,7 @@ private void tryToShowActionBar(UUID uuid, Island island) {
}
// Default to showing action bar unless it is explicitly turned off
if (!user.getMetaData(AONEBLOCK_ACTIONBAR).map(MetaDataValue::asBoolean).orElse(true)) {
// Do not show a action bar
// Do not show an action bar
return;
}
// Get the progress
Expand Down Expand Up @@ -218,7 +218,7 @@ public void onJoin(PlayerJoinEvent e) {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onQuit(PlayerQuitEvent e) {
// Clean up boss bars
islandBossBars.values().stream().forEach(bb -> bb.removePlayer(e.getPlayer()));
islandBossBars.values().forEach(bb -> bb.removePlayer(e.getPlayer()));
islandBossBars.values().removeIf(bb -> bb.getPlayers().isEmpty());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import world.bentobox.aoneblock.AOneBlock;

/**
* Handles ItemsAdderLoadDataEvent which fired when ItemsAdder loaded it's data or reload it's data
* Handles ItemsAdderLoadDataEvent which fired when ItemsAdder loaded its data or reload its data
*
* @author Teenkung123
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public NavigableMap<Integer, OneBlockPhase> getBlockProbs() {
}

/**
* Get phase by name. Name should have any spaces converted to underscores. Case
* Get phase by name. Name should have any spaces converted to underscores. Case-
* insensitive.
*
* @param name - name to search
Expand Down Expand Up @@ -859,7 +859,7 @@ public void getProbs(OneBlockPhase phase) {
}

/**
* Get all the probs for each phases and log to console
* Get all the probs for each phase and log to console
*/
public void getAllProbs() {
blockProbs.values().forEach(this::getProbs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import world.bentobox.aoneblock.oneblocks.OneBlockPhase;
import world.bentobox.aoneblock.oneblocks.Requirement;
import world.bentobox.bank.Bank;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.panels.PanelItem;
Expand Down Expand Up @@ -429,7 +428,7 @@ private PanelItem createPhaseButton(ItemTemplateRecord template, Map.Entry<Integ
int wrapAt = 50; // Set default value
try {
// Attempt to parse the value from getTranslation
wrapAt = Integer.valueOf(user.getTranslation(REFERENCE + "wrap-at"));
wrapAt = Integer.parseInt(user.getTranslation(REFERENCE + "wrap-at"));

} catch (NumberFormatException e) {
// If parsing fails, keep default value of 40
Expand Down Expand Up @@ -575,7 +574,7 @@ private static String insertNewlines(String input, int interval) {
breakPoint = index + interval; // In case there are no spaces, break at exact interval
}

result.append(input.substring(index, breakPoint)).append('\n');
result.append(input, index, breakPoint).append('\n');
if (lastAmpIndex >= 0) {
// Append color code
result.append(ChatColor.COLOR_CHAR);
Expand Down
26 changes: 13 additions & 13 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ aoneblock:
admin: obadmin oneblockadmin oba
# The default action for new player command call.
# Sub-command of main player command that will be run on first player command call.
# By default it is sub-command 'create'.
# By default, it is sub-command 'create'.
new-player-action: create
# The default action for player command.
# Sub-command of main player command that will be run on each player command call.
# By default it is sub-command 'go'.
# By default, it is sub-command 'go'.
default-action: go
# The command label that shows current phase progress.
# By default it is 'count'.
# By default, it is 'count'.
count-command: count
# The command label that opens phases GUI.
# By default it is 'phases'.
# By default, it is 'phases'.
phases-command: phases
# The command label that allows to change island phase.
# By default it is 'setCount'.
# By default, it is 'setCount'.
set-count-command: setCount
# Enables the bossbar and its command to show progress.
# Added since 1.21.2.
bossbar: true
# The command label that toggles the progress bar.
# By default it is 'bossbar'.
# By default, it is 'bossbar'.
bossbar-command: bossbar
# Enables the action bar and its command to show progress.
# Added since 1.21.2.
actionbar: true
# The command label that toggles the action bar progress.
# By default it is 'actionbar'.
# By default, it is 'actionbar'.
# Added since 1.21.2.
actionbar-command: actionbar
# How long a player must wait until they can use the setCount command again. In minutes.
# This is the command that is run from the phases panel.
set-count-cooldown: 5
# The command label that allows to check if magic block is present and respawns it if not.
# By default it is 'respawnBlock check'.
# By default, it is 'respawnBlock check'.
respawn-block-command: respawnBlock check
placeholders:
# Placeholder customization
Expand Down Expand Up @@ -73,7 +73,7 @@ world:
click-type: LEFT
# Size of particles. Default is 0.5. Must be greater than 0.
particle-size: 0.5
# Density of particles - Value from 0.1 to 1. Default is 0.65. Smaller values are more dense, higher are less.
# Density of particles - Value from 0.1 to 1. Default is 0.65. Smaller values are denser, higher are less.
particle-density: 0.65
# Color of particles
particle-color:
Expand Down Expand Up @@ -132,7 +132,7 @@ world:
# If used, you must specify the world name and generator in the bukkit.yml file.
# See https://bukkit.gamepedia.com/Bukkit.yml#.2AOPTIONAL.2A_worlds
use-own-generator: false
# Sea height (don't changes this mid-game unless you delete the world)
# Sea height (don't change this mid-game unless you delete the world)
# Minimum is 0
# If sea height is less than about 10, then players will drop right through it
# if it exists.
Expand All @@ -159,7 +159,7 @@ world:
# the nether will not occur. Other plugins may still enable portal usage.
# Note: Some default challenges will not be possible if there is no nether.
# Note that with a standard nether all players arrive at the same portal and entering a
# portal will return them back to their islands.
# portal will return them to their islands.
generate: true
# Islands in Nether. Change to false for standard vanilla nether.
# Note that there is currently no magic block in the Nether
Expand Down Expand Up @@ -226,7 +226,7 @@ world:
ITEM_FRAME_DAMAGE: 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
# The value is the minimum island rank required to do the action
# Ranks are the following:
# VISITOR = 0
# COOP = 200
Expand Down Expand Up @@ -448,7 +448,7 @@ island:
# Warning:
# * If you are running multiple gamemodes on your server, and all of them have
# this feature enabled, an island in all the gamemodes will be created simultaneously.
# However, it is impossible to know on which island the player will be teleported to afterwards.
# However, it is impossible to know on which island the player will be teleported to afterward.
# * Island creation can be resource-intensive, please consider the options below to help mitigate
# the potential issues, especially if you expect a lot of players to connect to your server
# in a limited period of time.
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ aoneblock:
# This section contains all button names and lore (description)
buttons:
# List of buttons in GUI's
# Button that is used in multi-page GUIs which allows to return to previous page.
# Button that is used in multipage GUIs which allows to return to previous page.
previous:
name: "&f&l Previous Page"
description: |-
&7 Switch to [number] page
# Button that is used in multi-page GUIs which allows to go to next page.
# Button that is used in multipage GUIs which allows to go to next page.
next:
name: "&f&l Next Page"
description: |-
Expand Down
Loading