Fixed parsing incorrect weather.

This commit is contained in:
Wertík 2020-03-31 17:39:27 +02:00 committed by Brianna
parent 32f5383f3e
commit 4aafc87b55

View File

@ -353,17 +353,17 @@ public class Island {
public boolean isInBorder(Location blockLocation) {
WorldManager worldManager = skyblock.getWorldManager();
if(!isBorder()) {
if (!isBorder()) {
return true;
}
Location islandLocation = getLocation(worldManager.getIslandWorld(blockLocation.getWorld()), IslandEnvironment.Island);
double halfSize = Math.floor(getRadius());
if(blockLocation.getBlockX() > (islandLocation.getBlockX()+halfSize)
|| blockLocation.getBlockX() < (islandLocation.getBlockX()-halfSize-1)
|| blockLocation.getBlockZ() > (islandLocation.getBlockZ()+halfSize)
|| blockLocation.getBlockZ() < (islandLocation.getBlockZ()-halfSize-1)) {
if (blockLocation.getBlockX() > (islandLocation.getBlockX() + halfSize)
|| blockLocation.getBlockX() < (islandLocation.getBlockX() - halfSize - 1)
|| blockLocation.getBlockZ() > (islandLocation.getBlockZ() + halfSize)
|| blockLocation.getBlockZ() < (islandLocation.getBlockZ() - halfSize - 1)) {
return false;
}
@ -413,10 +413,14 @@ public class Island {
WeatherType weatherType;
if (weatherTypeName == null || weatherTypeName.isEmpty() || WeatherType.valueOf(weatherTypeName) == null) {
if (weatherTypeName == null || weatherTypeName.isEmpty()) {
weatherType = WeatherType.CLEAR;
} else {
try {
weatherType = WeatherType.valueOf(weatherTypeName);
} catch (IllegalArgumentException e) {
weatherType = WeatherType.CLEAR;
}
}
return weatherType;