fix: return null if reference is null
This commit is contained in:
@@ -99,7 +99,7 @@ public class Location implements Serializable{
|
|||||||
|
|
||||||
public World getWorld () {
|
public World getWorld () {
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
throw new IllegalStateException("World is not initialized");
|
return null;
|
||||||
}
|
}
|
||||||
if (world.get() == null) {
|
if (world.get() == null) {
|
||||||
throw new ResourceUnloadedException("You're trying to get unloaded world");
|
throw new ResourceUnloadedException("You're trying to get unloaded world");
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class ChunkImpl implements Chunk{
|
|||||||
@Override
|
@Override
|
||||||
public Region getRegion() {
|
public Region getRegion() {
|
||||||
if (region == null) {
|
if (region == null) {
|
||||||
throw new IllegalStateException("Region is not initialized");
|
return null;
|
||||||
}
|
}
|
||||||
if (region.get() == null) {
|
if (region.get() == null) {
|
||||||
throw new ResourceUnloadedException("Region is unloaded");
|
throw new ResourceUnloadedException("Region is unloaded");
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class RegionImpl implements Region{
|
|||||||
@Override
|
@Override
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
throw new IllegalStateException("World is not initialized");
|
return null;
|
||||||
}
|
}
|
||||||
if (world.get() == null) {
|
if (world.get() == null) {
|
||||||
throw new ResourceUnloadedException("World is unloaded");
|
throw new ResourceUnloadedException("World is unloaded");
|
||||||
|
|||||||
Reference in New Issue
Block a user