mcMMO now checks in all places for a loaded profile before executing processing on said profile

This commit is contained in:
nossr50
2019-04-12 15:17:05 -07:00
parent 00cc5f0845
commit 33a68daa9c
62 changed files with 560 additions and 21 deletions

View File

@@ -28,7 +28,7 @@ public class NotificationManager {
*/
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key)
{
if(!UserManager.getPlayer(player).useChatNotifications())
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
@@ -39,6 +39,15 @@ public class NotificationManager {
sendNotification(player, customEvent);
}
public static boolean doesPlayerUseNotifications(Player player)
{
if(UserManager.getPlayer(player) == null)
return false;
else
return UserManager.getPlayer(player).useChatNotifications();
}
/**
* Sends players notifications from mcMMO
* This does this by sending out an event so other plugins can cancel it
@@ -60,7 +69,7 @@ public class NotificationManager {
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
{
if(!UserManager.getPlayer(player).useChatNotifications())
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
@@ -108,7 +117,7 @@ public class NotificationManager {
*/
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel)
{
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications())
if(!mcMMOPlayer.useChatNotifications())
return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
@@ -129,7 +138,7 @@ public class NotificationManager {
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType)
{
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications())
if(!mcMMOPlayer.useChatNotifications())
return;
//CHAT MESSAGE