world client: always return non null or throw an error
This commit is contained in:
@@ -67,7 +67,7 @@ public class WorldClient
|
|||||||
if (!response.isSuccessful())
|
if (!response.isSuccessful())
|
||||||
{
|
{
|
||||||
logger.debug("Error looking up worlds: {}", response);
|
logger.debug("Error looking up worlds: {}", response);
|
||||||
return null;
|
throw new IOException("unsuccessful response looking up worlds");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
|
|||||||
@@ -119,13 +119,6 @@ public class DefaultWorldPlugin extends Plugin
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final WorldResult worldResult = worldClient.lookupWorlds();
|
final WorldResult worldResult = worldClient.lookupWorlds();
|
||||||
|
|
||||||
if (worldResult == null)
|
|
||||||
{
|
|
||||||
log.warn("Failed to lookup worlds.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final World world = worldResult.findWorld(correctedWorld);
|
final World world = worldResult.findWorld(correctedWorld);
|
||||||
|
|
||||||
if (world != null)
|
if (world != null)
|
||||||
|
|||||||
@@ -514,14 +514,10 @@ public class WorldHopperPlugin extends Plugin
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
WorldResult worldResult = worldClient.lookupWorlds();
|
WorldResult worldResult = worldClient.lookupWorlds();
|
||||||
|
worldResult.getWorlds().sort(Comparator.comparingInt(World::getId));
|
||||||
if (worldResult != null)
|
this.worldResult = worldResult;
|
||||||
{
|
this.lastFetch = Instant.now();
|
||||||
worldResult.getWorlds().sort(Comparator.comparingInt(World::getId));
|
updateList();
|
||||||
this.worldResult = worldResult;
|
|
||||||
this.lastFetch = Instant.now();
|
|
||||||
updateList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user