tubing-example:
# When enabled, the message broadcasted will be send across the bungee network
broadcast-on-bungee: true
broadcast-prefix: "&C[BROADCAST] &6"
broadcast-messages:
- Restart in 10 minutes
- Restart in 5 minutes
- Restart in 1 minutes
- Network maintenance today
Gui Controller
The controller defines 2 actions. The message-select action will open the inventory which will show what message to broadcast.
@IocBean
@GuiController
public class BroadcastGuiController {
@ConfigProperty("tubing-example.broadcast-messages")
private List<String> predefinedMessages;
private final BroadcastingService broadcastingService;
public BroadcastGuiController(BroadcastingService broadcastingService) {
this.broadcastingService = broadcastingService;
}
@GuiAction("broadcast/message-select")
public GuiTemplate viewMessageSelect() {
HashMap<String, Object> params = new HashMap<>();
params.put("messages", predefinedMessages);
return template("gui/broadcast/message-select.ftl", params);
}
@GuiAction("broadcast/send-message")
public void sendMessage(Player player, @GuiParam("message") String message) {
broadcastingService.broadcast(player, message);
}
}