Fix/improve handling of two exceptions

This commit is contained in:
Lukas Rieger (Blue) 2022-09-08 12:29:11 +02:00
parent d9df6989ff
commit e8f8317d52
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
2 changed files with 14 additions and 6 deletions

View File

@ -486,12 +486,16 @@ public class Plugin implements ServerEventListener {
private void checkPausedByPlayerCountSoon() {
// check is done a second later to make sure the player has actually joined/left and is no longer on the list
daemonTimer.schedule(new TimerTask() {
@Override
public void run() {
checkPausedByPlayerCount();
}
}, 1000);
try {
daemonTimer.schedule(new TimerTask() {
@Override
public void run() {
checkPausedByPlayerCount();
}
}, 1000);
} catch (IllegalStateException ex) { // Timer is cancelled for some reason
Logger.global.logWarning("Timer is already cancelled, skipping player-limit checks!");
}
}
public boolean checkPausedByPlayerCount() {

View File

@ -28,6 +28,10 @@ public class LowresTile {
this.size = tileSize.add(1, 1); // add 1 for seamless edges
this.texture = ImageIO.read(in);
if (this.texture == null) {
throw new IOException("No registered ImageReader is able to read the image-stream");
}
if (this.texture.getWidth() != this.size.getX() || this.texture.getHeight() != this.size.getY() * 2) {
throw new IOException("Size of tile does not match");
}