Skip to content

Commit 1c04e76

Browse files
committed
Static analysis code clean up
1 parent 567c04a commit 1c04e76

25 files changed

+99
-130
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ A: It's whatever you want it to be!
8484

8585
## Installation
8686

87-
0. Install BentoBox and run it on the server at least once to create its data folders.
88-
1. Place this jar in the addons folder of the BentoBox plugin.
89-
2. Restart the server.
90-
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.
91-
4. Stop the server.
92-
5. Edit config.yml and the .yml config files how you want.
93-
6. Delete any worlds that were created by default if you made changes that would affect them.
94-
7. Restart the server.
87+
1. Install BentoBox and run it on the server at least once to create its data folders.
88+
2. Place this jar in the addons folder of the BentoBox plugin.
89+
3. Restart the server.
90+
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.
91+
5. Stop the server.
92+
6. Edit config.yml and the .yml config files how you want.
93+
7. Delete any worlds that were created by default if you made changes that would affect them.
94+
8. Restart the server.
9595

9696
## Phase config files
9797

src/main/java/world/bentobox/aoneblock/AOneBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class AOneBlock extends GameModeAddon {
7979
.defaultSetting(false)
8080
.build();
8181
/** The listener for the boss bar */
82-
private BossBarListener bossBar = new BossBarListener(this);
82+
private final BossBarListener bossBar = new BossBarListener(this);
8383
/**
8484
* Flag to enable or disable the OneBlock boss bar.
8585
*/

src/main/java/world/bentobox/aoneblock/AOneBlockPlaceholders.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private Optional<Island> getUsersIsland(User user) {
8282
.filter(is -> user.getUniqueId().equals(is.getOwner())).toList();
8383
if (ownedIslands.size() == 1) {
8484
// Replace with the owned island
85-
i = ownedIslands.get(0); // pick one
85+
i = ownedIslands.getFirst(); // pick one
8686
}
8787
// Return what we have found
8888
return Optional.ofNullable(i);

src/main/java/world/bentobox/aoneblock/commands/admin/AdminSanityCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public boolean canExecute(User user, String label, List<String> args) {
4040
}
4141
if (args.isEmpty()) return true;
4242
// Check phase
43-
Optional<OneBlockPhase> opPhase = addon.getOneBlockManager().getPhase(args.get(0).toUpperCase());
43+
Optional<OneBlockPhase> opPhase = addon.getOneBlockManager().getPhase(args.getFirst().toUpperCase());
4444
if (opPhase.isEmpty()) {
4545
user.sendMessage("aoneblock.commands.admin.setchest.unknown-phase");
4646
return false;

src/main/java/world/bentobox/aoneblock/commands/admin/AdminSetCountCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public boolean execute(User user, String label, List<String> args) {
4545
// Get target player
4646
UUID targetUUID = getPlayers().getUUID(args.get(0));
4747
if (targetUUID == null) {
48-
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
48+
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.getFirst());
4949
return false;
5050
}
5151
// Get their island

src/main/java/world/bentobox/aoneblock/commands/island/IslandSetCountCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ public boolean execute(User user, String label, List<String> args) {
6767
}
6868
// Get value
6969
// Get new range
70-
if (!Util.isInteger(args.get(0), true) || Integer.parseInt(args.get(0)) < 0) {
71-
user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.get(0));
70+
if (!Util.isInteger(args.getFirst(), true) || Integer.parseInt(args.getFirst()) < 0) {
71+
user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.getFirst());
7272
return false;
7373
}
74-
int count = Integer.parseInt(args.get(0));
74+
int count = Integer.parseInt(args.getFirst());
7575
// Check the value is lower than played so far
7676
@NonNull
7777
OneBlockIslands i = addon.getBlockListener().getIsland(island);

src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ public void onPlayerInteract(PlayerInteractEvent e) {
716716
return;
717717
}
718718

719-
if (block != null && block.getBlockData() instanceof Brushable bb) {
719+
if (block.getBlockData() instanceof Brushable bb) {
720720
int dusted = bb.getDusted() + 1;
721721
if (dusted > bb.getMaximumDusted()) {
722722
/// === Brushing is FINISHED! ===

src/main/java/world/bentobox/aoneblock/listeners/BossBarListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public BossBarListener(AOneBlock addon) {
4444
this.addon = addon;
4545
}
4646

47-
private AOneBlock addon;
47+
private final AOneBlock addon;
4848

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

src/main/java/world/bentobox/aoneblock/listeners/ItemsAdderListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import world.bentobox.aoneblock.AOneBlock;
88

99
/**
10-
* Handles ItemsAdderLoadDataEvent which fired when ItemsAdder loaded it's data or reload it's data
10+
* Handles ItemsAdderLoadDataEvent which fired when ItemsAdder loaded its data or reload its data
1111
*
1212
* @author Teenkung123
1313
*/

src/main/java/world/bentobox/aoneblock/oneblocks/OneBlocksManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ public NavigableMap<Integer, OneBlockPhase> getBlockProbs() {
572572
}
573573

574574
/**
575-
* Get phase by name. Name should have any spaces converted to underscores. Case
575+
* Get phase by name. Name should have any spaces converted to underscores. Case-
576576
* insensitive.
577577
*
578578
* @param name - name to search
@@ -859,7 +859,7 @@ public void getProbs(OneBlockPhase phase) {
859859
}
860860

861861
/**
862-
* Get all the probs for each phases and log to console
862+
* Get all the probs for each phase and log to console
863863
*/
864864
public void getAllProbs() {
865865
blockProbs.values().forEach(this::getProbs);

0 commit comments

Comments
 (0)