added choose options
This commit is contained in:
parent
d8259b79ae
commit
f96356b620
@ -59,11 +59,35 @@ public class PrivateMessage extends Appliance {
|
|||||||
.append(Component.text(String.valueOf(this.targetChangeTimeoutSeconds)))
|
.append(Component.text(String.valueOf(this.targetChangeTimeoutSeconds)))
|
||||||
.append(Component.text(" Sekunden geändert. Wer soll deine Nachricht bekommen? "))
|
.append(Component.text(" Sekunden geändert. Wer soll deine Nachricht bekommen? "))
|
||||||
);
|
);
|
||||||
// TODO: add options to click on with the players names
|
|
||||||
// sender.sendMessage(
|
|
||||||
// Component.text()
|
Component newTextComponent = Component.text("");
|
||||||
// .append(Component.text())
|
|
||||||
// );
|
String firstTargetName;
|
||||||
|
if(Bukkit.getPlayer(youngestEntry.target()) == null) {
|
||||||
|
firstTargetName = Bukkit.getOfflinePlayer(youngestEntry.target()).getName();
|
||||||
|
} else {
|
||||||
|
firstTargetName = Objects.requireNonNull(Bukkit.getPlayer(youngestEntry.target())).getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(firstTargetName != null) {
|
||||||
|
Component nameComponent = Component.text("");
|
||||||
|
nameComponent.append(Component.text(firstTargetName, NamedTextColor.LIGHT_PURPLE));
|
||||||
|
|
||||||
|
newTextComponent
|
||||||
|
.append(nameComponent.clickEvent(ClickEvent.runCommand("/msg " + firstTargetName + " " + message)));
|
||||||
|
newTextComponent.append(Component.text(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
playerNames.forEach(playerName -> {
|
||||||
|
Component nameComponent = Component.text(playerName, NamedTextColor.LIGHT_PURPLE);
|
||||||
|
newTextComponent
|
||||||
|
.append(nameComponent.clickEvent(ClickEvent.runCommand("/msg " + playerName + " " + message)));
|
||||||
|
newTextComponent.append(Component.text(" "));
|
||||||
|
});
|
||||||
|
|
||||||
|
sender.sendMessage(newTextComponent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user