9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-31 04:36:29 +00:00

Added MessageReward for simple message sending

This commit is contained in:
SamB440
2020-05-08 18:50:23 +01:00
parent e5230f9f45
commit 05a0e44e80
4 changed files with 32 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
package net.islandearth.rpgregions.rewards;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.List;
/**
* Reward to send messages to the player. More complex messages can use the tellraw command in {@link ConsoleCommandReward}.
*/
public class MessageReward extends DiscoveryReward {
private final List<String> messages;
public MessageReward(List<String> messages) {
this.messages = messages;
}
@Override
public void award(Player player) {
messages.forEach(message -> player.sendMessage(ChatColor.translateAlternateColorCodes('&', message)));
}
@Override
public String getName() {
return "Message";
}
}