Skip to content

Commit 93f647e

Browse files
committed
Improved message formatting of prefix command
1 parent 5f24de4 commit 93f647e

File tree

1 file changed

+114
-59
lines changed

1 file changed

+114
-59
lines changed

src/main/java/dev/lars/utilsmanager/commands/player/PrefixCommand.java

Lines changed: 114 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public void execute(@NotNull CommandSourceStack stack, @NotNull String @NotNull
174174

175175
items.put(4, new ItemBuilder(Material.PAPER)
176176
.setDisplayName(Component.text("Obfuscated", NamedTextColor.WHITE, TextDecoration.OBFUSCATED))
177-
.setCustomId(prefixKey, "magic")
177+
.setCustomId(prefixKey, "obfuscated")
178178
.setCustomModelData(4)
179179
.build());
180180

@@ -186,7 +186,7 @@ public void execute(@NotNull CommandSourceStack stack, @NotNull String @NotNull
186186

187187
items.put(6, new ItemBuilder(Material.PAPER)
188188
.setDisplayName(Component.text("Underlined", NamedTextColor.WHITE, TextDecoration.UNDERLINED))
189-
.setCustomId(prefixKey, "underline")
189+
.setCustomId(prefixKey, "underlined")
190190
.setCustomModelData(6)
191191
.build());
192192

@@ -207,7 +207,7 @@ public void execute(@NotNull CommandSourceStack stack, @NotNull String @NotNull
207207
} else {
208208
player.sendMessage(Statements.getPrefix()
209209
.append(Component.text("You´ve set your prefix on ", NamedTextColor.WHITE))
210-
.append(Component.text("Black", NamedTextColor.BLACK))
210+
.append(Component.text("black", NamedTextColor.BLACK))
211211
.append(Component.text(".", NamedTextColor.WHITE)));
212212
}
213213
break;
@@ -440,96 +440,151 @@ public void execute(@NotNull CommandSourceStack stack, @NotNull String @NotNull
440440
case "bold": {
441441
if (PrefixAPI.getApi().getDecorations(player).contains(TextDecoration.BOLD)) {
442442
PrefixAPI.getApi().removeDecoration(player, TextDecoration.BOLD);
443+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
444+
player.sendMessage(Statements.getPrefix()
445+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
446+
.append(Component.text("fett", NamedTextColor.GRAY, TextDecoration.BOLD))
447+
.append(Component.text(" deaktiviert.", NamedTextColor.WHITE)));
448+
} else {
449+
player.sendMessage(Statements.getPrefix()
450+
.append(Component.text("You've removed the prefix decoration ", NamedTextColor.WHITE))
451+
.append(Component.text("bold", NamedTextColor.GRAY, TextDecoration.BOLD))
452+
.append(Component.text(".", NamedTextColor.WHITE)));
453+
}
443454
} else {
444455
PrefixAPI.getApi().addDecoration(player, TextDecoration.BOLD);
445-
}
446-
447-
if (LanguageAPI.getApi().getLanguage(player) == 2) {
448-
player.sendMessage(Statements.getPrefix()
449-
.append(Component.text("Du hast den Prefix Effekt ", NamedTextColor.WHITE))
450-
.append(Component.text("Fett", NamedTextColor.WHITE, TextDecoration.BOLD))
451-
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
452-
} else {
453-
player.sendMessage(Statements.getPrefix()
454-
.append(Component.text("You've set the prefix effect ", NamedTextColor.WHITE))
455-
.append(Component.text("bold", NamedTextColor.WHITE, TextDecoration.BOLD))
456-
.append(Component.text(".", NamedTextColor.WHITE)));
456+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
457+
player.sendMessage(Statements.getPrefix()
458+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
459+
.append(Component.text("fett", NamedTextColor.GRAY, TextDecoration.BOLD))
460+
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
461+
} else {
462+
player.sendMessage(Statements.getPrefix()
463+
.append(Component.text("You've added the prefix decoration ", NamedTextColor.WHITE))
464+
.append(Component.text("bold", NamedTextColor.GRAY, TextDecoration.BOLD))
465+
.append(Component.text(".", NamedTextColor.WHITE)));
466+
}
457467
}
458468
break;
459469
}
460470
case "italic": {
461471
if (PrefixAPI.getApi().getDecorations(player).contains(TextDecoration.ITALIC)) {
462472
PrefixAPI.getApi().removeDecoration(player, TextDecoration.ITALIC);
473+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
474+
player.sendMessage(Statements.getPrefix()
475+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
476+
.append(Component.text("kursiv", NamedTextColor.GRAY, TextDecoration.ITALIC))
477+
.append(Component.text(" deaktiviert.", NamedTextColor.WHITE)));
478+
} else {
479+
player.sendMessage(Statements.getPrefix()
480+
.append(Component.text("You've removed the prefix decoration ", NamedTextColor.WHITE))
481+
.append(Component.text("italic", NamedTextColor.GRAY, TextDecoration.ITALIC))
482+
.append(Component.text(".", NamedTextColor.WHITE)));
483+
}
463484
} else {
464485
PrefixAPI.getApi().addDecoration(player, TextDecoration.ITALIC);
465-
}
466-
if (LanguageAPI.getApi().getLanguage(player) == 2) {
467-
player.sendMessage(Statements.getPrefix()
468-
.append(Component.text("Du hast den Prefix Effekt ", NamedTextColor.WHITE))
469-
.append(Component.text("Kursiv", NamedTextColor.WHITE, TextDecoration.ITALIC))
470-
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
471-
} else {
472-
player.sendMessage(Statements.getPrefix()
473-
.append(Component.text("You've set the prefix effect ", NamedTextColor.WHITE))
474-
.append(Component.text("italic", NamedTextColor.WHITE, TextDecoration.ITALIC))
475-
.append(Component.text(".", NamedTextColor.WHITE)));
486+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
487+
player.sendMessage(Statements.getPrefix()
488+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
489+
.append(Component.text("kursiv", NamedTextColor.GRAY, TextDecoration.ITALIC))
490+
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
491+
} else {
492+
player.sendMessage(Statements.getPrefix()
493+
.append(Component.text("You've added the prefix decoration ", NamedTextColor.WHITE))
494+
.append(Component.text("italic", NamedTextColor.GRAY, TextDecoration.ITALIC))
495+
.append(Component.text(".", NamedTextColor.WHITE)));
496+
}
476497
}
477498
break;
478499
}
479500
case "obfuscated": {
480501
if (PrefixAPI.getApi().getDecorations(player).contains(TextDecoration.OBFUSCATED)) {
481502
PrefixAPI.getApi().removeDecoration(player, TextDecoration.OBFUSCATED);
503+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
504+
player.sendMessage(Statements.getPrefix()
505+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
506+
.append(Component.text("verschleiert", NamedTextColor.GRAY, TextDecoration.OBFUSCATED))
507+
.append(Component.text(" deaktiviert.", NamedTextColor.WHITE)));
508+
} else {
509+
player.sendMessage(Statements.getPrefix()
510+
.append(Component.text("You've removed the prefix decoration ", NamedTextColor.WHITE))
511+
.append(Component.text("obfuscated", NamedTextColor.GRAY, TextDecoration.OBFUSCATED))
512+
.append(Component.text(".", NamedTextColor.WHITE)));
513+
}
482514
} else {
483515
PrefixAPI.getApi().addDecoration(player, TextDecoration.OBFUSCATED);
516+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
517+
player.sendMessage(Statements.getPrefix()
518+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
519+
.append(Component.text("verschleiert", NamedTextColor.GRAY, TextDecoration.OBFUSCATED))
520+
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
521+
} else {
522+
player.sendMessage(Statements.getPrefix()
523+
.append(Component.text("You've added the prefix decoration ", NamedTextColor.WHITE))
524+
.append(Component.text("obfuscated", NamedTextColor.GRAY, TextDecoration.OBFUSCATED))
525+
.append(Component.text(".", NamedTextColor.WHITE)));
526+
}
484527
}
485-
if (LanguageAPI.getApi().getLanguage(player) == 2) {
486-
player.sendMessage(Statements.getPrefix()
487-
.append(Component.text("Du hast den Prefix Effekt ", NamedTextColor.WHITE))
488-
.append(Component.text("Magie", NamedTextColor.WHITE, TextDecoration.OBFUSCATED))
489-
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
490-
} else {
491-
player.sendMessage(Statements.getPrefix()
492-
.append(Component.text("You've set the prefix effect ", NamedTextColor.WHITE))
493-
.append(Component.text("magic", NamedTextColor.WHITE, TextDecoration.OBFUSCATED))
494-
.append(Component.text(".", NamedTextColor.WHITE)));
495-
}
528+
496529
break;
497530
}
498531
case "strikethrough": {
499532
if (PrefixAPI.getApi().getDecorations(player).contains(TextDecoration.STRIKETHROUGH)) {
500533
PrefixAPI.getApi().removeDecoration(player, TextDecoration.STRIKETHROUGH);
534+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
535+
player.sendMessage(Statements.getPrefix()
536+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
537+
.append(Component.text("durchgestrichen", NamedTextColor.WHITE, TextDecoration.STRIKETHROUGH))
538+
.append(Component.text(" deaktiviert.", NamedTextColor.WHITE)));
539+
} else {
540+
player.sendMessage(Statements.getPrefix()
541+
.append(Component.text("You've removed the prefix decoration ", NamedTextColor.WHITE))
542+
.append(Component.text("strikethrough", NamedTextColor.WHITE, TextDecoration.STRIKETHROUGH))
543+
.append(Component.text(".", NamedTextColor.WHITE)));
544+
}
501545
} else {
502546
PrefixAPI.getApi().addDecoration(player, TextDecoration.STRIKETHROUGH);
503-
}
504-
if (LanguageAPI.getApi().getLanguage(player) == 2) {
505-
player.sendMessage(Statements.getPrefix()
506-
.append(Component.text("Du hast den Prefix Effekt ", NamedTextColor.WHITE))
507-
.append(Component.text("Durchgestrichen", NamedTextColor.WHITE, TextDecoration.STRIKETHROUGH))
508-
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
509-
} else {
510-
player.sendMessage(Statements.getPrefix()
511-
.append(Component.text("You've set the prefix effect ", NamedTextColor.WHITE))
512-
.append(Component.text("strikethrough", NamedTextColor.WHITE, TextDecoration.STRIKETHROUGH))
513-
.append(Component.text(".", NamedTextColor.WHITE)));
547+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
548+
player.sendMessage(Statements.getPrefix()
549+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
550+
.append(Component.text("durchgestrichen", NamedTextColor.WHITE, TextDecoration.STRIKETHROUGH))
551+
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
552+
} else {
553+
player.sendMessage(Statements.getPrefix()
554+
.append(Component.text("You've added the prefix decoration ", NamedTextColor.WHITE))
555+
.append(Component.text("strikethrough", NamedTextColor.WHITE, TextDecoration.STRIKETHROUGH))
556+
.append(Component.text(".", NamedTextColor.WHITE)));
557+
}
514558
}
515559
break;
516560
}
517561
case "underlined": {
518562
if (PrefixAPI.getApi().getDecorations(player).contains(TextDecoration.UNDERLINED)) {
519563
PrefixAPI.getApi().removeDecoration(player, TextDecoration.UNDERLINED);
564+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
565+
player.sendMessage(Statements.getPrefix()
566+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
567+
.append(Component.text("unterstrichen", NamedTextColor.WHITE, TextDecoration.UNDERLINED))
568+
.append(Component.text(" deaktiviert.", NamedTextColor.WHITE)));
569+
} else {
570+
player.sendMessage(Statements.getPrefix()
571+
.append(Component.text("You've removed the prefix decoration ", NamedTextColor.WHITE))
572+
.append(Component.text("underlined", NamedTextColor.WHITE, TextDecoration.UNDERLINED))
573+
.append(Component.text(".", NamedTextColor.WHITE)));
574+
}
520575
} else {
521576
PrefixAPI.getApi().addDecoration(player, TextDecoration.UNDERLINED);
522-
}
523-
if (LanguageAPI.getApi().getLanguage(player) == 2) {
524-
player.sendMessage(Statements.getPrefix()
525-
.append(Component.text("Du hast den Prefix Effekt ", NamedTextColor.WHITE))
526-
.append(Component.text("Unterstrichen", NamedTextColor.WHITE, TextDecoration.UNDERLINED))
527-
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
528-
} else {
529-
player.sendMessage(Statements.getPrefix()
530-
.append(Component.text("You've set the prefix effect ", NamedTextColor.WHITE))
531-
.append(Component.text("underlined", NamedTextColor.WHITE, TextDecoration.UNDERLINED))
532-
.append(Component.text(".", NamedTextColor.WHITE)));
577+
if (LanguageAPI.getApi().getLanguage(player) == 2) {
578+
player.sendMessage(Statements.getPrefix()
579+
.append(Component.text("Du hast den Prefix Dekoration ", NamedTextColor.WHITE))
580+
.append(Component.text("unterstrichen", NamedTextColor.WHITE, TextDecoration.UNDERLINED))
581+
.append(Component.text(" aktiviert.", NamedTextColor.WHITE)));
582+
} else {
583+
player.sendMessage(Statements.getPrefix()
584+
.append(Component.text("You've added the prefix decoration ", NamedTextColor.WHITE))
585+
.append(Component.text("underlined", NamedTextColor.WHITE, TextDecoration.UNDERLINED))
586+
.append(Component.text(".", NamedTextColor.WHITE)));
587+
}
533588
}
534589
break;
535590
}

0 commit comments

Comments
 (0)