From c16a344585fc2068ef1834cd75745d1af4509d21 Mon Sep 17 00:00:00 2001 From: BitHeaven Date: Mon, 27 Jan 2025 10:23:44 +0500 Subject: [PATCH] Add message command --- src/main/java/ru/bitheaven/donpayinteg/DonateThread.java | 2 +- .../java/ru/bitheaven/donpayinteg/config/Config.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/bitheaven/donpayinteg/DonateThread.java b/src/main/java/ru/bitheaven/donpayinteg/DonateThread.java index 557817d..d8ac1b5 100644 --- a/src/main/java/ru/bitheaven/donpayinteg/DonateThread.java +++ b/src/main/java/ru/bitheaven/donpayinteg/DonateThread.java @@ -47,7 +47,7 @@ public class DonateThread extends Thread { lastDonate = objects.getInt("id"); - DonPayInteg.commands.addLast("title @a title \"" + msg.replace("{username}", objects.getJSONObject("vars").getString("name")) + "\""); + DonPayInteg.commands.addLast(ConfigHandler.load().getMessageCmd().replace("{message}", msg.replace("{username}", objects.getJSONObject("vars").getString("name")))); DonPayInteg.commands.addLast(cmd.replace("{username}", objects.getJSONObject("vars").getString("name"))); LOGGER.info("Exec donate #{}", lastDonate); diff --git a/src/main/java/ru/bitheaven/donpayinteg/config/Config.java b/src/main/java/ru/bitheaven/donpayinteg/config/Config.java index f2b6e7c..01b9d31 100644 --- a/src/main/java/ru/bitheaven/donpayinteg/config/Config.java +++ b/src/main/java/ru/bitheaven/donpayinteg/config/Config.java @@ -4,6 +4,7 @@ import java.util.List; public class Config { private String donpayToken = ""; + private String messageCmd = "title @a title \"{message}\""; private int reqCooldown = 15; private int cmdCooldown = 2; private int lastDonate = 0; @@ -49,5 +50,13 @@ public class Config { public void setCmdCooldown(int cmdCooldown) { this.cmdCooldown = cmdCooldown; } + + public String getMessageCmd() { + return messageCmd; + } + + public void setMessageCmd(String messageCmd) { + this.messageCmd = messageCmd; + } }