mirror of
https://github.com/BentoBoxWorld/Greenhouses.git
synced 2025-02-01 04:41:20 +01:00
Address bugs reported by SonarCloud
This commit is contained in:
parent
d6df904fbc
commit
9e407e659e
@ -220,7 +220,7 @@ public class Greenhouse implements DataObject {
|
||||
* @return true if inside the greenhouse
|
||||
*/
|
||||
public boolean contains(Location location2) {
|
||||
return getLocation().getWorld() != null
|
||||
return getLocation() != null && getLocation().getWorld() != null
|
||||
&& getLocation().getWorld().equals(location2.getWorld())
|
||||
&& getBoundingBox().contains(location2.toVector());
|
||||
}
|
||||
|
@ -43,10 +43,6 @@ public class PanelClick implements ClickHandler {
|
||||
}
|
||||
|
||||
private boolean makeGreenhouse(User user, BiomeRecipe br) {
|
||||
if (user.getLocation() == null) {
|
||||
addon.logError("User has no location : " + user.getName());
|
||||
return false;
|
||||
}
|
||||
// Check flag
|
||||
if (!addon.getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
||||
user.sendMessage("greenhouses.errors.no-rank");
|
||||
|
@ -92,10 +92,6 @@ class MakeCommand extends CompositeCommand {
|
||||
* @return true if successful
|
||||
*/
|
||||
private boolean makeGreenhouse(User user, BiomeRecipe br) {
|
||||
if (user.getLocation() == null) {
|
||||
getAddon().logError("User had no location");
|
||||
return false;
|
||||
}
|
||||
// Check flag
|
||||
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
||||
user.sendMessage("greenhouses.errors.no-rank");
|
||||
|
@ -35,10 +35,6 @@ class RemoveCommand extends CompositeCommand {
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(User user, String label, List<String> args) {
|
||||
if (user.getLocation() == null) {
|
||||
getAddon().logError("User had no location");
|
||||
return false;
|
||||
}
|
||||
// Check flag
|
||||
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
||||
user.sendMessage("greenhouses.errors.no-rank");
|
||||
|
Loading…
Reference in New Issue
Block a user