Upload folder via GUI - src
This commit is contained in:
@@ -15,8 +15,9 @@ public class MsgUtil {
|
|||||||
// '─' (U+2500) ist in Minecraft's Standard-Schrift ca. 6px breit.
|
// '─' (U+2500) ist in Minecraft's Standard-Schrift ca. 6px breit.
|
||||||
// Der Chat ist ~320px breit → ~53 Zeichen.
|
// Der Chat ist ~320px breit → ~53 Zeichen.
|
||||||
// Mit Prefix "[ServerPulse] " (~14 Zeichen) bleiben ~39 Zeichen übrig.
|
// Mit Prefix "[ServerPulse] " (~14 Zeichen) bleiben ~39 Zeichen übrig.
|
||||||
// Wir setzen LINE_LEN daher auf 38 damit es mit Prefix in eine Zeile passt.
|
// In der Praxis wirkt die Zeile mit den Farbformatierungen etwas breiter.
|
||||||
private static final int LINE_LEN = 38;
|
// 34 ergibt hier eine saubere Breite ohne Umbruch.
|
||||||
|
private static final int LINE_LEN = 34;
|
||||||
private static final char LINE_CHAR = '─';
|
private static final char LINE_CHAR = '─';
|
||||||
|
|
||||||
private MsgUtil() {}
|
private MsgUtil() {}
|
||||||
@@ -78,22 +79,18 @@ public class MsgUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zentrierter Header.
|
* Zentrierter, symmetrischer Header.
|
||||||
* Beispiel: ───── ServerPulse Status ─────
|
* Beispiel: ───── ServerPulse Status ─────
|
||||||
*
|
|
||||||
* Die Striche werden so berechnet, dass Titel + Striche = LINE_LEN ergibt.
|
|
||||||
* Wenn der Titel zu lang ist, werden mindestens 3 Striche pro Seite gesetzt.
|
|
||||||
*/
|
*/
|
||||||
public static String header(String title) {
|
public static String header(String title) {
|
||||||
int available = LINE_LEN - title.length() - 2; // -2 für Leerzeichen
|
int available = Math.max(6, LINE_LEN - title.length() - 2); // -2 für Leerzeichen
|
||||||
int left = Math.max(3, available / 2);
|
int side = Math.max(3, available / 2);
|
||||||
int right = Math.max(3, available - left);
|
|
||||||
|
|
||||||
String l = String.valueOf(LINE_CHAR);
|
String l = String.valueOf(LINE_CHAR);
|
||||||
return colorize(
|
return colorize(
|
||||||
"&8" + l.repeat(left) +
|
"&8" + l.repeat(side) +
|
||||||
" &b&l" + title +
|
" &b&l" + title +
|
||||||
" &8" + l.repeat(right)
|
" &8" + l.repeat(side)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user