mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-02 21:41:45 +01:00
Fixed another bunch of code smells (Sonarcloud)
This commit is contained in:
parent
f1f48279cc
commit
c0a38fb9eb
@ -44,11 +44,11 @@ public class AdminRangeSetCommand extends CompositeCommand {
|
||||
}
|
||||
|
||||
// Get new range
|
||||
if (!Util.isInteger(args.get(1), true) || Integer.valueOf(args.get(1)) < 0) {
|
||||
if (!Util.isInteger(args.get(1), true) || Integer.parseInt(args.get(1)) < 0) {
|
||||
user.sendMessage("general.errors.must-be-positive-number", TextVariables.NUMBER, args.get(1));
|
||||
return false;
|
||||
}
|
||||
int range = Integer.valueOf(args.get(1));
|
||||
int range = Integer.parseInt(args.get(1));
|
||||
|
||||
// Get island
|
||||
Island island = getIslands().getIsland(getWorld(), targetUUID);
|
||||
|
@ -151,8 +151,8 @@ public class BreakBlocksListener extends FlagListener {
|
||||
}
|
||||
|
||||
// Find out who fired the arrow
|
||||
if (e.getEntity().getShooter() instanceof Player) {
|
||||
if (!checkIsland(e, (Player) e.getEntity().getShooter(), e.getHitBlock().getLocation(), Flags.BREAK_BLOCKS)) {
|
||||
if (e.getEntity().getShooter() instanceof Player &&
|
||||
!checkIsland(e, (Player) e.getEntity().getShooter(), e.getHitBlock().getLocation(), Flags.BREAK_BLOCKS)) {
|
||||
final BlockData data = e.getHitBlock().getBlockData();
|
||||
// We seemingly can't prevent the block from being destroyed
|
||||
// So we need to put it back with a slight delay (yup, this is hacky - it makes the block flicker sometimes)
|
||||
@ -162,4 +162,3 @@ public class BreakBlocksListener extends FlagListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ class IslandGrid {
|
||||
if (firstLoaded.getOwner() == null && island.getOwner() != null) {
|
||||
// This looks fishy. We prefer to load islands that have an owner. Swap the two
|
||||
plugin.logError("Duplicate island has an owner, so using that one. " + island.getOwner());
|
||||
Island clone = new Island(firstLoaded);
|
||||
firstLoaded = new Island(island);
|
||||
zEntry.put(island.getMinZ(), firstLoaded);
|
||||
} else if (firstLoaded.getOwner() != null && island.getOwner() != null) {
|
||||
@ -42,7 +41,6 @@ class IslandGrid {
|
||||
if (firstLoaded.getCreatedDate() > island.getCreatedDate()) {
|
||||
plugin.logError("Same owner duplicate. Swaping based on creation date.");
|
||||
// FirstLoaded is the newer
|
||||
Island clone = new Island(firstLoaded);
|
||||
firstLoaded = new Island(island);
|
||||
zEntry.put(island.getMinZ(), firstLoaded);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user