Adding progress bar
Dieser Commit ist enthalten in:
Ursprung
340383a2b9
Commit
ead6c3d25e
@ -1,6 +1,9 @@
|
|||||||
package de.steamwar.bungeecore;
|
package de.steamwar.bungeecore;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
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.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
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.");
|
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(){
|
public void run(){
|
||||||
ProxyServer.getInstance().getServers().put(serverName, server);
|
ProxyServer.getInstance().getServers().put(serverName, server);
|
||||||
serverList.add(this);
|
serverList.add(this);
|
||||||
@ -128,6 +144,12 @@ public class Subserver implements Runnable {
|
|||||||
String line = "";
|
String line = "";
|
||||||
while (!started && (line = reader.readLine()) != null) {
|
while (!started && (line = reader.readLine()) != null) {
|
||||||
started = line.contains("ViaVersion detected server version");
|
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){
|
if(line == null){
|
||||||
@ -136,8 +158,11 @@ public class Subserver implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendProgress(9);
|
||||||
|
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
|
|
||||||
|
sendProgress(10);
|
||||||
for(ProxiedPlayer cachedPlayer : cachedPlayers){
|
for(ProxiedPlayer cachedPlayer : cachedPlayers){
|
||||||
sendPlayer(cachedPlayer);
|
sendPlayer(cachedPlayer);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren