feat: wrapped init and dispose player ctx by try-catch blocks
This commit is contained in:
parent
c6b6217588
commit
dc0f628a0d
@ -4,6 +4,7 @@ import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.network.player.GameProfile;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.dragonestia.msb3.api.util.UncheckedRunnable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -30,7 +31,7 @@ public class MsbPlayer extends Player {
|
||||
var ctxKey = entry.getKey();
|
||||
var ctx = entry.getValue();
|
||||
|
||||
ctx.init();
|
||||
UncheckedRunnable.runIgnoreException(ctx::init);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +40,7 @@ public class MsbPlayer extends Player {
|
||||
var ctxKey = entry.getKey();
|
||||
var ctx = entry.getValue();
|
||||
|
||||
ctx.dispose();
|
||||
UncheckedRunnable.runIgnoreException(ctx::dispose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,4 +14,8 @@ public interface UncheckedRunnable extends Runnable {
|
||||
}
|
||||
|
||||
void runUnchecked() throws Exception;
|
||||
|
||||
static void runIgnoreException(UncheckedRunnable runnable) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user