mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
ActionBar messages can now have copies sent to chat
This commit is contained in:
@ -2,7 +2,10 @@ package com.gmail.nossr50.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
@ -52,7 +55,7 @@ public final class HardcoreManager {
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PlayerDeath", totalLevelsLost));
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.HARDCORE_MODE, "Hardcore.DeathStatLoss.PlayerDeath", String.valueOf(totalLevelsLost));
|
||||
}
|
||||
|
||||
public static void invokeVampirism(Player killer, Player victim) {
|
||||
|
@ -66,13 +66,25 @@ public class NotificationManager {
|
||||
if (customEvent.isCancelled())
|
||||
return;
|
||||
|
||||
player.spigot().sendMessage(customEvent.getChatMessageType(), customEvent.getNotificationTextComponent());
|
||||
//If the message is being sent to the action bar we need to check if the copy if a copy is sent to the chat system
|
||||
if(customEvent.getChatMessageType() == ChatMessageType.ACTION_BAR)
|
||||
{
|
||||
player.spigot().sendMessage(customEvent.getChatMessageType(), customEvent.getNotificationTextComponent());
|
||||
|
||||
if(customEvent.isMessageAlsoBeingSentToChat())
|
||||
{
|
||||
//Send copy to chat system
|
||||
player.spigot().sendMessage(ChatMessageType.SYSTEM, customEvent.getNotificationTextComponent());
|
||||
}
|
||||
} else {
|
||||
player.spigot().sendMessage(customEvent.getChatMessageType(), customEvent.getNotificationTextComponent());
|
||||
}
|
||||
}
|
||||
|
||||
private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, ChatMessageType destination, TextComponent message) {
|
||||
//Init event
|
||||
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
|
||||
notificationType, message, destination);
|
||||
notificationType, message, destination, AdvancedConfig.getInstance().doesNotificationSendCopyToChat(notificationType));
|
||||
|
||||
//Call event
|
||||
Bukkit.getServer().getPluginManager().callEvent(customEvent);
|
||||
|
Reference in New Issue
Block a user