Skip to content

Commit

Permalink
Add option to toggle in-game alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
GospelBG committed Jul 29, 2024
1 parent b73b245 commit 84680da
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ You need to follow this format: `AMOUNT: {ACTION}`, replacing `AMOUNT` with the
* **Mob Glow**: Whether the spawned mobs should have a glowing effect (highlighted and visible through blocks).
* **Display Name on Mob**: Whether the spawned mobs should have the name of the user who triggered the action.
* **Log Event**: Determines whether all events will be logged. `true` means that all channel point rewards, cheers, subscriptions and gifts will be logged into the console. `false` means that they won't be logged.
* **Show In-game Alerts**: Determines whether subscribed events should show an in-game title message.
* **Reward Name Bold**: Determines whether the reward name is displayed in bold letters in the title banner to people with the `chatpointsttv.broadcast` permission.
* **Colors**: Allows you to customize every color of the title messages. Set the wanted strings to any Minecraft Color Name (`RED`, `GOLD`, `DARK_PURPLE`...).
You can leave this section unmodified, as there are default colors set up in the original file
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/me/gosdev/chatpointsttv/ChatPointsTTV.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class ChatPointsTTV extends JavaPlugin {
public static Boolean customCredentials = false;
public static Boolean shouldMobsGlow;
public static Boolean nameSpawnedMobs;
public static Boolean enableAlerts;
private List<String> chatBlacklist;
public static boolean configOk = true;
public Thread linkThread;
Expand Down Expand Up @@ -209,6 +210,7 @@ public void onEnable() {
TwitchEventHandler.rewardBold = config.getBoolean("REWARD_NAME_BOLD");

shouldMobsGlow = config.getBoolean("MOB_GLOW");
enableAlerts = config.getBoolean("SHOW_INGAME_ALERTS");
nameSpawnedMobs = config.getBoolean("DISPLAY_NAME_ON_MOB");
chatBlacklist = config.getStringList("CHAT_BLACKLIST");

Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/me/gosdev/chatpointsttv/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Events {
static Logger log = plugin.log;

public static void displayTitle(String user, String action, String rewardName, ChatColor titleColor, ChatColor userColor, Boolean isBold) {
if (!ChatPointsTTV.enableAlerts) return; // Do not show alerts if user has disabled them.
plugin.getServer().getOnlinePlayers().forEach (p -> {
if (p.hasPermission(ChatPointsTTV.permissions.BROADCAST.permission_id)) {
ChatPointsTTV.getUtils().displayTitle(p.getPlayer(), user, action, rewardName, isBold, userColor, titleColor);
Expand Down

0 comments on commit 84680da

Please sign in to comment.