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
|
* @return true if inside the greenhouse
|
||||||
*/
|
*/
|
||||||
public boolean contains(Location location2) {
|
public boolean contains(Location location2) {
|
||||||
return getLocation().getWorld() != null
|
return getLocation() != null && getLocation().getWorld() != null
|
||||||
&& getLocation().getWorld().equals(location2.getWorld())
|
&& getLocation().getWorld().equals(location2.getWorld())
|
||||||
&& getBoundingBox().contains(location2.toVector());
|
&& getBoundingBox().contains(location2.toVector());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,6 @@ public class PanelClick implements ClickHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean makeGreenhouse(User user, BiomeRecipe br) {
|
private boolean makeGreenhouse(User user, BiomeRecipe br) {
|
||||||
if (user.getLocation() == null) {
|
|
||||||
addon.logError("User has no location : " + user.getName());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Check flag
|
// Check flag
|
||||||
if (!addon.getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
if (!addon.getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
||||||
user.sendMessage("greenhouses.errors.no-rank");
|
user.sendMessage("greenhouses.errors.no-rank");
|
||||||
|
|
|
@ -92,10 +92,6 @@ class MakeCommand extends CompositeCommand {
|
||||||
* @return true if successful
|
* @return true if successful
|
||||||
*/
|
*/
|
||||||
private boolean makeGreenhouse(User user, BiomeRecipe br) {
|
private boolean makeGreenhouse(User user, BiomeRecipe br) {
|
||||||
if (user.getLocation() == null) {
|
|
||||||
getAddon().logError("User had no location");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Check flag
|
// Check flag
|
||||||
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
||||||
user.sendMessage("greenhouses.errors.no-rank");
|
user.sendMessage("greenhouses.errors.no-rank");
|
||||||
|
|
|
@ -35,10 +35,6 @@ class RemoveCommand extends CompositeCommand {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(User user, String label, List<String> args) {
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
if (user.getLocation() == null) {
|
|
||||||
getAddon().logError("User had no location");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Check flag
|
// Check flag
|
||||||
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
|
||||||
user.sendMessage("greenhouses.errors.no-rank");
|
user.sendMessage("greenhouses.errors.no-rank");
|
||||||
|
|
Loading…
Reference in New Issue