mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-27 20:59:12 +01:00
Cut CPU load to sane amounts in the same way that Minecraft does.
This commit is contained in:
parent
feb64312ca
commit
0b10f83916
@ -331,6 +331,13 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
|
||||
{
|
||||
server.stream.write( packet );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Thread.sleep( BungeeCord.getInstance().config.getSleepTime() );
|
||||
} catch ( InterruptedException ex )
|
||||
{
|
||||
}
|
||||
} catch ( IOException ex )
|
||||
{
|
||||
destroySelf( "Reached end of stream" );
|
||||
@ -526,6 +533,13 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
|
||||
connect( nextServer, true );
|
||||
break outer;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Thread.sleep( BungeeCord.getInstance().config.getSleepTime() );
|
||||
} catch ( InterruptedException ex )
|
||||
{
|
||||
}
|
||||
}
|
||||
} catch ( Exception ex )
|
||||
{
|
||||
|
@ -48,6 +48,7 @@ public class Configuration
|
||||
* Should we check minecraft.net auth.
|
||||
*/
|
||||
private boolean onlineMode = true;
|
||||
private int sleepTime = 2;
|
||||
|
||||
public void load()
|
||||
{
|
||||
@ -57,6 +58,7 @@ public class Configuration
|
||||
timeout = adapter.getInt( "timeout", timeout );
|
||||
uuid = adapter.getString( "stats", uuid );
|
||||
onlineMode = adapter.getBoolean( "online_mode", onlineMode );
|
||||
sleepTime = adapter.getInt( "sleep_time", sleepTime );
|
||||
|
||||
DefaultTabList tab = DefaultTabList.valueOf( adapter.getString( "tab_list", "GLOBAL_PING" ) );
|
||||
if ( tab == null )
|
||||
|
Loading…
Reference in New Issue
Block a user