geforkt von SteamWar/PersistentBungeeCore
Adding progress bar
Dieser Commit ist enthalten in:
Ursprung
340383a2b9
Commit
ead6c3d25e
@ -1,6 +1,9 @@
|
||||
package de.steamwar.bungeecore;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
@ -120,6 +123,19 @@ public class Subserver implements Runnable {
|
||||
player.sendMessage(Persistent.getPrefix() + "§cUnerwarteter Fehler im Server.");
|
||||
}
|
||||
|
||||
private void sendProgress(int progress){
|
||||
StringBuilder sb = new StringBuilder("§e");
|
||||
for(int i = 0; i < progress; i++)
|
||||
sb.append('⬛');
|
||||
sb.append("§8");
|
||||
for(int i = progress; i < 10; i++)
|
||||
sb.append('⬛');
|
||||
|
||||
BaseComponent[] tc = TextComponent.fromLegacyText(sb.toString());
|
||||
for(ProxiedPlayer cached : cachedPlayers)
|
||||
cached.sendMessage(ChatMessageType.ACTION_BAR, tc);
|
||||
}
|
||||
|
||||
public void run(){
|
||||
ProxyServer.getInstance().getServers().put(serverName, server);
|
||||
serverList.add(this);
|
||||
@ -128,6 +144,12 @@ public class Subserver implements Runnable {
|
||||
String line = "";
|
||||
while (!started && (line = reader.readLine()) != null) {
|
||||
started = line.contains("ViaVersion detected server version");
|
||||
if(line.contains("Loading libraries, please wait"))
|
||||
sendProgress(0);
|
||||
else if(line.contains("Starting Minecraft server on"))
|
||||
sendProgress(3);
|
||||
else if(line.contains("Preparing start region"))
|
||||
sendProgress(6);
|
||||
}
|
||||
|
||||
if(line == null){
|
||||
@ -136,8 +158,11 @@ public class Subserver implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
sendProgress(9);
|
||||
|
||||
Thread.sleep(300);
|
||||
|
||||
sendProgress(10);
|
||||
for(ProxiedPlayer cachedPlayer : cachedPlayers){
|
||||
sendPlayer(cachedPlayer);
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren