Fix monitor killing servers with the new motd

This commit is contained in:
Sam 2018-08-04 00:33:06 +01:00 committed by Alexander Meech
parent 2b99495e7b
commit d85b6ee332
1 changed files with 9 additions and 3 deletions

View File

@ -106,13 +106,19 @@ public class MinecraftServer
*/ */
public boolean isJoinable() public boolean isJoinable()
{ {
if (_motd != null && (_motd.contains("Starting") || _motd.contains("Recruiting") if (_motd == null)
|| _motd.contains("Waiting") || _motd.contains("Open in") || _motd.isEmpty() || _motd.contains("Generating"))) {
return false;
}
// This is super dodgy, this is the only way around monitor not killing game servers with the new MOTD system
if (_motd.isEmpty() || _motd.contains("OPEN"))
{ {
if (_playerCount < _maxPlayerCount) if (_playerCount < _maxPlayerCount)
{ {
int availableSlots = _maxPlayerCount - _playerCount; int availableSlots = _maxPlayerCount - _playerCount;
return _motd.isEmpty() ? (availableSlots > 20) : true;
return !_motd.isEmpty() || (availableSlots > 20);
} }
} }
return false; return false;