develop-chatReply #5
| @@ -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(" ")); | ||||||
|  |         } | ||||||
| 
					
					Pupsi marked this conversation as resolved
					
				 | |||||||
|  |  | ||||||
|  |  | ||||||
|  |         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); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	
gibt es einen Grund warum die Variable hier außerhalb allokiert wird aber nur innerhalb des if statements genutzt wird?